Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing boundary for parameter with description like "Values must be in the range [1, inf)." #31

Closed
GideonKoenig opened this issue Jul 1, 2022 · 0 comments · Fixed by #111
Labels
@boundary Related to the @boundary annotation bug 🪲 Something isn't working missing annotation An annotation should have been generated automatically but wasn't

Comments

@GideonKoenig
Copy link
Contributor

URL Hash

#/sklearn/sklearn.ensemble._gb/GradientBoostingRegressor/__init__/n_estimators

Expected Annotation Type

@boundary

Expected Annotation Inputs

1 <= value < infty

Minimal API Data (optional)

Minimal API Data for `sklearn/sklearn.ensemble._gb/GradientBoostingRegressor/__init__/n_estimators`
{
    "schemaVersion": 1,
    "distribution": "scikit-learn",
    "package": "sklearn",
    "version": "1.1.1",
    "modules": [
        {
            "id": "sklearn/sklearn.ensemble",
            "name": "sklearn.ensemble",
            "imports": [],
            "from_imports": [
                {
                    "module": "sklearn.ensemble._bagging",
                    "declaration": "BaggingClassifier",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._bagging",
                    "declaration": "BaggingRegressor",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._base",
                    "declaration": "BaseEnsemble",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._forest",
                    "declaration": "ExtraTreesClassifier",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._forest",
                    "declaration": "ExtraTreesRegressor",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._forest",
                    "declaration": "RandomForestClassifier",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._forest",
                    "declaration": "RandomForestRegressor",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._forest",
                    "declaration": "RandomTreesEmbedding",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._gb",
                    "declaration": "GradientBoostingClassifier",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._gb",
                    "declaration": "GradientBoostingRegressor",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._hist_gradient_boosting.gradient_boosting",
                    "declaration": "HistGradientBoostingClassifier",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._hist_gradient_boosting.gradient_boosting",
                    "declaration": "HistGradientBoostingRegressor",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._iforest",
                    "declaration": "IsolationForest",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._stacking",
                    "declaration": "StackingClassifier",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._stacking",
                    "declaration": "StackingRegressor",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._voting",
                    "declaration": "VotingClassifier",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._voting",
                    "declaration": "VotingRegressor",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._weight_boosting",
                    "declaration": "AdaBoostClassifier",
                    "alias": null
                },
                {
                    "module": "sklearn.ensemble._weight_boosting",
                    "declaration": "AdaBoostRegressor",
                    "alias": null
                }
            ],
            "classes": [
                "sklearn/sklearn.ensemble._gb/GradientBoostingRegressor"
            ],
            "functions": []
        }
    ],
    "classes": [
        {
            "id": "sklearn/sklearn.ensemble._gb/GradientBoostingRegressor",
            "name": "GradientBoostingRegressor",
            "qname": "sklearn.ensemble._gb.GradientBoostingRegressor",
            "decorators": [],
            "superclasses": [
                "RegressorMixin",
                "BaseGradientBoosting"
            ],
            "methods": [
                "sklearn/sklearn.ensemble._gb/GradientBoostingRegressor/__init__"
            ],
            "is_public": true,
            "reexported_by": [
                "sklearn/sklearn.ensemble"
            ],
            "description": "Gradient Boosting for regression.\n\nGB builds an additive model in a forward stage-wise fashion;\nit allows for the optimization of arbitrary differentiable loss functions.\nIn each stage a regression tree is fit on the negative gradient of the\ngiven loss function.\n\nRead more in the :ref:`User Guide <gradient_boosting>`.",
            "docstring": "Gradient Boosting for regression.\n\n    GB builds an additive model in a forward stage-wise fashion;\n    it allows for the optimization of arbitrary differentiable loss functions.\n    In each stage a regression tree is fit on the negative gradient of the\n    given loss function.\n\n    Read more in the :ref:`User Guide <gradient_boosting>`.\n\n    Parameters\n    ----------\n    loss : {'squared_error', 'absolute_error', 'huber', 'quantile'},             default='squared_error'\n        Loss function to be optimized. 'squared_error' refers to the squared\n        error for regression. 'absolute_error' refers to the absolute error of\n        regression and is a robust loss function. 'huber' is a\n        combination of the two. 'quantile' allows quantile regression (use\n        `alpha` to specify the quantile).\n\n        .. deprecated:: 1.0\n            The loss 'ls' was deprecated in v1.0 and will be removed in\n            version 1.2. Use `loss='squared_error'` which is equivalent.\n\n        .. deprecated:: 1.0\n            The loss 'lad' was deprecated in v1.0 and will be removed in\n            version 1.2. Use `loss='absolute_error'` which is equivalent.\n\n    learning_rate : float, default=0.1\n        Learning rate shrinks the contribution of each tree by `learning_rate`.\n        There is a trade-off between learning_rate and n_estimators.\n        Values must be in the range `(0.0, inf)`.\n\n    n_estimators : int, default=100\n        The number of boosting stages to perform. Gradient boosting\n        is fairly robust to over-fitting so a large number usually\n        results in better performance.\n        Values must be in the range `[1, inf)`.\n\n    subsample : float, default=1.0\n        The fraction of samples to be used for fitting the individual base\n        learners. If smaller than 1.0 this results in Stochastic Gradient\n        Boosting. `subsample` interacts with the parameter `n_estimators`.\n        Choosing `subsample < 1.0` leads to a reduction of variance\n        and an increase in bias.\n        Values must be in the range `(0.0, 1.0]`.\n\n    criterion : {'friedman_mse', 'squared_error', 'mse'},             default='friedman_mse'\n        The function to measure the quality of a split. Supported criteria are\n        \"friedman_mse\" for the mean squared error with improvement score by\n        Friedman, \"squared_error\" for mean squared error. The default value of\n        \"friedman_mse\" is generally the best as it can provide a better\n        approximation in some cases.\n\n        .. versionadded:: 0.18\n\n        .. deprecated:: 1.0\n            Criterion 'mse' was deprecated in v1.0 and will be removed in\n            version 1.2. Use `criterion='squared_error'` which is equivalent.\n\n    min_samples_split : int or float, default=2\n        The minimum number of samples required to split an internal node:\n\n        - If int, values must be in the range `[2, inf)`.\n        - If float, values must be in the range `(0.0, 1.0]` and `min_samples_split`\n          will be `ceil(min_samples_split * n_samples)`.\n\n        .. versionchanged:: 0.18\n           Added float values for fractions.\n\n    min_samples_leaf : int or float, default=1\n        The minimum number of samples required to be at a leaf node.\n        A split point at any depth will only be considered if it leaves at\n        least ``min_samples_leaf`` training samples in each of the left and\n        right branches.  This may have the effect of smoothing the model,\n        especially in regression.\n\n        - If int, values must be in the range `[1, inf)`.\n        - If float, values must be in the range `(0.0, 1.0]` and `min_samples_leaf`\n          will be `ceil(min_samples_leaf * n_samples)`.\n\n        .. versionchanged:: 0.18\n           Added float values for fractions.\n\n    min_weight_fraction_leaf : float, default=0.0\n        The minimum weighted fraction of the sum total of weights (of all\n        the input samples) required to be at a leaf node. Samples have\n        equal weight when sample_weight is not provided.\n        Values must be in the range `[0.0, 0.5]`.\n\n    max_depth : int, default=3\n        Maximum depth of the individual regression estimators. The maximum\n        depth limits the number of nodes in the tree. Tune this parameter\n        for best performance; the best value depends on the interaction\n        of the input variables.\n        Values must be in the range `[1, inf)`.\n\n    min_impurity_decrease : float, default=0.0\n        A node will be split if this split induces a decrease of the impurity\n        greater than or equal to this value.\n        Values must be in the range `[0.0, inf)`.\n\n        The weighted impurity decrease equation is the following::\n\n            N_t / N * (impurity - N_t_R / N_t * right_impurity\n                                - N_t_L / N_t * left_impurity)\n\n        where ``N`` is the total number of samples, ``N_t`` is the number of\n        samples at the current node, ``N_t_L`` is the number of samples in the\n        left child, and ``N_t_R`` is the number of samples in the right child.\n\n        ``N``, ``N_t``, ``N_t_R`` and ``N_t_L`` all refer to the weighted sum,\n        if ``sample_weight`` is passed.\n\n        .. versionadded:: 0.19\n\n    init : estimator or 'zero', default=None\n        An estimator object that is used to compute the initial predictions.\n        ``init`` has to provide :term:`fit` and :term:`predict`. If 'zero', the\n        initial raw predictions are set to zero. By default a\n        ``DummyEstimator`` is used, predicting either the average target value\n        (for loss='squared_error'), or a quantile for the other losses.\n\n    random_state : int, RandomState instance or None, default=None\n        Controls the random seed given to each Tree estimator at each\n        boosting iteration.\n        In addition, it controls the random permutation of the features at\n        each split (see Notes for more details).\n        It also controls the random splitting of the training data to obtain a\n        validation set if `n_iter_no_change` is not None.\n        Pass an int for reproducible output across multiple function calls.\n        See :term:`Glossary <random_state>`.\n\n    max_features : {'auto', 'sqrt', 'log2'}, int or float, default=None\n        The number of features to consider when looking for the best split:\n\n        - If int, values must be in the range `[1, inf)`.\n        - If float, values must be in the range `(0.0, 1.0]` and the features\n          considered at each split will be `int(max_features * n_features)`.\n        - If \"auto\", then `max_features=n_features`.\n        - If \"sqrt\", then `max_features=sqrt(n_features)`.\n        - If \"log2\", then `max_features=log2(n_features)`.\n        - If None, then `max_features=n_features`.\n\n        Choosing `max_features < n_features` leads to a reduction of variance\n        and an increase in bias.\n\n        Note: the search for a split does not stop until at least one\n        valid partition of the node samples is found, even if it requires to\n        effectively inspect more than ``max_features`` features.\n\n    alpha : float, default=0.9\n        The alpha-quantile of the huber loss function and the quantile\n        loss function. Only if ``loss='huber'`` or ``loss='quantile'``.\n        Values must be in the range `(0.0, 1.0)`.\n\n    verbose : int, default=0\n        Enable verbose output. If 1 then it prints progress and performance\n        once in a while (the more trees the lower the frequency). If greater\n        than 1 then it prints progress and performance for every tree.\n        Values must be in the range `[0, inf)`.\n\n    max_leaf_nodes : int, default=None\n        Grow trees with ``max_leaf_nodes`` in best-first fashion.\n        Best nodes are defined as relative reduction in impurity.\n        Values must be in the range `[2, inf)`.\n        If None, then unlimited number of leaf nodes.\n\n    warm_start : bool, default=False\n        When set to ``True``, reuse the solution of the previous call to fit\n        and add more estimators to the ensemble, otherwise, just erase the\n        previous solution. See :term:`the Glossary <warm_start>`.\n\n    validation_fraction : float, default=0.1\n        The proportion of training data to set aside as validation set for\n        early stopping. Values must be in the range `(0.0, 1.0)`.\n        Only used if ``n_iter_no_change`` is set to an integer.\n\n        .. versionadded:: 0.20\n\n    n_iter_no_change : int, default=None\n        ``n_iter_no_change`` is used to decide if early stopping will be used\n        to terminate training when validation score is not improving. By\n        default it is set to None to disable early stopping. If set to a\n        number, it will set aside ``validation_fraction`` size of the training\n        data as validation and terminate training when validation score is not\n        improving in all of the previous ``n_iter_no_change`` numbers of\n        iterations.\n        Values must be in the range `[1, inf)`.\n\n        .. versionadded:: 0.20\n\n    tol : float, default=1e-4\n        Tolerance for the early stopping. When the loss is not improving\n        by at least tol for ``n_iter_no_change`` iterations (if set to a\n        number), the training stops.\n        Values must be in the range `(0.0, inf)`.\n\n        .. versionadded:: 0.20\n\n    ccp_alpha : non-negative float, default=0.0\n        Complexity parameter used for Minimal Cost-Complexity Pruning. The\n        subtree with the largest cost complexity that is smaller than\n        ``ccp_alpha`` will be chosen. By default, no pruning is performed.\n        Values must be in the range `[0.0, inf)`.\n        See :ref:`minimal_cost_complexity_pruning` for details.\n\n        .. versionadded:: 0.22\n\n    Attributes\n    ----------\n    feature_importances_ : ndarray of shape (n_features,)\n        The impurity-based feature importances.\n        The higher, the more important the feature.\n        The importance of a feature is computed as the (normalized)\n        total reduction of the criterion brought by that feature.  It is also\n        known as the Gini importance.\n\n        Warning: impurity-based feature importances can be misleading for\n        high cardinality features (many unique values). See\n        :func:`sklearn.inspection.permutation_importance` as an alternative.\n\n    oob_improvement_ : ndarray of shape (n_estimators,)\n        The improvement in loss (= deviance) on the out-of-bag samples\n        relative to the previous iteration.\n        ``oob_improvement_[0]`` is the improvement in\n        loss of the first stage over the ``init`` estimator.\n        Only available if ``subsample < 1.0``\n\n    train_score_ : ndarray of shape (n_estimators,)\n        The i-th score ``train_score_[i]`` is the deviance (= loss) of the\n        model at iteration ``i`` on the in-bag sample.\n        If ``subsample == 1`` this is the deviance on the training data.\n\n    loss_ : LossFunction\n        The concrete ``LossFunction`` object.\n\n        .. deprecated:: 1.1\n             Attribute `loss_` was deprecated in version 1.1 and will be\n            removed in 1.3.\n\n    init_ : estimator\n        The estimator that provides the initial predictions.\n        Set via the ``init`` argument or ``loss.init_estimator``.\n\n    estimators_ : ndarray of DecisionTreeRegressor of shape (n_estimators, 1)\n        The collection of fitted sub-estimators.\n\n    n_estimators_ : int\n        The number of estimators as selected by early stopping (if\n        ``n_iter_no_change`` is specified). Otherwise it is set to\n        ``n_estimators``.\n\n    n_features_ : int\n        The number of data features.\n\n        .. deprecated:: 1.0\n            Attribute `n_features_` was deprecated in version 1.0 and will be\n            removed in 1.2. Use `n_features_in_` instead.\n\n    n_features_in_ : int\n        Number of features seen during :term:`fit`.\n\n        .. versionadded:: 0.24\n\n    feature_names_in_ : ndarray of shape (`n_features_in_`,)\n        Names of features seen during :term:`fit`. Defined only when `X`\n        has feature names that are all strings.\n\n        .. versionadded:: 1.0\n\n    max_features_ : int\n        The inferred value of max_features.\n\n    See Also\n    --------\n    HistGradientBoostingRegressor : Histogram-based Gradient Boosting\n        Classification Tree.\n    sklearn.tree.DecisionTreeRegressor : A decision tree regressor.\n    sklearn.ensemble.RandomForestRegressor : A random forest regressor.\n\n    Notes\n    -----\n    The features are always randomly permuted at each split. Therefore,\n    the best found split may vary, even with the same training data and\n    ``max_features=n_features``, if the improvement of the criterion is\n    identical for several splits enumerated during the search of the best\n    split. To obtain a deterministic behaviour during fitting,\n    ``random_state`` has to be fixed.\n\n    References\n    ----------\n    J. Friedman, Greedy Function Approximation: A Gradient Boosting\n    Machine, The Annals of Statistics, Vol. 29, No. 5, 2001.\n\n    J. Friedman, Stochastic Gradient Boosting, 1999\n\n    T. Hastie, R. Tibshirani and J. Friedman.\n    Elements of Statistical Learning Ed. 2, Springer, 2009.\n\n    Examples\n    --------\n    >>> from sklearn.datasets import make_regression\n    >>> from sklearn.ensemble import GradientBoostingRegressor\n    >>> from sklearn.model_selection import train_test_split\n    >>> X, y = make_regression(random_state=0)\n    >>> X_train, X_test, y_train, y_test = train_test_split(\n    ...     X, y, random_state=0)\n    >>> reg = GradientBoostingRegressor(random_state=0)\n    >>> reg.fit(X_train, y_train)\n    GradientBoostingRegressor(random_state=0)\n    >>> reg.predict(X_test[1:2])\n    array([-61...])\n    >>> reg.score(X_test, y_test)\n    0.4...\n    "
        }
    ],
    "functions": [
        {
            "id": "sklearn/sklearn.ensemble._gb/GradientBoostingRegressor/__init__",
            "name": "__init__",
            "qname": "sklearn.ensemble._gb.GradientBoostingRegressor.__init__",
            "decorators": [],
            "parameters": [
                {
                    "id": "sklearn/sklearn.ensemble._gb/GradientBoostingRegressor/__init__/n_estimators",
                    "name": "n_estimators",
                    "qname": "sklearn.ensemble._gb.GradientBoostingRegressor.__init__.n_estimators",
                    "default_value": "100",
                    "assigned_by": "NAME_ONLY",
                    "is_public": true,
                    "docstring": {
                        "type": "int, default=100",
                        "description": "The number of boosting stages to perform. Gradient boosting\nis fairly robust to over-fitting so a large number usually\nresults in better performance.\nValues must be in the range `[1, inf)`."
                    },
                    "type": {}
                }
            ],
            "results": [],
            "is_public": true,
            "reexported_by": [],
            "description": "",
            "docstring": ""
        }
    ]
}

