mds_2025_helper_functions.scores ================================ .. py:module:: mds_2025_helper_functions.scores Functions --------- .. autoapisummary:: mds_2025_helper_functions.scores.compare_model_scores Module Contents --------------- .. py:function:: compare_model_scores(*args, X, y=None, scoring=None, return_train_scores=False, **kwargs) Creates a table comparing mean cross-validation scores of multiple models. :param \*args: Model objects implementing the `fit` method. At least two models are required. :type \*args: sklearn.base.BaseEstimator :param X: Training data. :type X: array-like of shape (n_samples, n_features) :param y: Target values for supervised learning tasks. :type y: array-like of shape (n_samples,) or (n_samples, n_outputs), optional :param scoring: Metrics to evaluate models. Refer to `scikit-learn` scoring documentation: https://scikit-learn.org/stable/modules/model_evaluation.html#scoring-parameter. :type scoring: str, callable, list, tuple, or dict, optional :param return_train_scores: Whether to include training scores in addition to test scores. :type return_train_scores: bool, default=False :param \*\*kwargs: Additional arguments passed to `sklearn.model_selection.cross_validate`. :type \*\*kwargs: dict :returns: A DataFrame comparing model performance: - Rows represent different models. - Columns include metrics from cross-validation. - Index contains model names. :rtype: pd.DataFrame .. rubric:: Examples >>> from sklearn.linear_model import LogisticRegression >>> from sklearn.ensemble import RandomForestClassifier >>> compare_model_scores(LogisticRegression(), RandomForestClassifier(), X=X_train, y=y_train, scoring="accuracy")