Safe-DS / Library-Analyzer

Analysis of Python libraries and of code that uses them.
https://library-analyzer.safeds.com
MIT License
5 stars 0 forks source link

`@Optional` is generated even though the provided values are not meaningful #33

Open lukarade opened 2 years ago

lukarade commented 2 years ago

URL Hash

#/sklearn/sklearn.metrics._scorer/get_scorer/scoring

Actual Annotation Type

@optional

Actual Annotation Inputs

{
    "target": "sklearn/sklearn.metrics._scorer/get_scorer/scoring",
    "authors": [
        "$autogen$"
    ],
    "defaultType": "string",
    "defaultValue": "f1_macro"
}

Expected Annotation Type

@required

Expected Annotation Inputs

n/a

Minimal API Data (optional)

Minimal API Data for `sklearn/sklearn.metrics._scorer/get_scorer/scoring` ```json5 { "schemaVersion": 1, "distribution": "scikit-learn", "package": "sklearn", "version": "1.1.1", "modules": [ { "id": "sklearn/sklearn.metrics", "name": "sklearn.metrics", "imports": [], "from_imports": [ { "module": "sklearn.metrics", "declaration": "cluster", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "accuracy_score", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "balanced_accuracy_score", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "brier_score_loss", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "classification_report", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "cohen_kappa_score", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "confusion_matrix", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "f1_score", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "fbeta_score", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "hamming_loss", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "hinge_loss", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "jaccard_score", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "log_loss", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "matthews_corrcoef", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "multilabel_confusion_matrix", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "precision_recall_fscore_support", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "precision_score", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "recall_score", "alias": null }, { "module": "sklearn.metrics._classification", "declaration": "zero_one_loss", "alias": null }, { "module": "sklearn.metrics._dist_metrics", "declaration": "DistanceMetric", "alias": null }, { "module": "sklearn.metrics._plot.confusion_matrix", "declaration": "ConfusionMatrixDisplay", "alias": null }, { "module": "sklearn.metrics._plot.confusion_matrix", "declaration": "plot_confusion_matrix", "alias": null }, { "module": "sklearn.metrics._plot.det_curve", "declaration": "DetCurveDisplay", "alias": null }, { "module": "sklearn.metrics._plot.det_curve", "declaration": "plot_det_curve", "alias": null }, { "module": "sklearn.metrics._plot.precision_recall_curve", "declaration": "plot_precision_recall_curve", "alias": null }, { "module": "sklearn.metrics._plot.precision_recall_curve", "declaration": "PrecisionRecallDisplay", "alias": null }, { "module": "sklearn.metrics._plot.roc_curve", "declaration": "plot_roc_curve", "alias": null }, { "module": "sklearn.metrics._plot.roc_curve", "declaration": "RocCurveDisplay", "alias": null }, { "module": "sklearn.metrics._ranking", "declaration": "auc", "alias": null }, { "module": "sklearn.metrics._ranking", "declaration": "average_precision_score", "alias": null }, { "module": "sklearn.metrics._ranking", "declaration": "coverage_error", "alias": null }, { "module": "sklearn.metrics._ranking", "declaration": "dcg_score", "alias": null }, { "module": "sklearn.metrics._ranking", "declaration": "det_curve", "alias": null }, { "module": "sklearn.metrics._ranking", "declaration": "label_ranking_average_precision_score", "alias": null }, { "module": "sklearn.metrics._ranking", "declaration": "label_ranking_loss", "alias": null }, { "module": "sklearn.metrics._ranking", "declaration": "ndcg_score", "alias": null }, { "module": "sklearn.metrics._ranking", "declaration": "precision_recall_curve", "alias": null }, { "module": "sklearn.metrics._ranking", "declaration": "roc_auc_score", "alias": null }, { "module": "sklearn.metrics._ranking", "declaration": "roc_curve", "alias": null }, { "module": "sklearn.metrics._ranking", "declaration": "top_k_accuracy_score", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "d2_absolute_error_score", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "d2_pinball_score", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "d2_tweedie_score", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "explained_variance_score", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "max_error", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "mean_absolute_error", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "mean_absolute_percentage_error", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "mean_gamma_deviance", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "mean_pinball_loss", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "mean_poisson_deviance", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "mean_squared_error", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "mean_squared_log_error", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "mean_tweedie_deviance", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "median_absolute_error", "alias": null }, { "module": "sklearn.metrics._regression", "declaration": "r2_score", "alias": null }, { "module": "sklearn.metrics._scorer", "declaration": "check_scoring", "alias": null }, { "module": "sklearn.metrics._scorer", "declaration": "get_scorer", "alias": null }, { "module": "sklearn.metrics._scorer", "declaration": "get_scorer_names", "alias": null }, { "module": "sklearn.metrics._scorer", "declaration": "make_scorer", "alias": null }, { "module": "sklearn.metrics._scorer", "declaration": "SCORERS", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "adjusted_mutual_info_score", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "adjusted_rand_score", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "calinski_harabasz_score", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "completeness_score", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "consensus_score", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "davies_bouldin_score", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "fowlkes_mallows_score", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "homogeneity_completeness_v_measure", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "homogeneity_score", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "mutual_info_score", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "normalized_mutual_info_score", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "pair_confusion_matrix", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "rand_score", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "silhouette_samples", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "silhouette_score", "alias": null }, { "module": "sklearn.metrics.cluster", "declaration": "v_measure_score", "alias": null }, { "module": "sklearn.metrics.pairwise", "declaration": "euclidean_distances", "alias": null }, { "module": "sklearn.metrics.pairwise", "declaration": "nan_euclidean_distances", "alias": null }, { "module": "sklearn.metrics.pairwise", "declaration": "pairwise_distances", "alias": null }, { "module": "sklearn.metrics.pairwise", "declaration": "pairwise_distances_argmin", "alias": null }, { "module": "sklearn.metrics.pairwise", "declaration": "pairwise_distances_argmin_min", "alias": null }, { "module": "sklearn.metrics.pairwise", "declaration": "pairwise_distances_chunked", "alias": null }, { "module": "sklearn.metrics.pairwise", "declaration": "pairwise_kernels", "alias": null } ], "classes": [], "functions": [ "sklearn/sklearn.metrics._scorer/get_scorer" ] } ], "classes": [], "functions": [ { "id": "sklearn/sklearn.metrics._scorer/get_scorer", "name": "get_scorer", "qname": "sklearn.metrics._scorer.get_scorer", "decorators": [], "parameters": [ { "id": "sklearn/sklearn.metrics._scorer/get_scorer/scoring", "name": "scoring", "qname": "sklearn.metrics._scorer.get_scorer.scoring", "default_value": null, "assigned_by": "POSITION_OR_NAME", "is_public": true, "docstring": { "type": "str or callable", "description": "Scoring method as string. If callable it is returned as is." }, "type": {} } ], "results": [], "is_public": true, "reexported_by": [ "sklearn/sklearn.metrics" ], "description": "Get a scorer from string.\n\nRead more in the :ref:`User Guide `.\n:func:`~sklearn.metrics.get_scorer_names` can be used to retrieve the names\nof all available scorers.", "docstring": "Get a scorer from string.\n\nRead more in the :ref:`User Guide `.\n:func:`~sklearn.metrics.get_scorer_names` can be used to retrieve the names\nof all available scorers.\n\nParameters\n----------\nscoring : str or callable\n Scoring method as string. If callable it is returned as is.\n\nReturns\n-------\nscorer : callable\n The scorer.\n\nNotes\n-----\nWhen passed a string, this function always returns a copy of the scorer\nobject. Calling `get_scorer` twice for the same scorer results in two\nseparate scorer objects." } ] } ```

