sharkpy.battle ============== .. py:module:: sharkpy.battle Attributes ---------- .. autoapisummary:: sharkpy.battle.MODEL_DETAILS Functions --------- .. autoapisummary:: sharkpy.battle.battle sharkpy.battle._visualize_battle_results Module Contents --------------- .. py:data:: MODEL_DETAILS .. py:function:: 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 Battle multiple models against each other and return the champion. :param data: Input data for training :type data: pd.DataFrame :param target: Name of target column :type target: str :param models: List of model names to compete :type models: list :param metric: Metric to compare models (default: 'r2') :type metric: str :param n_trials: Number of optimization trials for boosting models (default: 30) :type n_trials: int :param early_stopping: If True, stops training if any model exceeds `min_score`. Not recommended as it may miss better models later (default: False) :type early_stopping: bool, optional :param min_score: Minimum score to trigger early stopping (ignored if early_stopping=False) (default: 0.5) :type min_score: float :param verbose: Verbosity level for model training (default: 0) :type verbose: int :returns: Dictionary containing champion model name, model object, score, all results, details, and comparison plot :rtype: dict .. py:function:: _visualize_battle_results(results) Create a bar plot of model performances.