Minimal Usage Store (optional)

Minimal Usage Store for `sklearn/sklearn.ensemble._gb/GradientBoostingRegressor/__init__/n_estimators`
{
    "schemaVersion": 1,
    "module_counts": {
        "sklearn/sklearn.ensemble": 16686
    },
    "class_counts": {
        "sklearn/sklearn.ensemble._gb/GradientBoostingRegressor": 1720
    },
    "function_counts": {
        "sklearn/sklearn.ensemble._gb/GradientBoostingRegressor/__init__": 989
    },
    "parameter_counts": {
        "sklearn/sklearn.ensemble._gb/GradientBoostingRegressor/__init__/n_estimators": 529
    },
    "value_counts": {
        "sklearn/sklearn.ensemble._gb/GradientBoostingRegressor/__init__/n_estimators": {
            "5": 3,
            "10": 9,
            "20": 2,
            "25": 1,
            "30": 1,
            "35": 1,
            "40": 1,
            "50": 17,
            "70": 1,
            "71": 1,
            "72": 1,
            "75": 1,
            "94": 1,
            "100": 531,
            "110": 6,
            "111": 2,
            "120": 15,
            "125": 1,
            "130": 1,
            "133": 1,
            "140": 3,
            "141": 1,
            "150": 5,
            "159": 1,
            "165": 1,
            "166": 1,
            "200": 33,
            "225": 1,
            "250": 7,
            "255": 1,
            "300": 23,
            "308": 1,
            "330": 1,
            "342": 1,
            "360": 1,
            "400": 7,
            "450": 1,
            "500": 47,
            "600": 6,
            "650": 2,
            "700": 5,
            "800": 5,
            "900": 1,
            "1000": 40,
            "1070": 1,
            "1120": 4,
            "1200": 1,
            "1250": 1,
            "1500": 5,
            "1808": 1,
            "1992": 3,
            "2000": 13,
            "2200": 1,
            "2501": 1,
            "3000": 71,
            "3275": 4,
            "3500": 3,
            "4000": 34,
            "4556": 1,
            "5000": 5,
            "6000": 6,
            "8000": 1,
            "10000": 5,
            "25000": 1,
            "n_estimators": 16,
            "n_trees": 7,
            "trial.suggest_categorical('n_estimators', [100])": 1,
            "study.best_trial.params['n_estimators']": 1,
            "num_trees": 1,
            "i": 1,
            "estimators": 1,
            "_n_estimators": 1,
            "j": 1,
            "38 * 8": 1,
            "trial.suggest_int('n_estimators', 1, 300)": 1,
            "gs.best_params_['n_estimators']": 1,
            "tree": 1,
            "estimator": 1
        }
    }
}

Suggested Solution (optional)

No response

Additional Context (optional)

No response

@GideonKoenig GideonKoenig added bug 🪲 Something isn't working missing annotation An annotation should have been generated automatically but wasn't @boundary Related to the @boundary annotation labels Jul 1, 2022
@lars-reimann lars-reimann transferred this issue from Safe-DS/API-Editor Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@boundary Related to the @boundary annotation bug 🪲 Something isn't working missing annotation An annotation should have been generated automatically but wasn't
Projects
Status: ✔️ Done
Development

Successfully merging a pull request may close this issue.

1 participant