Safe-DS / API-Editor

A toolkit to provide an improved API for new users of a Python library.
https://api-editor.safeds.com
MIT License
9 stars 0 forks source link

Missing annotation for keyword 'in the range' and upper boundary with 2 asterisks #869

Closed nvollroth closed 2 years ago

nvollroth commented 2 years ago

URL Hash

#/sklearn/sklearn.linear_model._stochastic_gradient/SGDClassifier/__init__/random_state

Expected Annotation Type

@boundary

Expected Annotation Inputs

[0, 2**32-1]

Minimal API Data (optional)

Minimal API Data for `sklearn/sklearn.linear_model._stochastic_gradient/SGDClassifier/__init__/random_state` ```json5 { "schemaVersion": 1, "distribution": "scikit-learn", "package": "sklearn", "version": "1.1.1", "modules": [ { "id": "sklearn/sklearn.linear_model", "name": "sklearn.linear_model", "imports": [], "from_imports": [ { "module": "sklearn.linear_model._base", "declaration": "LinearRegression", "alias": null }, { "module": "sklearn.linear_model._bayes", "declaration": "ARDRegression", "alias": null }, { "module": "sklearn.linear_model._bayes", "declaration": "BayesianRidge", "alias": null }, { "module": "sklearn.linear_model._coordinate_descent", "declaration": "ElasticNet", "alias": null }, { "module": "sklearn.linear_model._coordinate_descent", "declaration": "ElasticNetCV", "alias": null }, { "module": "sklearn.linear_model._coordinate_descent", "declaration": "enet_path", "alias": null }, { "module": "sklearn.linear_model._coordinate_descent", "declaration": "Lasso", "alias": null }, { "module": "sklearn.linear_model._coordinate_descent", "declaration": "lasso_path", "alias": null }, { "module": "sklearn.linear_model._coordinate_descent", "declaration": "LassoCV", "alias": null }, { "module": "sklearn.linear_model._coordinate_descent", "declaration": "MultiTaskElasticNet", "alias": null }, { "module": "sklearn.linear_model._coordinate_descent", "declaration": "MultiTaskElasticNetCV", "alias": null }, { "module": "sklearn.linear_model._coordinate_descent", "declaration": "MultiTaskLasso", "alias": null }, { "module": "sklearn.linear_model._coordinate_descent", "declaration": "MultiTaskLassoCV", "alias": null }, { "module": "sklearn.linear_model._glm", "declaration": "GammaRegressor", "alias": null }, { "module": "sklearn.linear_model._glm", "declaration": "PoissonRegressor", "alias": null }, { "module": "sklearn.linear_model._glm", "declaration": "TweedieRegressor", "alias": null }, { "module": "sklearn.linear_model._huber", "declaration": "HuberRegressor", "alias": null }, { "module": "sklearn.linear_model._least_angle", "declaration": "Lars", "alias": null }, { "module": "sklearn.linear_model._least_angle", "declaration": "lars_path", "alias": null }, { "module": "sklearn.linear_model._least_angle", "declaration": "lars_path_gram", "alias": null }, { "module": "sklearn.linear_model._least_angle", "declaration": "LarsCV", "alias": null }, { "module": "sklearn.linear_model._least_angle", "declaration": "LassoLars", "alias": null }, { "module": "sklearn.linear_model._least_angle", "declaration": "LassoLarsCV", "alias": null }, { "module": "sklearn.linear_model._least_angle", "declaration": "LassoLarsIC", "alias": null }, { "module": "sklearn.linear_model._logistic", "declaration": "LogisticRegression", "alias": null }, { "module": "sklearn.linear_model._logistic", "declaration": "LogisticRegressionCV", "alias": null }, { "module": "sklearn.linear_model._omp", "declaration": "orthogonal_mp", "alias": null }, { "module": "sklearn.linear_model._omp", "declaration": "orthogonal_mp_gram", "alias": null }, { "module": "sklearn.linear_model._omp", "declaration": "OrthogonalMatchingPursuit", "alias": null }, { "module": "sklearn.linear_model._omp", "declaration": "OrthogonalMatchingPursuitCV", "alias": null }, { "module": "sklearn.linear_model._passive_aggressive", "declaration": "PassiveAggressiveClassifier", "alias": null }, { "module": "sklearn.linear_model._passive_aggressive", "declaration": "PassiveAggressiveRegressor", "alias": null }, { "module": "sklearn.linear_model._perceptron", "declaration": "Perceptron", "alias": null }, { "module": "sklearn.linear_model._quantile", "declaration": "QuantileRegressor", "alias": null }, { "module": "sklearn.linear_model._ransac", "declaration": "RANSACRegressor", "alias": null }, { "module": "sklearn.linear_model._ridge", "declaration": "Ridge", "alias": null }, { "module": "sklearn.linear_model._ridge", "declaration": "ridge_regression", "alias": null }, { "module": "sklearn.linear_model._ridge", "declaration": "RidgeClassifier", "alias": null }, { "module": "sklearn.linear_model._ridge", "declaration": "RidgeClassifierCV", "alias": null }, { "module": "sklearn.linear_model._ridge", "declaration": "RidgeCV", "alias": null }, { "module": "sklearn.linear_model._sgd_fast", "declaration": "Hinge", "alias": null }, { "module": "sklearn.linear_model._sgd_fast", "declaration": "Huber", "alias": null }, { "module": "sklearn.linear_model._sgd_fast", "declaration": "Log", "alias": null }, { "module": "sklearn.linear_model._sgd_fast", "declaration": "ModifiedHuber", "alias": null }, { "module": "sklearn.linear_model._sgd_fast", "declaration": "SquaredLoss", "alias": null }, { "module": "sklearn.linear_model._stochastic_gradient", "declaration": "SGDClassifier", "alias": null }, { "module": "sklearn.linear_model._stochastic_gradient", "declaration": "SGDOneClassSVM", "alias": null }, { "module": "sklearn.linear_model._stochastic_gradient", "declaration": "SGDRegressor", "alias": null }, { "module": "sklearn.linear_model._theil_sen", "declaration": "TheilSenRegressor", "alias": null } ], "classes": [ "sklearn/sklearn.linear_model._stochastic_gradient/SGDClassifier" ], "functions": [] } ], "classes": [ { "id": "sklearn/sklearn.linear_model._stochastic_gradient/SGDClassifier", "name": "SGDClassifier", "qname": "sklearn.linear_model._stochastic_gradient.SGDClassifier", "decorators": [], "superclasses": [ "BaseSGDClassifier" ], "methods": [ "sklearn/sklearn.linear_model._stochastic_gradient/SGDClassifier/__init__" ], "is_public": true, "reexported_by": [ "sklearn/sklearn.linear_model" ], "description": "Linear classifiers (SVM, logistic regression, etc.) with SGD training.\n\nThis estimator implements regularized linear models with stochastic\ngradient descent (SGD) learning: the gradient of the loss is estimated\neach sample at a time and the model is updated along the way with a\ndecreasing strength schedule (aka learning rate). SGD allows minibatch\n(online/out-of-core) learning via the `partial_fit` method.\nFor best results using the default learning rate schedule, the data should\nhave zero mean and unit variance.\n\nThis implementation works with data represented as dense or sparse arrays\nof floating point values for the features. The model it fits can be\ncontrolled with the loss parameter; by default, it fits a linear support\nvector machine (SVM).\n\nThe regularizer is a penalty added to the loss function that shrinks model\nparameters towards the zero vector using either the squared euclidean norm\nL2 or the absolute norm L1 or a combination of both (Elastic Net). If the\nparameter update crosses the 0.0 value because of the regularizer, the\nupdate is truncated to 0.0 to allow for learning sparse models and achieve\nonline feature selection.\n\nRead more in the :ref:`User Guide `.", "docstring": "Linear classifiers (SVM, logistic regression, etc.) with SGD training.\n\n This estimator implements regularized linear models with stochastic\n gradient descent (SGD) learning: the gradient of the loss is estimated\n each sample at a time and the model is updated along the way with a\n decreasing strength schedule (aka learning rate). SGD allows minibatch\n (online/out-of-core) learning via the `partial_fit` method.\n For best results using the default learning rate schedule, the data should\n have zero mean and unit variance.\n\n This implementation works with data represented as dense or sparse arrays\n of floating point values for the features. The model it fits can be\n controlled with the loss parameter; by default, it fits a linear support\n vector machine (SVM).\n\n The regularizer is a penalty added to the loss function that shrinks model\n parameters towards the zero vector using either the squared euclidean norm\n L2 or the absolute norm L1 or a combination of both (Elastic Net). If the\n parameter update crosses the 0.0 value because of the regularizer, the\n update is truncated to 0.0 to allow for learning sparse models and achieve\n online feature selection.\n\n Read more in the :ref:`User Guide `.\n\n Parameters\n ----------\n loss : {'hinge', 'log_loss', 'log', 'modified_huber', 'squared_hinge', 'perceptron', 'squared_error', 'huber', 'epsilon_insensitive', 'squared_epsilon_insensitive'}, default='hinge'\n The loss function to be used.\n\n - 'hinge' gives a linear SVM.\n - 'log_loss' gives logistic regression, a probabilistic classifier.\n - 'modified_huber' is another smooth loss that brings tolerance to\n outliers as well as probability estimates.\n - 'squared_hinge' is like hinge but is quadratically penalized.\n - 'perceptron' is the linear loss used by the perceptron algorithm.\n - The other losses, 'squared_error', 'huber', 'epsilon_insensitive' and\n 'squared_epsilon_insensitive' are designed for regression but can be useful\n in classification as well; see\n :class:`~sklearn.linear_model.SGDRegressor` for a description.\n\n More details about the losses formulas can be found in the\n :ref:`User Guide `.\n\n .. deprecated:: 1.0\n The loss 'squared_loss' was deprecated in v1.0 and will be removed\n in version 1.2. Use `loss='squared_error'` which is equivalent.\n\n .. deprecated:: 1.1\n The loss 'log' was deprecated in v1.1 and will be removed\n in version 1.3. Use `loss='log_loss'` which is equivalent.\n\n penalty : {'l2', 'l1', 'elasticnet'}, default='l2'\n The penalty (aka regularization term) to be used. Defaults to 'l2'\n which is the standard regularizer for linear SVM models. 'l1' and\n 'elasticnet' might bring sparsity to the model (feature selection)\n not achievable with 'l2'.\n\n alpha : float, default=0.0001\n Constant that multiplies the regularization term. The higher the\n value, the stronger the regularization.\n Also used to compute the learning rate when set to `learning_rate` is\n set to 'optimal'.\n Values must be in the range `[0.0, inf)`.\n\n l1_ratio : float, default=0.15\n The Elastic Net mixing parameter, with 0 <= l1_ratio <= 1.\n l1_ratio=0 corresponds to L2 penalty, l1_ratio=1 to L1.\n Only used if `penalty` is 'elasticnet'.\n Values must be in the range `[0.0, 1.0]`.\n\n fit_intercept : bool, default=True\n Whether the intercept should be estimated or not. If False, the\n data is assumed to be already centered.\n\n max_iter : int, default=1000\n The maximum number of passes over the training data (aka epochs).\n It only impacts the behavior in the ``fit`` method, and not the\n :meth:`partial_fit` method.\n Values must be in the range `[1, inf)`.\n\n .. versionadded:: 0.19\n\n tol : float, default=1e-3\n The stopping criterion. If it is not None, training will stop\n when (loss > best_loss - tol) for ``n_iter_no_change`` consecutive\n epochs.\n Convergence is checked against the training loss or the\n validation loss depending on the `early_stopping` parameter.\n Values must be in the range `[0.0, inf)`.\n\n .. versionadded:: 0.19\n\n shuffle : bool, default=True\n Whether or not the training data should be shuffled after each epoch.\n\n verbose : int, default=0\n The verbosity level.\n Values must be in the range `[0, inf)`.\n\n epsilon : float, default=0.1\n Epsilon in the epsilon-insensitive loss functions; only if `loss` is\n 'huber', 'epsilon_insensitive', or 'squared_epsilon_insensitive'.\n For 'huber', determines the threshold at which it becomes less\n important to get the prediction exactly right.\n For epsilon-insensitive, any differences between the current prediction\n and the correct label are ignored if they are less than this threshold.\n Values must be in the range `[0.0, inf)`.\n\n n_jobs : int, default=None\n The number of CPUs to use to do the OVA (One Versus All, for\n multi-class problems) computation.\n ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.\n ``-1`` means using all processors. See :term:`Glossary `\n for more details.\n\n random_state : int, RandomState instance, default=None\n Used for shuffling the data, when ``shuffle`` is set to ``True``.\n Pass an int for reproducible output across multiple function calls.\n See :term:`Glossary `.\n Integer values must be in the range `[0, 2**32 - 1]`.\n\n learning_rate : str, default='optimal'\n The learning rate schedule:\n\n - 'constant': `eta = eta0`\n - 'optimal': `eta = 1.0 / (alpha * (t + t0))`\n where `t0` is chosen by a heuristic proposed by Leon Bottou.\n - 'invscaling': `eta = eta0 / pow(t, power_t)`\n - 'adaptive': `eta = eta0`, as long as the training keeps decreasing.\n Each time n_iter_no_change consecutive epochs fail to decrease the\n training loss by tol or fail to increase validation score by tol if\n `early_stopping` is `True`, the current learning rate is divided by 5.\n\n .. versionadded:: 0.20\n Added 'adaptive' option\n\n eta0 : float, default=0.0\n The initial learning rate for the 'constant', 'invscaling' or\n 'adaptive' schedules. The default value is 0.0 as eta0 is not used by\n the default schedule 'optimal'.\n Values must be in the range `(0.0, inf)`.\n\n power_t : float, default=0.5\n The exponent for inverse scaling learning rate [default 0.5].\n Values must be in the range `(-inf, inf)`.\n\n early_stopping : bool, default=False\n Whether to use early stopping to terminate training when validation\n score is not improving. If set to `True`, it will automatically set aside\n a stratified fraction of training data as validation and terminate\n training when validation score returned by the `score` method is not\n improving by at least tol for n_iter_no_change consecutive epochs.\n\n .. versionadded:: 0.20\n Added 'early_stopping' option\n\n validation_fraction : float, default=0.1\n The proportion of training data to set aside as validation set for\n early stopping. Must be between 0 and 1.\n Only used if `early_stopping` is True.\n Values must be in the range `(0.0, 1.0)`.\n\n .. versionadded:: 0.20\n Added 'validation_fraction' option\n\n n_iter_no_change : int, default=5\n Number of iterations with no improvement to wait before stopping\n fitting.\n Convergence is checked against the training loss or the\n validation loss depending on the `early_stopping` parameter.\n Integer values must be in the range `[1, max_iter)`.\n\n .. versionadded:: 0.20\n Added 'n_iter_no_change' option\n\n class_weight : dict, {class_label: weight} or \"balanced\", default=None\n Preset for the class_weight fit parameter.\n\n Weights associated with classes. If not given, all classes\n are supposed to have weight one.\n\n The \"balanced\" mode uses the values of y to automatically adjust\n weights inversely proportional to class frequencies in the input data\n as ``n_samples / (n_classes * np.bincount(y))``.\n\n warm_start : bool, default=False\n When set to True, reuse the solution of the previous call to fit as\n initialization, otherwise, just erase the previous solution.\n See :term:`the Glossary `.\n\n Repeatedly calling fit or partial_fit when warm_start is True can\n result in a different solution than when calling fit a single time\n because of the way the data is shuffled.\n If a dynamic learning rate is used, the learning rate is adapted\n depending on the number of samples already seen. Calling ``fit`` resets\n this counter, while ``partial_fit`` will result in increasing the\n existing counter.\n\n average : bool or int, default=False\n When set to `True`, computes the averaged SGD weights across all\n updates and stores the result in the ``coef_`` attribute. If set to\n an int greater than 1, averaging will begin once the total number of\n samples seen reaches `average`. So ``average=10`` will begin\n averaging after seeing 10 samples.\n Integer values must be in the range `[1, n_samples]`.\n\n Attributes\n ----------\n coef_ : ndarray of shape (1, n_features) if n_classes == 2 else (n_classes, n_features)\n Weights assigned to the features.\n\n intercept_ : ndarray of shape (1,) if n_classes == 2 else (n_classes,)\n Constants in decision function.\n\n n_iter_ : int\n The actual number of iterations before reaching the stopping criterion.\n For multiclass fits, it is the maximum over every binary fit.\n\n loss_function_ : concrete ``LossFunction``\n\n classes_ : array of shape (n_classes,)\n\n t_ : int\n Number of weight updates performed during training.\n Same as ``(n_iter_ * n_samples)``.\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 See Also\n --------\n sklearn.svm.LinearSVC : Linear support vector classification.\n LogisticRegression : Logistic regression.\n Perceptron : Inherits from SGDClassifier. ``Perceptron()`` is equivalent to\n ``SGDClassifier(loss=\"perceptron\", eta0=1, learning_rate=\"constant\",\n penalty=None)``.\n\n Examples\n --------\n >>> import numpy as np\n >>> from sklearn.linear_model import SGDClassifier\n >>> from sklearn.preprocessing import StandardScaler\n >>> from sklearn.pipeline import make_pipeline\n >>> X = np.array([[-1, -1], [-2, -1], [1, 1], [2, 1]])\n >>> Y = np.array([1, 1, 2, 2])\n >>> # Always scale the input. The most convenient way is to use a pipeline.\n >>> clf = make_pipeline(StandardScaler(),\n ... SGDClassifier(max_iter=1000, tol=1e-3))\n >>> clf.fit(X, Y)\n Pipeline(steps=[('standardscaler', StandardScaler()),\n ('sgdclassifier', SGDClassifier())])\n >>> print(clf.predict([[-0.8, -1]]))\n [1]\n " } ], "functions": [ { "id": "sklearn/sklearn.linear_model._stochastic_gradient/SGDClassifier/__init__", "name": "__init__", "qname": "sklearn.linear_model._stochastic_gradient.SGDClassifier.__init__", "decorators": [], "parameters": [ { "id": "sklearn/sklearn.linear_model._stochastic_gradient/SGDClassifier/__init__/random_state", "name": "random_state", "qname": "sklearn.linear_model._stochastic_gradient.SGDClassifier.__init__.random_state", "default_value": "None", "assigned_by": "NAME_ONLY", "is_public": true, "docstring": { "type": "int, RandomState instance, default=None", "description": "Used for shuffling the data, when ``shuffle`` is set to ``True``.\nPass an int for reproducible output across multiple function calls.\nSee :term:`Glossary `.\nInteger values must be in the range `[0, 2**32 - 1]`." }, "type": {} } ], "results": [], "is_public": true, "reexported_by": [], "description": "", "docstring": "" } ] } ```

