bioneuralnet.metrics.evaluation

Functions

evaluate_f1m(X, y[, model_type, ...])

Evaluate macro F1-score over multiple runs.

evaluate_f1w(X, y[, model_type, ...])

Evaluate weighted F1-score over multiple runs.

evaluate_model(X, y[, model_type, ...])

Evaluate a single model (RF or XGB, classif or reg) over multiple runs, returning three tuples.

evaluate_rf(X, y[, mode, n_estimators, ...])

Shortcut function: evaluate a RandomForest (classification or regression).

evaluate_single_run(X, y[, model_type, ...])

Do one train/test split, train the specified model.

evaluate_xgb(X, y[, mode, n_estimators, ...])

Shortcut function: evaluate an XGBoost (classification or regression).

get_logger(name)

Retrieves a global logger configured to write to 'bioneuralnet.log' at the project root.

plot_grouped_performance(scores, title[, ...])

Plot grouped bar chart and save results to text file.

plot_multiple_metrics(metrics[, title_map, ...])

Consolidate multiple metric grouped performances into one figure.

Classes

Path(*args, **kwargs)

PurePath subclass that can make system calls.

XGBClassifier(*args, **kwargs)

Implementation of the scikit-learn API for XGBoost classification.

XGBRegressor(*args, **kwargs)

Implementation of the scikit-learn API for XGBoost regression.

bioneuralnet.metrics.evaluation.evaluate_f1m(X: ndarray, y: ndarray, model_type: str = 'rf_classif', n_estimators: int = 100, runs: int = 5, seed: int = 119)[source]

Evaluate macro F1-score over multiple runs.

bioneuralnet.metrics.evaluation.evaluate_f1w(X: ndarray, y: ndarray, model_type: str = 'rf_classif', n_estimators: int = 100, runs: int = 5, seed: int = 119)[source]

Evaluate weighted F1-score over multiple runs.

bioneuralnet.metrics.evaluation.evaluate_model(X: ndarray, y: ndarray, model_type: str = 'rf_classif', n_estimators: int = 150, runs: int = 100, seed: int = 119)[source]

Evaluate a single model (RF or XGB, classif or reg) over multiple runs, returning three tuples. For classification:

  • (accuracy_mean, accuracy_std)

  • (f1_weighted_mean, f1_weighted_std)

  • (f1_macro_mean, f1_macro_std)

For regression:

  • (r2_mean, r2_std)

  • (None, None)

  • (None, None)

bioneuralnet.metrics.evaluation.evaluate_rf(X: ndarray, y: ndarray, mode: str = 'classification', n_estimators: int = 150, runs: int = 100, seed: int = 119, return_all: bool = False)[source]

Shortcut function: evaluate a RandomForest (classification or regression).

bioneuralnet.metrics.evaluation.evaluate_single_run(X: ndarray, y: ndarray, model_type: str = 'rf_classif', n_estimators: int = 100, test_size: float = 0.3, seed: int = 119)[source]

Do one train/test split, train the specified model.

Return: (accuracy, f1_weighted, f1_macro)

bioneuralnet.metrics.evaluation.evaluate_xgb(X: ndarray, y: ndarray, mode: str = 'classification', n_estimators: int = 150, runs: int = 100, seed: int = 119, return_all: bool = False)[source]

Shortcut function: evaluate an XGBoost (classification or regression).

bioneuralnet.metrics.evaluation.plot_grouped_performance(scores: dict[str, dict[str, tuple[float, float]]], title: str, ylabel: str = 'Score', filename: str | Path = None)[source]

Plot grouped bar chart and save results to text file.

bioneuralnet.metrics.evaluation.plot_multiple_metrics(metrics: dict[str, dict[str, dict[str, tuple[float, float]]]], title_map: dict[str, str] = None, ylabel_map: dict[str, str] = None, filename: Path = None)[source]

Consolidate multiple metric grouped performances into one figure.

Adds numeric labels on top of each bar.