Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Type of "non negative float" doesn't generate boundary #32

Closed
GideonKoenig opened this issue Jul 1, 2022 · 1 comment · Fixed by #111
Closed

Type of "non negative float" doesn't generate boundary #32

GideonKoenig opened this issue Jul 1, 2022 · 1 comment · 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._forest/RandomForestRegressor/__init__/ccp_alpha

Expected Annotation Type

@boundary

Expected Annotation Inputs

Should be 0 <= value <= infty

Minimal API Data (optional)

Minimal API Data for `sklearn/sklearn.ensemble._forest/RandomForestRegressor/__init__/ccp_alpha`
{
    "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._forest/RandomForestRegressor"
            ],
            "functions": []
        }
    ],
    "classes": [
        {
            "id": "sklearn/sklearn.ensemble._forest/RandomForestRegressor",
            "name": "RandomForestRegressor",
            "qname": "sklearn.ensemble._forest.RandomForestRegressor",
            "decorators": [],
            "superclasses": [
                "ForestRegressor"
            ],
            "methods": [
                "sklearn/sklearn.ensemble._forest/RandomForestRegressor/__init__"
            ],
            "is_public": true,
            "reexported_by": [
                "sklearn/sklearn.ensemble"
            ],
            "description": "A random forest regressor.\n\nA random forest is a meta estimator that fits a number of classifying\ndecision trees on various sub-samples of the dataset and uses averaging\nto improve the predictive accuracy and control over-fitting.\nThe sub-sample size is controlled with the `max_samples` parameter if\n`bootstrap=True` (default), otherwise the whole dataset is used to build\neach tree.\n\nRead more in the :ref:`User Guide <forest>`.",
            "docstring": "\n    A random forest regressor.\n\n    A random forest is a meta estimator that fits a number of classifying\n    decision trees on various sub-samples of the dataset and uses averaging\n    to improve the predictive accuracy and control over-fitting.\n    The sub-sample size is controlled with the `max_samples` parameter if\n    `bootstrap=True` (default), otherwise the whole dataset is used to build\n    each tree.\n\n    Read more in the :ref:`User Guide <forest>`.\n\n    Parameters\n    ----------\n    n_estimators : int, default=100\n        The number of trees in the forest.\n\n        .. versionchanged:: 0.22\n           The default value of ``n_estimators`` changed from 10 to 100\n           in 0.22.\n\n    criterion : {\"squared_error\", \"absolute_error\", \"poisson\"},             default=\"squared_error\"\n        The function to measure the quality of a split. Supported criteria\n        are \"squared_error\" for the mean squared error, which is equal to\n        variance reduction as feature selection criterion, \"absolute_error\"\n        for the mean absolute error, and \"poisson\" which uses reduction in\n        Poisson deviance to find splits.\n        Training using \"absolute_error\" is significantly slower\n        than when using \"squared_error\".\n\n        .. versionadded:: 0.18\n           Mean Absolute Error (MAE) criterion.\n\n        .. versionadded:: 1.0\n           Poisson criterion.\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        .. deprecated:: 1.0\n            Criterion \"mae\" was deprecated in v1.0 and will be removed in\n            version 1.2. Use `criterion=\"absolute_error\"` which is equivalent.\n\n    max_depth : int, default=None\n        The maximum depth of the tree. If None, then nodes are expanded until\n        all leaves are pure or until all leaves contain less than\n        min_samples_split samples.\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, then consider `min_samples_split` as the minimum number.\n        - If float, then `min_samples_split` is a fraction and\n          `ceil(min_samples_split * n_samples)` are the minimum\n          number of samples for each split.\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, then consider `min_samples_leaf` as the minimum number.\n        - If float, then `min_samples_leaf` is a fraction and\n          `ceil(min_samples_leaf * n_samples)` are the minimum\n          number of samples for each node.\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\n    max_features : {\"sqrt\", \"log2\", None}, int or float, default=1.0\n        The number of features to consider when looking for the best split:\n\n        - If int, then consider `max_features` features at each split.\n        - If float, then `max_features` is a fraction and\n          `round(max_features * n_features)` features are considered at each\n          split.\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 or 1.0, then `max_features=n_features`.\n\n        .. note::\n            The default of 1.0 is equivalent to bagged trees and more\n            randomness can be achieved by setting smaller values, e.g. 0.3.\n\n        .. versionchanged:: 1.1\n            The default of `max_features` changed from `\"auto\"` to 1.0.\n\n        .. deprecated:: 1.1\n            The `\"auto\"` option was deprecated in 1.1 and will be removed\n            in 1.3.\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    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        If None then unlimited number of leaf nodes.\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\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    bootstrap : bool, default=True\n        Whether bootstrap samples are used when building trees. If False, the\n        whole dataset is used to build each tree.\n\n    oob_score : bool, default=False\n        Whether to use out-of-bag samples to estimate the generalization score.\n        Only available if bootstrap=True.\n\n    n_jobs : int, default=None\n        The number of jobs to run in parallel. :meth:`fit`, :meth:`predict`,\n        :meth:`decision_path` and :meth:`apply` are all parallelized over the\n        trees. ``None`` means 1 unless in a :obj:`joblib.parallel_backend`\n        context. ``-1`` means using all processors. See :term:`Glossary\n        <n_jobs>` for more details.\n\n    random_state : int, RandomState instance or None, default=None\n        Controls both the randomness of the bootstrapping of the samples used\n        when building trees (if ``bootstrap=True``) and the sampling of the\n        features to consider when looking for the best split at each node\n        (if ``max_features < n_features``).\n        See :term:`Glossary <random_state>` for details.\n\n    verbose : int, default=0\n        Controls the verbosity when fitting and predicting.\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 fit a whole\n        new forest. See :term:`the Glossary <warm_start>`.\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. See\n        :ref:`minimal_cost_complexity_pruning` for details.\n\n        .. versionadded:: 0.22\n\n    max_samples : int or float, default=None\n        If bootstrap is True, the number of samples to draw from X\n        to train each base estimator.\n\n        - If None (default), then draw `X.shape[0]` samples.\n        - If int, then draw `max_samples` samples.\n        - If float, then draw `max_samples * X.shape[0]` samples. Thus,\n          `max_samples` should be in the interval `(0.0, 1.0]`.\n\n        .. versionadded:: 0.22\n\n    Attributes\n    ----------\n    base_estimator_ : DecisionTreeRegressor\n        The child estimator template used to create the collection of fitted\n        sub-estimators.\n\n    estimators_ : list of DecisionTreeRegressor\n        The collection of fitted sub-estimators.\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    n_features_ : int\n        The number of features when ``fit`` is performed.\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    n_outputs_ : int\n        The number of outputs when ``fit`` is performed.\n\n    oob_score_ : float\n        Score of the training dataset obtained using an out-of-bag estimate.\n        This attribute exists only when ``oob_score`` is True.\n\n    oob_prediction_ : ndarray of shape (n_samples,) or (n_samples, n_outputs)\n        Prediction computed with out-of-bag estimate on the training set.\n        This attribute exists only when ``oob_score`` is True.\n\n    See Also\n    --------\n    sklearn.tree.DecisionTreeRegressor : A decision tree regressor.\n    sklearn.ensemble.ExtraTreesRegressor : Ensemble of extremely randomized\n        tree regressors.\n\n    Notes\n    -----\n    The default values for the parameters controlling the size of the trees\n    (e.g. ``max_depth``, ``min_samples_leaf``, etc.) lead to fully grown and\n    unpruned trees which can potentially be very large on some data sets. To\n    reduce memory consumption, the complexity and size of the trees should be\n    controlled by setting those parameter values.\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,\n    ``max_features=n_features`` and ``bootstrap=False``, if the improvement\n    of the criterion is identical for several splits enumerated during the\n    search of the best split. To obtain a deterministic behaviour during\n    fitting, ``random_state`` has to be fixed.\n\n    The default value ``max_features=\"auto\"`` uses ``n_features``\n    rather than ``n_features / 3``. The latter was originally suggested in\n    [1], whereas the former was more recently justified empirically in [2].\n\n    References\n    ----------\n    .. [1] L. Breiman, \"Random Forests\", Machine Learning, 45(1), 5-32, 2001.\n\n    .. [2] P. Geurts, D. Ernst., and L. Wehenkel, \"Extremely randomized\n           trees\", Machine Learning, 63(1), 3-42, 2006.\n\n    Examples\n    --------\n    >>> from sklearn.ensemble import RandomForestRegressor\n    >>> from sklearn.datasets import make_regression\n    >>> X, y = make_regression(n_features=4, n_informative=2,\n    ...                        random_state=0, shuffle=False)\n    >>> regr = RandomForestRegressor(max_depth=2, random_state=0)\n    >>> regr.fit(X, y)\n    RandomForestRegressor(...)\n    >>> print(regr.predict([[0, 0, 0, 0]]))\n    [-8.32987858]\n    "
        }
    ],
    "functions": [
        {
            "id": "sklearn/sklearn.ensemble._forest/RandomForestRegressor/__init__",
            "name": "__init__",
            "qname": "sklearn.ensemble._forest.RandomForestRegressor.__init__",
            "decorators": [],
            "parameters": [
                {
                    "id": "sklearn/sklearn.ensemble._forest/RandomForestRegressor/__init__/ccp_alpha",
                    "name": "ccp_alpha",
                    "qname": "sklearn.ensemble._forest.RandomForestRegressor.__init__.ccp_alpha",
                    "default_value": "0.0",
                    "assigned_by": "NAME_ONLY",
                    "is_public": true,
                    "docstring": {
                        "type": "non-negative float, default=0.0",
                        "description": "Complexity parameter used for Minimal Cost-Complexity Pruning. The\nsubtree with the largest cost complexity that is smaller than\n``ccp_alpha`` will be chosen. By default, no pruning is performed. See\n:ref:`minimal_cost_complexity_pruning` for details.\n\n.. versionadded:: 0.22"
                    },
                    "type": {}
                }
            ],
            "results": [],
            "is_public": true,
            "reexported_by": [],
            "description": "",
            "docstring": ""
        }
    ]
}

Minimal Usage Store (optional)

Minimal Usage Store for `sklearn/sklearn.ensemble._forest/RandomForestRegressor/__init__/ccp_alpha`
{
    "schemaVersion": 1,
    "module_counts": {
        "sklearn/sklearn.ensemble": 16686
    },
    "class_counts": {
        "sklearn/sklearn.ensemble._forest/RandomForestRegressor": 3939
    },
    "function_counts": {
        "sklearn/sklearn.ensemble._forest/RandomForestRegressor/__init__": 3939
    },
    "parameter_counts": {
        "sklearn/sklearn.ensemble._forest/RandomForestRegressor/__init__/ccp_alpha": 6
    },
    "value_counts": {
        "sklearn/sklearn.ensemble._forest/RandomForestRegressor/__init__/ccp_alpha": {
            "0": 1,
            "0.0": 3936,
            "7.135644710065878e-07": 1,
            "0.008": 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
Copy link
Member

Currently, the generator for boundary annotations only checks the description. It should look at the type as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.

2 participants