autopredictor.bestscore
Module Contents
Functions
|
This function identifies the best score with respect to a specific scoring metric along with the corresponding model. |
- autopredictor.bestscore.display_best_score(X, scoring_metric)[source]
This function identifies the best score with respect to a specific scoring metric along with the corresponding model. It returns a DataFrame and displays the result in a table format.
- Parameters:
X (DataFrame) – A DataFrame containing all scoring metrics results alongside the corresponding model, sorted alphabetically.
scoring_metric (str) – A string containing the regression scoring metric, which is used to display best model.
- Returns:
If the scoring metric is found, a dataframe containing the best score and the corresponding model is returned. If the scoring metric is not found, a ValueError is raised.
- Return type:
DataFrame
Examples
>>> from autopredictor.bestscore import display_best_score >>> df = pd.DataFrame({'MAE': [5.6, 3.4], 'MSE': [9.4, 21.4], 'MAPE': [0.34, 0.45], 'R2': [0.239, 0.712]}, index=['Linear Regression', 'Random Forest']) >>> display_best_score(df, 'MAE') MAE Random Forest 3.4
>>> display_best_score(df, 'F1') ValueError: Invalid Scoring metric 'F1'.The specified metric is not in the list of available metrics. Available metrics: MAE, MSE, MAPE, R2.