Minimal Usage Store (optional)

Minimal Usage Store for `sklearn/sklearn.metrics._scorer/get_scorer/scoring` ```json5 { "schemaVersion": 1, "module_counts": { "sklearn/sklearn.metrics": 53559 }, "class_counts": {}, "function_counts": { "sklearn/sklearn.metrics._scorer/get_scorer": 5 }, "parameter_counts": { "sklearn/sklearn.metrics._scorer/get_scorer/scoring": 5 }, "value_counts": { "sklearn/sklearn.metrics._scorer/get_scorer/scoring": { "'f1_macro'": 3, "'accuracy'": 1, "'neg_mean_squared_error'": 1 } } } ```

Suggested Solution (optional)

Change the math function that decides which annotation is choosen: Implement a threshold to change the generation for parameters with little occurences.

Additional Context (optional)

grafik

Aclrian commented 2 years ago

Also at #/sklearn/sklearn.cluster._kmeans/MiniBatchKMeans/__init__/batch_size where 36 and 28 is the number of call of the most used parameters.

lukarade commented 2 years ago

For a further examples see: #/sklearn/sklearn.feature_selection._univariate_selection/GenericUnivariateSelect/__init__/param #/sklearn/sklearn.semi_supervised._label_propagation/LabelSpreading/__init__ all functions