Minimal Usage Store (optional)

Minimal Usage Store for `sklearn/sklearn.linear_model._stochastic_gradient/SGDClassifier/__init__/random_state` ```json5 { "schemaVersion": 1, "module_counts": { "sklearn/sklearn.linear_model": 22014 }, "class_counts": { "sklearn/sklearn.linear_model._stochastic_gradient/SGDClassifier": 871 }, "function_counts": { "sklearn/sklearn.linear_model._stochastic_gradient/SGDClassifier/__init__": 841 }, "parameter_counts": { "sklearn/sklearn.linear_model._stochastic_gradient/SGDClassifier/__init__/random_state": 560 }, "value_counts": { "sklearn/sklearn.linear_model._stochastic_gradient/SGDClassifier/__init__/random_state": { "0": 49, "1": 7, "5": 1, "9": 1, "10": 1, "14": 1, "20": 1, "25": 19, "31": 1, "34": 1, "42": 446, "55": 1, "69": 1, "99": 1, "101": 1, "123": 4, "171": 3, "910": 2, "2018": 1, "None": 293, "seed": 2, "random_state": 1, "RND_ST": 1, "RS": 1, "RANDOM_STATE": 1 } } } ```

Suggested Solution (optional)

No response

Additional Context (optional)

Not sure if the boundary was not recognized because of the keyword or the upper bound.

Aclrian commented 2 years ago

Duplicate of Safe-DS/Library-Analyzer#26.