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

Values 1 and 1.0 are seen as different #22

Open
jofaul opened this issue Jul 1, 2022 · 0 comments
Open

Values 1 and 1.0 are seen as different #22

jofaul opened this issue Jul 1, 2022 · 0 comments
Labels
bug 🪲 Something isn't working @optional Related to the @optional annotation @required Related to the @required annotation wrong annotation An annotation was generated automatically but is incorrect

Comments

@jofaul
Copy link
Contributor

jofaul commented Jul 1, 2022

URL Hash

#/sklearn/sklearn.kernel_approximation/RBFSampler/__init__/gamma

Actual Annotation Type

@required

Actual Annotation Inputs

{
    "target": "sklearn/sklearn.kernel_approximation/RBFSampler/__init__/gamma",
    "authors": [
        "$autogen$"
    ]
}

Expected Annotation Type

@optional

Expected Annotation Inputs

... or even constant with value 1

Minimal API Data (optional)

Minimal API Data for `sklearn/sklearn.kernel_approximation/RBFSampler/__init__/gamma`
{
    "schemaVersion": 1,
    "distribution": "scikit-learn",
    "package": "sklearn",
    "version": "1.1.1",
    "modules": [
        {
            "id": "sklearn/sklearn.kernel_approximation",
            "name": "sklearn.kernel_approximation",
            "imports": [
                {
                    "module": "numpy",
                    "alias": "np"
                },
                {
                    "module": "scipy.sparse",
                    "alias": "sp"
                },
                {
                    "module": "warnings",
                    "alias": null
                }
            ],
            "from_imports": [
                {
                    "module": "scipy.fft",
                    "declaration": "fft",
                    "alias": null
                },
                {
                    "module": "scipy.fft",
                    "declaration": "ifft",
                    "alias": null
                },
                {
                    "module": "scipy.linalg",
                    "declaration": "svd",
                    "alias": null
                },
                {
                    "module": "sklearn.base",
                    "declaration": "_ClassNamePrefixFeaturesOutMixin",
                    "alias": null
                },
                {
                    "module": "sklearn.base",
                    "declaration": "BaseEstimator",
                    "alias": null
                },
                {
                    "module": "sklearn.base",
                    "declaration": "TransformerMixin",
                    "alias": null
                },
                {
                    "module": "sklearn.metrics.pairwise",
                    "declaration": "KERNEL_PARAMS",
                    "alias": null
                },
                {
                    "module": "sklearn.metrics.pairwise",
                    "declaration": "pairwise_kernels",
                    "alias": null
                },
                {
                    "module": "sklearn.utils",
                    "declaration": "check_random_state",
                    "alias": null
                },
                {
                    "module": "sklearn.utils.extmath",
                    "declaration": "safe_sparse_dot",
                    "alias": null
                },
                {
                    "module": "sklearn.utils.validation",
                    "declaration": "_check_feature_names_in",
                    "alias": null
                },
                {
                    "module": "sklearn.utils.validation",
                    "declaration": "check_is_fitted",
                    "alias": null
                },
                {
                    "module": "sklearn.utils.validation",
                    "declaration": "check_non_negative",
                    "alias": null
                }
            ],
            "classes": [
                "sklearn/sklearn.kernel_approximation/RBFSampler"
            ],
            "functions": []
        }
    ],
    "classes": [
        {
            "id": "sklearn/sklearn.kernel_approximation/RBFSampler",
            "name": "RBFSampler",
            "qname": "sklearn.kernel_approximation.RBFSampler",
            "decorators": [],
            "superclasses": [
                "_ClassNamePrefixFeaturesOutMixin",
                "TransformerMixin",
                "BaseEstimator"
            ],
            "methods": [
                "sklearn/sklearn.kernel_approximation/RBFSampler/__init__"
            ],
            "is_public": true,
            "reexported_by": [],
            "description": "Approximate a RBF kernel feature map using random Fourier features.\n\nIt implements a variant of Random Kitchen Sinks.[1]\n\nRead more in the :ref:`User Guide <rbf_kernel_approx>`.",
            "docstring": "Approximate a RBF kernel feature map using random Fourier features.\n\n    It implements a variant of Random Kitchen Sinks.[1]\n\n    Read more in the :ref:`User Guide <rbf_kernel_approx>`.\n\n    Parameters\n    ----------\n    gamma : float, default=1.0\n        Parameter of RBF kernel: exp(-gamma * x^2).\n\n    n_components : int, default=100\n        Number of Monte Carlo samples per original feature.\n        Equals the dimensionality of the computed feature space.\n\n    random_state : int, RandomState instance or None, default=None\n        Pseudo-random number generator to control the generation of the random\n        weights and random offset when fitting the training data.\n        Pass an int for reproducible output across multiple function calls.\n        See :term:`Glossary <random_state>`.\n\n    Attributes\n    ----------\n    random_offset_ : ndarray of shape (n_components,), dtype=float64\n        Random offset used to compute the projection in the `n_components`\n        dimensions of the feature space.\n\n    random_weights_ : ndarray of shape (n_features, n_components),        dtype=float64\n        Random projection directions drawn from the Fourier transform\n        of the RBF kernel.\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    AdditiveChi2Sampler : Approximate feature map for additive chi2 kernel.\n    Nystroem : Approximate a kernel map using a subset of the training data.\n    PolynomialCountSketch : Polynomial kernel approximation via Tensor Sketch.\n    SkewedChi2Sampler : Approximate feature map for\n        \"skewed chi-squared\" kernel.\n    sklearn.metrics.pairwise.kernel_metrics : List of built-in kernels.\n\n    Notes\n    -----\n    See \"Random Features for Large-Scale Kernel Machines\" by A. Rahimi and\n    Benjamin Recht.\n\n    [1] \"Weighted Sums of Random Kitchen Sinks: Replacing\n    minimization with randomization in learning\" by A. Rahimi and\n    Benjamin Recht.\n    (https://people.eecs.berkeley.edu/~brecht/papers/08.rah.rec.nips.pdf)\n\n    Examples\n    --------\n    >>> from sklearn.kernel_approximation import RBFSampler\n    >>> from sklearn.linear_model import SGDClassifier\n    >>> X = [[0, 0], [1, 1], [1, 0], [0, 1]]\n    >>> y = [0, 0, 1, 1]\n    >>> rbf_feature = RBFSampler(gamma=1, random_state=1)\n    >>> X_features = rbf_feature.fit_transform(X)\n    >>> clf = SGDClassifier(max_iter=5, tol=1e-3)\n    >>> clf.fit(X_features, y)\n    SGDClassifier(max_iter=5)\n    >>> clf.score(X_features, y)\n    1.0\n    "
        }
    ],
    "functions": [
        {
            "id": "sklearn/sklearn.kernel_approximation/RBFSampler/__init__",
            "name": "__init__",
            "qname": "sklearn.kernel_approximation.RBFSampler.__init__",
            "decorators": [],
            "parameters": [
                {
                    "id": "sklearn/sklearn.kernel_approximation/RBFSampler/__init__/gamma",
                    "name": "gamma",
                    "qname": "sklearn.kernel_approximation.RBFSampler.__init__.gamma",
                    "default_value": "1.0",
                    "assigned_by": "NAME_ONLY",
                    "is_public": true,
                    "docstring": {
                        "type": "float, default=1.0",
                        "description": "Parameter of RBF kernel: exp(-gamma * x^2)."
                    },
                    "type": {}
                }
            ],
            "results": [],
            "is_public": true,
            "reexported_by": [],
            "description": "",
            "docstring": ""
        }
    ]
}

