sharkpy.battle
Attributes
Functions
|
Battle multiple models against each other and return the champion. |
|
Create a bar plot of model performances. |
Module Contents
- sharkpy.battle.battle(self, data: pandas.DataFrame, target: str, models: List[str] = ['linear_regression', 'random_forest', 'xgboost'], metric: str = 'r2', n_trials: int = 30, early_stopping: bool = False, min_score: float = 0.5, verbose: int = 0) Dict[source]
Battle multiple models against each other and return the champion.
- Parameters:
data (pd.DataFrame) – Input data for training
target (str) – Name of target column
models (list) – List of model names to compete
metric (str) – Metric to compare models (default: ‘r2’)
n_trials (int) – Number of optimization trials for boosting models (default: 30)
early_stopping (bool, optional) – If True, stops training if any model exceeds min_score. Not recommended as it may miss better models later (default: False)
min_score (float) – Minimum score to trigger early stopping (ignored if early_stopping=False) (default: 0.5)
verbose (int) – Verbosity level for model training (default: 0)
- Returns:
Dictionary containing champion model name, model object, score, all results, details, and comparison plot
- Return type:
dict