Minimal Usage Store (optional)

Minimal Usage Store for `sklearn/sklearn.kernel_approximation/RBFSampler/__init__/gamma`
{
    "schemaVersion": 1,
    "module_counts": {
        "sklearn/sklearn.kernel_approximation": 12
    },
    "class_counts": {
        "sklearn/sklearn.kernel_approximation/RBFSampler": 3
    },
    "function_counts": {
        "sklearn/sklearn.kernel_approximation/RBFSampler/__init__": 2
    },
    "parameter_counts": {
        "sklearn/sklearn.kernel_approximation/RBFSampler/__init__/gamma": 1
    },
    "value_counts": {
        "sklearn/sklearn.kernel_approximation/RBFSampler/__init__/gamma": {
            "1": 1,
            "1.0": 1
        }
    }
}

Suggested Solution (optional)

Assuming it is correct that 1 and 1.0 are the exact same number in python, view it as such

Additional Context (optional)

No response

@jofaul jofaul added the bug 🪲 Something isn't working label Jul 1, 2022
@lars-reimann lars-reimann transferred this issue from Safe-DS/API-Editor Mar 19, 2023
@lars-reimann lars-reimann added @optional Related to the @optional annotation @required Related to the @required annotation wrong annotation An annotation was generated automatically but is incorrect labels Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug 🪲 Something isn't working @optional Related to the @optional annotation @required Related to the @required annotation wrong annotation An annotation was generated automatically but is incorrect
Projects
Status: Backlog
Development

No branches or pull requests

2 participants