repository stringclasses 11
values | repo_id stringlengths 1 3 | target_module_path stringlengths 16 72 | prompt stringlengths 298 21.7k | relavent_test_path stringlengths 50 99 | full_function stringlengths 336 33.8k | function_name stringlengths 2 51 | content_class stringclasses 3
values | external_dependencies stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|
scikit-learn | 122 | sklearn/neighbors/_nca.py | def _loss_grad_lbfgs(self, transformation, X, same_class_mask, sign=1.0):
"""Compute the loss and the loss gradient w.r.t. `transformation`.
Parameters
----------
transformation : ndarray of shape (n_components * n_features,)
The raveled linear transformation on which to... | /usr/src/app/target_test_cases/failed_tests_NeighborhoodComponentsAnalysis._loss_grad_lbfgs.txt | def _loss_grad_lbfgs(self, transformation, X, same_class_mask, sign=1.0):
"""Compute the loss and the loss gradient w.r.t. `transformation`.
Parameters
----------
transformation : ndarray of shape (n_components * n_features,)
The raveled linear transformation on which to... | NeighborhoodComponentsAnalysis._loss_grad_lbfgs | repository-level | external |
scikit-learn | 123 | sklearn/neighbors/_nca.py | def fit(self, X, y):
"""Fit the model according to the given training data.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The training samples.
y : array-like of shape (n_samples,)
The corresponding training labels.
R... | /usr/src/app/target_test_cases/failed_tests_NeighborhoodComponentsAnalysis.fit.txt | def fit(self, X, y):
"""Fit the model according to the given training data.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The training samples.
y : array-like of shape (n_samples,)
The corresponding training labels.
R... | NeighborhoodComponentsAnalysis.fit | repository-level | external |
scikit-learn | 124 | sklearn/kernel_approximation.py | def fit(self, X, y=None):
"""Fit estimator to data.
Samples a subset of training points, computes kernel
on these and computes normalization matrix.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Training data, where `n_samples` is t... | /usr/src/app/target_test_cases/failed_tests_Nystroem.fit.txt | def fit(self, X, y=None):
"""Fit estimator to data.
Samples a subset of training points, computes kernel
on these and computes normalization matrix.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Training data, where `n_samples` is t... | Nystroem.fit | repository-level | external |
scikit-learn | 125 | sklearn/covariance/_shrunk_covariance.py | def fit(self, X, y=None):
"""Fit the Oracle Approximating Shrinkage covariance model to X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of featur... | /usr/src/app/target_test_cases/failed_tests_OAS.fit.txt | def fit(self, X, y=None):
"""Fit the Oracle Approximating Shrinkage covariance model to X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of featur... | OAS.fit | repository-level | external |
scikit-learn | 126 | sklearn/preprocessing/_encoders.py | def fit(self, X, y=None):
"""
Fit OneHotEncoder to X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data to determine the categories of each feature.
y : None
Ignored. This parameter exists only for compatibility w... | /usr/src/app/target_test_cases/failed_tests_OneHotEncoder.fit.txt | def fit(self, X, y=None):
"""
Fit OneHotEncoder to X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data to determine the categories of each feature.
y : None
Ignored. This parameter exists only for compatibility w... | OneHotEncoder.fit | repository-level | non_external |
scikit-learn | 127 | sklearn/preprocessing/_encoders.py | def get_feature_names_out(self, input_features=None):
"""Get output feature names for transformation.
Parameters
----------
input_features : array-like of str or None, default=None
Input features.
- If `input_features` is `None`, then `feature_names_in_` is
... | /usr/src/app/target_test_cases/failed_tests_OneHotEncoder.get_feature_names_out.txt | def get_feature_names_out(self, input_features=None):
"""Get output feature names for transformation.
Parameters
----------
input_features : array-like of str or None, default=None
Input features.
- If `input_features` is `None`, then `feature_names_in_` is
... | OneHotEncoder.get_feature_names_out | repository-level | external |
scikit-learn | 128 | sklearn/preprocessing/_encoders.py | def transform(self, X):
"""
Transform X using one-hot encoding.
If `sparse_output=True` (default), it returns an instance of
:class:`scipy.sparse._csr.csr_matrix` (CSR format).
If there are infrequent categories for a feature, set by specifying
`max_categories` or `... | /usr/src/app/target_test_cases/failed_tests_OneHotEncoder.transform.txt | def transform(self, X):
"""
Transform X using one-hot encoding.
If `sparse_output=True` (default), it returns an instance of
:class:`scipy.sparse._csr.csr_matrix` (CSR format).
If there are infrequent categories for a feature, set by specifying
`max_categories` or `... | OneHotEncoder.transform | repository-level | external |
scikit-learn | 129 | sklearn/multiclass.py | def decision_function(self, X):
"""Decision function for the OneVsOneClassifier.
The decision values for the samples are computed by adding the
normalized sum of pair-wise classification confidence levels to the
votes in order to disambiguate between the decision values when the
... | /usr/src/app/target_test_cases/failed_tests_OneVsOneClassifier.decision_function.txt | def decision_function(self, X):
"""Decision function for the OneVsOneClassifier.
The decision values for the samples are computed by adding the
normalized sum of pair-wise classification confidence levels to the
votes in order to disambiguate between the decision values when the
... | OneVsOneClassifier.decision_function | repository-level | external |
scikit-learn | 130 | sklearn/multiclass.py | def fit(self, X, y, **fit_params):
"""Fit underlying estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Data.
y : array-like of shape (n_samples,)
Multi-class targets.
**fit_params : dict
... | /usr/src/app/target_test_cases/failed_tests_OneVsOneClassifier.fit.txt | def fit(self, X, y, **fit_params):
"""Fit underlying estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Data.
y : array-like of shape (n_samples,)
Multi-class targets.
**fit_params : dict
... | OneVsOneClassifier.fit | repository-level | external |
scikit-learn | 131 | sklearn/multiclass.py | def partial_fit(self, X, y, classes=None, **partial_fit_params):
"""Partially fit underlying estimators.
Should be used when memory is inefficient to train all data. Chunks
of data can be passed in several iteration, where the first call
should have an array of all target variables.... | /usr/src/app/target_test_cases/failed_tests_OneVsOneClassifier.partial_fit.txt | def partial_fit(self, X, y, classes=None, **partial_fit_params):
"""Partially fit underlying estimators.
Should be used when memory is inefficient to train all data. Chunks
of data can be passed in several iteration, where the first call
should have an array of all target variables.... | OneVsOneClassifier.partial_fit | repository-level | external |
scikit-learn | 132 | sklearn/multiclass.py | def fit(self, X, y, **fit_params):
"""Fit underlying estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Data.
y : {array-like, sparse matrix} of shape (n_samples,) or (n_samples, n_classes)
Multi-class ... | /usr/src/app/target_test_cases/failed_tests_OneVsRestClassifier.fit.txt | def fit(self, X, y, **fit_params):
"""Fit underlying estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Data.
y : {array-like, sparse matrix} of shape (n_samples,) or (n_samples, n_classes)
Multi-class ... | OneVsRestClassifier.fit | repository-level | non_external |
scikit-learn | 133 | sklearn/multiclass.py | def partial_fit(self, X, y, classes=None, **partial_fit_params):
"""Partially fit underlying estimators.
Should be used when memory is inefficient to train all data.
Chunks of data can be passed in several iterations.
Parameters
----------
X : {array-like, sparse ma... | /usr/src/app/target_test_cases/failed_tests_OneVsRestClassifier.partial_fit.txt | def partial_fit(self, X, y, classes=None, **partial_fit_params):
"""Partially fit underlying estimators.
Should be used when memory is inefficient to train all data.
Chunks of data can be passed in several iterations.
Parameters
----------
X : {array-like, sparse ma... | OneVsRestClassifier.partial_fit | repository-level | external |
scikit-learn | 134 | sklearn/multiclass.py | def predict(self, X):
"""Predict multi-class targets using underlying estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Data.
Returns
-------
y : {array-like, sparse matrix} of shape (n_samples,) o... | /usr/src/app/target_test_cases/failed_tests_OneVsRestClassifier.predict.txt | def predict(self, X):
"""Predict multi-class targets using underlying estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Data.
Returns
-------
y : {array-like, sparse matrix} of shape (n_samples,) o... | OneVsRestClassifier.predict | repository-level | external |
scikit-learn | 135 | sklearn/multiclass.py | def predict_proba(self, X):
"""Probability estimates.
The returned estimates for all classes are ordered by label of classes.
Note that in the multilabel case, each sample can have any number of
labels. This returns the marginal probability that the given sample has
the lab... | /usr/src/app/target_test_cases/failed_tests_OneVsRestClassifier.predict_proba.txt | def predict_proba(self, X):
"""Probability estimates.
The returned estimates for all classes are ordered by label of classes.
Note that in the multilabel case, each sample can have any number of
labels. This returns the marginal probability that the given sample has
the lab... | OneVsRestClassifier.predict_proba | repository-level | external |
scikit-learn | 136 | sklearn/linear_model/_omp.py | def fit(self, X, y):
"""Fit the model using X, y as training data.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,) or (n_samples, n_targets)
Target values. Will be cast to X's ... | /usr/src/app/target_test_cases/failed_tests_OrthogonalMatchingPursuit.fit.txt | def fit(self, X, y):
"""Fit the model using X, y as training data.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,) or (n_samples, n_targets)
Target values. Will be cast to X's ... | OrthogonalMatchingPursuit.fit | repository-level | external |
scikit-learn | 137 | sklearn/linear_model/_omp.py | def fit(self, X, y, **fit_params):
"""Fit the model using X, y as training data.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
Target values. Will be cast to X's dtype if nec... | /usr/src/app/target_test_cases/failed_tests_OrthogonalMatchingPursuitCV.fit.txt | def fit(self, X, y, **fit_params):
"""Fit the model using X, y as training data.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
Target values. Will be cast to X's dtype if nec... | OrthogonalMatchingPursuitCV.fit | repository-level | external |
scikit-learn | 138 | sklearn/multiclass.py | def fit(self, X, y, **fit_params):
"""Fit underlying estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Data.
y : array-like of shape (n_samples,)
Multi-class targets.
**fit_params : dict
... | /usr/src/app/target_test_cases/failed_tests_OutputCodeClassifier.fit.txt | def fit(self, X, y, **fit_params):
"""Fit underlying estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Data.
y : array-like of shape (n_samples,)
Multi-class targets.
**fit_params : dict
... | OutputCodeClassifier.fit | repository-level | external |
scikit-learn | 139 | sklearn/multiclass.py | def predict(self, X):
"""Predict multi-class targets using underlying estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Data.
Returns
-------
y : ndarray of shape (n_samples,)
Predicted... | /usr/src/app/target_test_cases/failed_tests_OutputCodeClassifier.predict.txt | def predict(self, X):
"""Predict multi-class targets using underlying estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Data.
Returns
-------
y : ndarray of shape (n_samples,)
Predicted... | OutputCodeClassifier.predict | repository-level | external |
scikit-learn | 140 | sklearn/decomposition/_pca.py | def fit_transform(self, X, y=None):
"""Fit the model with X and apply the dimensionality reduction on X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_fe... | /usr/src/app/target_test_cases/failed_tests_PCA.fit_transform.txt | def fit_transform(self, X, y=None):
"""Fit the model with X and apply the dimensionality reduction on X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_fe... | PCA.fit_transform | repository-level | non_external |
scikit-learn | 141 | sklearn/linear_model/_passive_aggressive.py | def fit(self, X, y, coef_init=None, intercept_init=None):
"""Fit linear model with Passive Aggressive algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
... | /usr/src/app/target_test_cases/failed_tests_PassiveAggressiveClassifier.fit.txt | def fit(self, X, y, coef_init=None, intercept_init=None):
"""Fit linear model with Passive Aggressive algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
... | PassiveAggressiveClassifier.fit | repository-level | non_external |
scikit-learn | 142 | sklearn/linear_model/_passive_aggressive.py | def partial_fit(self, X, y, classes=None):
"""Fit linear model with Passive Aggressive algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Subset of the training data.
y : array-like of shape (n_samples,)
... | /usr/src/app/target_test_cases/failed_tests_PassiveAggressiveClassifier.partial_fit.txt | def partial_fit(self, X, y, classes=None):
"""Fit linear model with Passive Aggressive algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Subset of the training data.
y : array-like of shape (n_samples,)
... | PassiveAggressiveClassifier.partial_fit | repository-level | non_external |
scikit-learn | 143 | sklearn/linear_model/_passive_aggressive.py | def fit(self, X, y, coef_init=None, intercept_init=None):
"""Fit linear model with Passive Aggressive algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : numpy array of shape [n_samples]
... | /usr/src/app/target_test_cases/failed_tests_PassiveAggressiveRegressor.fit.txt | def fit(self, X, y, coef_init=None, intercept_init=None):
"""Fit linear model with Passive Aggressive algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : numpy array of shape [n_samples]
... | PassiveAggressiveRegressor.fit | repository-level | non_external |
scikit-learn | 144 | sklearn/linear_model/_passive_aggressive.py | def partial_fit(self, X, y):
"""Fit linear model with Passive Aggressive algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Subset of training data.
y : numpy array of shape [n_samples]
Subset of target ... | /usr/src/app/target_test_cases/failed_tests_PassiveAggressiveRegressor.partial_fit.txt | def partial_fit(self, X, y):
"""Fit linear model with Passive Aggressive algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Subset of training data.
y : numpy array of shape [n_samples]
Subset of target ... | PassiveAggressiveRegressor.partial_fit | repository-level | non_external |
scikit-learn | 145 | sklearn/feature_extraction/image.py | def transform(self, X):
"""Transform the image samples in `X` into a matrix of patch data.
Parameters
----------
X : ndarray of shape (n_samples, image_height, image_width) or \
(n_samples, image_height, image_width, n_channels)
Array of images from which... | /usr/src/app/target_test_cases/failed_tests_PatchExtractor.transform.txt | def transform(self, X):
"""Transform the image samples in `X` into a matrix of patch data.
Parameters
----------
X : ndarray of shape (n_samples, image_height, image_width) or \
(n_samples, image_height, image_width, n_channels)
Array of images from which... | PatchExtractor.transform | repository-level | external |
scikit-learn | 146 | sklearn/pipeline.py | def decision_function(self, X, **params):
"""Transform the data, and apply `decision_function` with the final estimator.
Call `transform` of each transformer in the pipeline. The transformed
data are finally passed to the final estimator that calls
`decision_function` method. Only v... | /usr/src/app/target_test_cases/failed_tests_Pipeline.decision_function.txt | def decision_function(self, X, **params):
"""Transform the data, and apply `decision_function` with the final estimator.
Call `transform` of each transformer in the pipeline. The transformed
data are finally passed to the final estimator that calls
`decision_function` method. Only v... | Pipeline.decision_function | repository-level | non_external |
scikit-learn | 147 | sklearn/pipeline.py | def fit(self, X, y=None, **params):
"""Fit the model.
Fit all the transformers one after the other and sequentially transform the
data. Finally, fit the transformed data using the final estimator.
Parameters
----------
X : iterable
Training data. Must fu... | /usr/src/app/target_test_cases/failed_tests_Pipeline.fit.txt | def fit(self, X, y=None, **params):
"""Fit the model.
Fit all the transformers one after the other and sequentially transform the
data. Finally, fit the transformed data using the final estimator.
Parameters
----------
X : iterable
Training data. Must fu... | Pipeline.fit | repository-level | non_external |
scikit-learn | 148 | sklearn/pipeline.py | def fit_transform(self, X, y=None, **params):
"""Fit the model and transform with the final estimator.
Fit all the transformers one after the other and sequentially transform
the data. Only valid if the final estimator either implements
`fit_transform` or `fit` and `transform`.
... | /usr/src/app/target_test_cases/failed_tests_Pipeline.fit_transform.txt | def fit_transform(self, X, y=None, **params):
"""Fit the model and transform with the final estimator.
Fit all the transformers one after the other and sequentially transform
the data. Only valid if the final estimator either implements
`fit_transform` or `fit` and `transform`.
... | Pipeline.fit_transform | repository-level | non_external |
scikit-learn | 149 | sklearn/pipeline.py | def get_feature_names_out(self, input_features=None):
"""Get output feature names for transformation.
Transform input features using the pipeline.
Parameters
----------
input_features : array-like of str or None, default=None
Input features.
Returns
... | /usr/src/app/target_test_cases/failed_tests_Pipeline.get_feature_names_out.txt | def get_feature_names_out(self, input_features=None):
"""Get output feature names for transformation.
Transform input features using the pipeline.
Parameters
----------
input_features : array-like of str or None, default=None
Input features.
Returns
... | Pipeline.get_feature_names_out | file-level | non_external |
scikit-learn | 150 | sklearn/pipeline.py | def inverse_transform(self, X=None, *, Xt=None, **params):
"""Apply `inverse_transform` for each step in a reverse order.
All estimators in the pipeline must support `inverse_transform`.
Parameters
----------
X : array-like of shape (n_samples, n_transformed_features)
... | /usr/src/app/target_test_cases/failed_tests_Pipeline.inverse_transform.txt | def inverse_transform(self, X=None, *, Xt=None, **params):
"""Apply `inverse_transform` for each step in a reverse order.
All estimators in the pipeline must support `inverse_transform`.
Parameters
----------
X : array-like of shape (n_samples, n_transformed_features)
... | Pipeline.inverse_transform | repository-level | non_external |
scikit-learn | 151 | sklearn/pipeline.py | def predict(self, X, **params):
"""Transform the data, and apply `predict` with the final estimator.
Call `transform` of each transformer in the pipeline. The transformed
data are finally passed to the final estimator that calls `predict`
method. Only valid if the final estimator im... | /usr/src/app/target_test_cases/failed_tests_Pipeline.predict.txt | def predict(self, X, **params):
"""Transform the data, and apply `predict` with the final estimator.
Call `transform` of each transformer in the pipeline. The transformed
data are finally passed to the final estimator that calls `predict`
method. Only valid if the final estimator im... | Pipeline.predict | repository-level | non_external |
scikit-learn | 152 | sklearn/pipeline.py | def predict_log_proba(self, X, **params):
"""Transform the data, and apply `predict_log_proba` with the final estimator.
Call `transform` of each transformer in the pipeline. The transformed
data are finally passed to the final estimator that calls
`predict_log_proba` method. Only v... | /usr/src/app/target_test_cases/failed_tests_Pipeline.predict_log_proba.txt | def predict_log_proba(self, X, **params):
"""Transform the data, and apply `predict_log_proba` with the final estimator.
Call `transform` of each transformer in the pipeline. The transformed
data are finally passed to the final estimator that calls
`predict_log_proba` method. Only v... | Pipeline.predict_log_proba | repository-level | non_external |
scikit-learn | 153 | sklearn/pipeline.py | def predict_proba(self, X, **params):
"""Transform the data, and apply `predict_proba` with the final estimator.
Call `transform` of each transformer in the pipeline. The transformed
data are finally passed to the final estimator that calls
`predict_proba` method. Only valid if the ... | /usr/src/app/target_test_cases/failed_tests_Pipeline.predict_proba.txt | def predict_proba(self, X, **params):
"""Transform the data, and apply `predict_proba` with the final estimator.
Call `transform` of each transformer in the pipeline. The transformed
data are finally passed to the final estimator that calls
`predict_proba` method. Only valid if the ... | Pipeline.predict_proba | repository-level | non_external |
scikit-learn | 154 | sklearn/pipeline.py | def score(self, X, y=None, sample_weight=None, **params):
"""Transform the data, and apply `score` with the final estimator.
Call `transform` of each transformer in the pipeline. The transformed
data are finally passed to the final estimator that calls
`score` method. Only valid if ... | /usr/src/app/target_test_cases/failed_tests_Pipeline.score.txt | def score(self, X, y=None, sample_weight=None, **params):
"""Transform the data, and apply `score` with the final estimator.
Call `transform` of each transformer in the pipeline. The transformed
data are finally passed to the final estimator that calls
`score` method. Only valid if ... | Pipeline.score | repository-level | non_external |
scikit-learn | 155 | sklearn/kernel_approximation.py | def transform(self, X):
"""Generate the feature map approximation for X.
Parameters
----------
X : {array-like}, shape (n_samples, n_features)
New data, where `n_samples` is the number of samples
and `n_features` is the number of features.
Returns
... | /usr/src/app/target_test_cases/failed_tests_PolynomialCountSketch.transform.txt | def transform(self, X):
"""Generate the feature map approximation for X.
Parameters
----------
X : {array-like}, shape (n_samples, n_features)
New data, where `n_samples` is the number of samples
and `n_features` is the number of features.
Returns
... | PolynomialCountSketch.transform | repository-level | external |
scikit-learn | 156 | sklearn/preprocessing/_polynomial.py | def fit(self, X, y=None):
"""
Compute number of output features.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The data.
y : Ignored
Not used, present here for API consistency by convention.
R... | /usr/src/app/target_test_cases/failed_tests_PolynomialFeatures.fit.txt | def fit(self, X, y=None):
"""
Compute number of output features.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The data.
y : Ignored
Not used, present here for API consistency by convention.
R... | PolynomialFeatures.fit | repository-level | external |
scikit-learn | 157 | sklearn/discriminant_analysis.py | def fit(self, X, y):
"""Fit the model according to the given training data and parameters.
.. versionchanged:: 0.19
``store_covariances`` has been moved to main constructor as
``store_covariance``.
.. versionchanged:: 0.19
``tol`` has been moved to main ... | /usr/src/app/target_test_cases/failed_tests_QuadraticDiscriminantAnalysis.fit.txt | def fit(self, X, y):
"""Fit the model according to the given training data and parameters.
.. versionchanged:: 0.19
``store_covariances`` has been moved to main constructor as
``store_covariance``.
.. versionchanged:: 0.19
``tol`` has been moved to main ... | QuadraticDiscriminantAnalysis.fit | repository-level | external |
scikit-learn | 158 | sklearn/linear_model/_quantile.py | def fit(self, X, y, sample_weight=None):
"""Fit the model according to the given training data.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
Target values.
... | /usr/src/app/target_test_cases/failed_tests_QuantileRegressor.fit.txt | def fit(self, X, y, sample_weight=None):
"""Fit the model according to the given training data.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
Target values.
... | QuantileRegressor.fit | repository-level | external |
scikit-learn | 159 | sklearn/linear_model/_ransac.py | def fit(self, X, y, *, sample_weight=None, **fit_params):
"""Fit estimator using RANSAC algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,) or (n_samples, n_targets... | /usr/src/app/target_test_cases/failed_tests_RANSACRegressor.fit.txt | def fit(self, X, y, *, sample_weight=None, **fit_params):
"""Fit estimator using RANSAC algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,) or (n_samples, n_targets... | RANSACRegressor.fit | repository-level | external |
scikit-learn | 160 | sklearn/linear_model/_ransac.py | def predict(self, X, **params):
"""Predict using the estimated model.
This is a wrapper for `estimator_.predict(X)`.
Parameters
----------
X : {array-like or sparse matrix} of shape (n_samples, n_features)
Input data.
**params : dict
Paramet... | /usr/src/app/target_test_cases/failed_tests_RANSACRegressor.predict.txt | def predict(self, X, **params):
"""Predict using the estimated model.
This is a wrapper for `estimator_.predict(X)`.
Parameters
----------
X : {array-like or sparse matrix} of shape (n_samples, n_features)
Input data.
**params : dict
Paramet... | RANSACRegressor.predict | repository-level | non_external |
scikit-learn | 161 | sklearn/linear_model/_ransac.py | def score(self, X, y, **params):
"""Return the score of the prediction.
This is a wrapper for `estimator_.score(X, y)`.
Parameters
----------
X : (array-like or sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_sa... | /usr/src/app/target_test_cases/failed_tests_RANSACRegressor.score.txt | def score(self, X, y, **params):
"""Return the score of the prediction.
This is a wrapper for `estimator_.score(X, y)`.
Parameters
----------
X : (array-like or sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_sa... | RANSACRegressor.score | repository-level | non_external |
scikit-learn | 162 | sklearn/kernel_approximation.py | def fit(self, X, y=None):
"""Fit the model with X.
Samples random projection according to n_features.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `... | /usr/src/app/target_test_cases/failed_tests_RBFSampler.fit.txt | def fit(self, X, y=None):
"""Fit the model with X.
Samples random projection according to n_features.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `... | RBFSampler.fit | repository-level | external |
scikit-learn | 163 | sklearn/kernel_approximation.py | def transform(self, X):
"""Apply the approximate feature map to X.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
New data, where `n_samples` is the number of samples
and `n_features` is the number of features.
R... | /usr/src/app/target_test_cases/failed_tests_RBFSampler.transform.txt | def transform(self, X):
"""Apply the approximate feature map to X.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
New data, where `n_samples` is the number of samples
and `n_features` is the number of features.
R... | RBFSampler.transform | repository-level | external |
scikit-learn | 164 | sklearn/feature_selection/_rfe.py | def predict(self, X, **predict_params):
"""Reduce X to the selected features and predict using the estimator.
Parameters
----------
X : array of shape [n_samples, n_features]
The input samples.
**predict_params : dict
Parameters to route to the ``pre... | /usr/src/app/target_test_cases/failed_tests_RFE.predict.txt | def predict(self, X, **predict_params):
"""Reduce X to the selected features and predict using the estimator.
Parameters
----------
X : array of shape [n_samples, n_features]
The input samples.
**predict_params : dict
Parameters to route to the ``pre... | RFE.predict | repository-level | non_external |
scikit-learn | 165 | sklearn/feature_selection/_rfe.py | def score(self, X, y, **score_params):
"""Reduce X to the selected features and return the score of the estimator.
Parameters
----------
X : array of shape [n_samples, n_features]
The input samples.
y : array of shape [n_samples]
The target values.
... | /usr/src/app/target_test_cases/failed_tests_RFE.score.txt | def score(self, X, y, **score_params):
"""Reduce X to the selected features and return the score of the estimator.
Parameters
----------
X : array of shape [n_samples, n_features]
The input samples.
y : array of shape [n_samples]
The target values.
... | RFE.score | repository-level | non_external |
scikit-learn | 166 | sklearn/feature_selection/_rfe.py | def fit(self, X, y, *, groups=None, **params):
"""Fit the RFE model and automatically tune the number of selected features.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vector, where `n_samples` is the number of samples ... | /usr/src/app/target_test_cases/failed_tests_RFECV.fit.txt | def fit(self, X, y, *, groups=None, **params):
"""Fit the RFE model and automatically tune the number of selected features.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vector, where `n_samples` is the number of samples ... | RFECV.fit | repository-level | external |
scikit-learn | 167 | sklearn/ensemble/_forest.py | def fit_transform(self, X, y=None, sample_weight=None):
"""
Fit estimator and transform dataset.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Input data used to build forests. Use ``dtype=np.float32`` for
maxi... | /usr/src/app/target_test_cases/failed_tests_RandomTreesEmbedding.fit_transform.txt | def fit_transform(self, X, y=None, sample_weight=None):
"""
Fit estimator and transform dataset.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Input data used to build forests. Use ``dtype=np.float32`` for
maxi... | RandomTreesEmbedding.fit_transform | repository-level | non_external |
scikit-learn | 168 | sklearn/feature_selection/_from_model.py | def fit(self, X, y=None, **fit_params):
"""Fit the SelectFromModel meta-transformer.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The training input samples.
y : array-like of shape (n_samples,), default=None
The target value... | /usr/src/app/target_test_cases/failed_tests_SelectFromModel.fit.txt | def fit(self, X, y=None, **fit_params):
"""Fit the SelectFromModel meta-transformer.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The training input samples.
y : array-like of shape (n_samples,), default=None
The target value... | SelectFromModel.fit | repository-level | external |
scikit-learn | 169 | sklearn/feature_selection/_from_model.py | def partial_fit(self, X, y=None, **partial_fit_params):
"""Fit the SelectFromModel meta-transformer only once.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The training input samples.
y : array-like of shape (n_samples,), default=None
... | /usr/src/app/target_test_cases/failed_tests_SelectFromModel.partial_fit.txt | def partial_fit(self, X, y=None, **partial_fit_params):
"""Fit the SelectFromModel meta-transformer only once.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The training input samples.
y : array-like of shape (n_samples,), default=None
... | SelectFromModel.partial_fit | repository-level | external |
scikit-learn | 170 | sklearn/semi_supervised/_self_training.py | def fit(self, X, y, **params):
"""
Fit self-training classifier using `X`, `y` as training data.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Array representing the data.
y : {array-like, sparse matrix} of shape ... | /usr/src/app/target_test_cases/failed_tests_SelfTrainingClassifier.fit.txt | def fit(self, X, y, **params):
"""
Fit self-training classifier using `X`, `y` as training data.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Array representing the data.
y : {array-like, sparse matrix} of shape ... | SelfTrainingClassifier.fit | repository-level | external |
scikit-learn | 171 | sklearn/semi_supervised/_self_training.py | def predict(self, X, **params):
"""Predict the classes of `X`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Array representing the data.
**params : dict of str -> object
Parameters to pass to the underlying e... | /usr/src/app/target_test_cases/failed_tests_SelfTrainingClassifier.predict.txt | def predict(self, X, **params):
"""Predict the classes of `X`.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Array representing the data.
**params : dict of str -> object
Parameters to pass to the underlying e... | SelfTrainingClassifier.predict | repository-level | non_external |
scikit-learn | 172 | sklearn/semi_supervised/_self_training.py | def predict_proba(self, X, **params):
"""Predict probability for each possible outcome.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Array representing the data.
**params : dict of str -> object
Parameters to... | /usr/src/app/target_test_cases/failed_tests_SelfTrainingClassifier.predict_proba.txt | def predict_proba(self, X, **params):
"""Predict probability for each possible outcome.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Array representing the data.
**params : dict of str -> object
Parameters to... | SelfTrainingClassifier.predict_proba | repository-level | non_external |
scikit-learn | 173 | sklearn/feature_selection/_sequential.py | def fit(self, X, y=None, **params):
"""Learn the features to select from X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number of predictors.
... | /usr/src/app/target_test_cases/failed_tests_SequentialFeatureSelector.fit.txt | def fit(self, X, y=None, **params):
"""Learn the features to select from X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number of predictors.
... | SequentialFeatureSelector.fit | repository-level | external |
scikit-learn | 174 | sklearn/covariance/_shrunk_covariance.py | def fit(self, X, y=None):
"""Fit the shrunk covariance model to X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of features.
y : Ignored... | /usr/src/app/target_test_cases/failed_tests_ShrunkCovariance.fit.txt | def fit(self, X, y=None):
"""Fit the shrunk covariance model to X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of features.
y : Ignored... | ShrunkCovariance.fit | repository-level | external |
scikit-learn | 175 | sklearn/impute/_base.py | def fit(self, X, y=None):
"""Fit the imputer on `X`.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Input data, where `n_samples` is the number of samples and
`n_features` is the number of features.
y : Ignored
... | /usr/src/app/target_test_cases/failed_tests_SimpleImputer.fit.txt | def fit(self, X, y=None):
"""Fit the imputer on `X`.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Input data, where `n_samples` is the number of samples and
`n_features` is the number of features.
y : Ignored
... | SimpleImputer.fit | repository-level | external |
scikit-learn | 176 | sklearn/impute/_base.py | def inverse_transform(self, X):
"""Convert the data back to the original representation.
Inverts the `transform` operation performed on an array.
This operation can only be performed after :class:`SimpleImputer` is
instantiated with `add_indicator=True`.
Note that `inverse_... | /usr/src/app/target_test_cases/failed_tests_SimpleImputer.inverse_transform.txt | def inverse_transform(self, X):
"""Convert the data back to the original representation.
Inverts the `transform` operation performed on an array.
This operation can only be performed after :class:`SimpleImputer` is
instantiated with `add_indicator=True`.
Note that `inverse_... | SimpleImputer.inverse_transform | repository-level | external |
scikit-learn | 177 | sklearn/impute/_base.py | def transform(self, X):
"""Impute all missing values in `X`.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
The input data to complete.
Returns
-------
X_imputed : {ndarray, sparse matrix} of shape \
... | /usr/src/app/target_test_cases/failed_tests_SimpleImputer.transform.txt | def transform(self, X):
"""Impute all missing values in `X`.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
The input data to complete.
Returns
-------
X_imputed : {ndarray, sparse matrix} of shape \
... | SimpleImputer.transform | repository-level | external |
scikit-learn | 178 | sklearn/kernel_approximation.py | def fit(self, X, y=None):
"""Fit the model with X.
Samples random projection according to n_features.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is th... | /usr/src/app/target_test_cases/failed_tests_SkewedChi2Sampler.fit.txt | def fit(self, X, y=None):
"""Fit the model with X.
Samples random projection according to n_features.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is th... | SkewedChi2Sampler.fit | repository-level | external |
scikit-learn | 179 | sklearn/kernel_approximation.py | def transform(self, X):
"""Apply the approximate feature map to X.
Parameters
----------
X : array-like, shape (n_samples, n_features)
New data, where `n_samples` is the number of samples
and `n_features` is the number of features. All values of X must be
... | /usr/src/app/target_test_cases/failed_tests_SkewedChi2Sampler.transform.txt | def transform(self, X):
"""Apply the approximate feature map to X.
Parameters
----------
X : array-like, shape (n_samples, n_features)
New data, where `n_samples` is the number of samples
and `n_features` is the number of features. All values of X must be
... | SkewedChi2Sampler.transform | repository-level | external |
scikit-learn | 180 | sklearn/cluster/_spectral.py | def fit(self, X, y=None):
"""Perform spectral clustering from features, or affinity matrix.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features) or \
(n_samples, n_samples)
Training instances to cluster, similarities / af... | /usr/src/app/target_test_cases/failed_tests_SpectralClustering.fit.txt | def fit(self, X, y=None):
"""Perform spectral clustering from features, or affinity matrix.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features) or \
(n_samples, n_samples)
Training instances to cluster, similarities / af... | SpectralClustering.fit | repository-level | external |
scikit-learn | 181 | sklearn/preprocessing/_polynomial.py | def fit(self, X, y=None, sample_weight=None):
"""Compute knot positions of splines.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data.
y : None
Ignored.
sample_weight : array-like of shape (n_samples,), default =... | /usr/src/app/target_test_cases/failed_tests_SplineTransformer.fit.txt | def fit(self, X, y=None, sample_weight=None):
"""Compute knot positions of splines.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data.
y : None
Ignored.
sample_weight : array-like of shape (n_samples,), default =... | SplineTransformer.fit | repository-level | external |
scikit-learn | 182 | sklearn/preprocessing/_polynomial.py | def transform(self, X):
"""Transform each feature data to B-splines.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data to transform.
Returns
-------
XBS : {ndarray, sparse matrix} of shape (n_samples, n_features * n_s... | /usr/src/app/target_test_cases/failed_tests_SplineTransformer.transform.txt | def transform(self, X):
"""Transform each feature data to B-splines.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data to transform.
Returns
-------
XBS : {ndarray, sparse matrix} of shape (n_samples, n_features * n_s... | SplineTransformer.transform | repository-level | external |
scikit-learn | 183 | sklearn/ensemble/_stacking.py | def fit(self, X, y, *, sample_weight=None, **fit_params):
"""Fit the estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number... | /usr/src/app/target_test_cases/failed_tests_StackingClassifier.fit.txt | def fit(self, X, y, *, sample_weight=None, **fit_params):
"""Fit the estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number... | StackingClassifier.fit | repository-level | external |
scikit-learn | 184 | sklearn/ensemble/_stacking.py | def predict(self, X, **predict_params):
"""Predict target for X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number of features.
... | /usr/src/app/target_test_cases/failed_tests_StackingClassifier.predict.txt | def predict(self, X, **predict_params):
"""Predict target for X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number of features.
... | StackingClassifier.predict | repository-level | external |
scikit-learn | 185 | sklearn/ensemble/_stacking.py | def predict(self, X, **predict_params):
"""Predict target for X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number of features.
... | /usr/src/app/target_test_cases/failed_tests_StackingRegressor.predict.txt | def predict(self, X, **predict_params):
"""Predict target for X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number of features.
... | StackingRegressor.predict | repository-level | non_external |
scikit-learn | 186 | sklearn/preprocessing/_data.py | def inverse_transform(self, X, copy=None):
"""Scale back the data to the original representation.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The data used to scale along the features axis.
copy : bool, default=None
... | /usr/src/app/target_test_cases/failed_tests_StandardScaler.inverse_transform.txt | def inverse_transform(self, X, copy=None):
"""Scale back the data to the original representation.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The data used to scale along the features axis.
copy : bool, default=None
... | StandardScaler.inverse_transform | repository-level | external |
scikit-learn | 187 | sklearn/model_selection/_split.py | def split(self, X, y, groups=None):
"""Generate indices to split data into training and test set.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of... | /usr/src/app/target_test_cases/failed_tests_StratifiedKFold.split.txt | def split(self, X, y, groups=None):
"""Generate indices to split data into training and test set.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of... | StratifiedKFold.split | repository-level | external |
scikit-learn | 188 | sklearn/model_selection/_split.py | def split(self, X, y, groups=None):
"""Generate indices to split data into training and test set.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of... | /usr/src/app/target_test_cases/failed_tests_StratifiedShuffleSplit.split.txt | def split(self, X, y, groups=None):
"""Generate indices to split data into training and test set.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples
and `n_features` is the number of... | StratifiedShuffleSplit.split | repository-level | external |
scikit-learn | 189 | sklearn/manifold/_t_sne.py | def fit_transform(self, X, y=None):
"""Fit X into an embedded space and return that transformed output.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features) or \
(n_samples, n_samples)
If the metric is 'precomputed' X must be... | /usr/src/app/target_test_cases/failed_tests_TSNE.fit_transform.txt | def fit_transform(self, X, y=None):
"""Fit X into an embedded space and return that transformed output.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features) or \
(n_samples, n_samples)
If the metric is 'precomputed' X must be... | TSNE.fit_transform | repository-level | external |
scikit-learn | 190 | sklearn/compose/_target.py | def fit(self, X, y, **fit_params):
"""Fit the model according to the given training data.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vector, where `n_samples` is the number of samples and
`n_features` is th... | /usr/src/app/target_test_cases/failed_tests_TransformedTargetRegressor.fit.txt | def fit(self, X, y, **fit_params):
"""Fit the model according to the given training data.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vector, where `n_samples` is the number of samples and
`n_features` is th... | TransformedTargetRegressor.fit | repository-level | non_external |
scikit-learn | 191 | sklearn/compose/_target.py | def predict(self, X, **predict_params):
"""Predict using the base regressor, applying inverse.
The regressor is used to predict and the `inverse_func` or
`inverse_transform` is applied before returning the prediction.
Parameters
----------
X : {array-like, sparse ma... | /usr/src/app/target_test_cases/failed_tests_TransformedTargetRegressor.predict.txt | def predict(self, X, **predict_params):
"""Predict using the base regressor, applying inverse.
The regressor is used to predict and the `inverse_func` or
`inverse_transform` is applied before returning the prediction.
Parameters
----------
X : {array-like, sparse ma... | TransformedTargetRegressor.predict | repository-level | non_external |
scikit-learn | 192 | sklearn/ensemble/_hist_gradient_boosting/grower.py | def make_predictor(self, binning_thresholds):
"""Make a TreePredictor object out of the current tree.
Parameters
----------
binning_thresholds : array-like of floats
Corresponds to the bin_thresholds_ attribute of the BinMapper.
For each feature, this stores:... | /usr/src/app/target_test_cases/failed_tests_TreeGrower.make_predictor.txt | def make_predictor(self, binning_thresholds):
"""Make a TreePredictor object out of the current tree.
Parameters
----------
binning_thresholds : array-like of floats
Corresponds to the bin_thresholds_ attribute of the BinMapper.
For each feature, this stores:... | TreeGrower.make_predictor | repository-level | external |
scikit-learn | 193 | sklearn/ensemble/_hist_gradient_boosting/predictor.py | def predict(self, X, known_cat_bitsets, f_idx_map, n_threads):
"""Predict raw values for non-binned data.
Parameters
----------
X : ndarray, shape (n_samples, n_features)
The input samples.
known_cat_bitsets : ndarray of shape (n_categorical_features, 8)
... | /usr/src/app/target_test_cases/failed_tests_TreePredictor.predict.txt | def predict(self, X, known_cat_bitsets, f_idx_map, n_threads):
"""Predict raw values for non-binned data.
Parameters
----------
X : ndarray, shape (n_samples, n_features)
The input samples.
known_cat_bitsets : ndarray of shape (n_categorical_features, 8)
... | TreePredictor.predict | file-level | external |
scikit-learn | 194 | sklearn/ensemble/_hist_gradient_boosting/predictor.py | def predict_binned(self, X, missing_values_bin_idx, n_threads):
"""Predict raw values for binned data.
Parameters
----------
X : ndarray, shape (n_samples, n_features)
The input samples.
missing_values_bin_idx : uint8
Index of the bin that is used for... | /usr/src/app/target_test_cases/failed_tests_TreePredictor.predict_binned.txt | def predict_binned(self, X, missing_values_bin_idx, n_threads):
"""Predict raw values for binned data.
Parameters
----------
X : ndarray, shape (n_samples, n_features)
The input samples.
missing_values_bin_idx : uint8
Index of the bin that is used for... | TreePredictor.predict_binned | file-level | external |
scikit-learn | 195 | sklearn/decomposition/_truncated_svd.py | def fit_transform(self, X, y=None):
"""Fit model to X and perform dimensionality reduction on X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : Ignored
Not used, present here for API consiste... | /usr/src/app/target_test_cases/failed_tests_TruncatedSVD.fit_transform.txt | def fit_transform(self, X, y=None):
"""Fit model to X and perform dimensionality reduction on X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : Ignored
Not used, present here for API consiste... | TruncatedSVD.fit_transform | repository-level | external |
scikit-learn | 196 | sklearn/ensemble/_voting.py | def fit(self, X, y, *, sample_weight=None, **fit_params):
"""Fit the estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number... | /usr/src/app/target_test_cases/failed_tests_VotingClassifier.fit.txt | def fit(self, X, y, *, sample_weight=None, **fit_params):
"""Fit the estimators.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number... | VotingClassifier.fit | repository-level | non_external |
scikit-learn | 197 | sklearn/ensemble/_voting.py | def get_feature_names_out(self, input_features=None):
"""Get output feature names for transformation.
Parameters
----------
input_features : array-like of str or None, default=None
Not used, present here for API consistency by convention.
Returns
-------... | /usr/src/app/target_test_cases/failed_tests_VotingClassifier.get_feature_names_out.txt | def get_feature_names_out(self, input_features=None):
"""Get output feature names for transformation.
Parameters
----------
input_features : array-like of str or None, default=None
Not used, present here for API consistency by convention.
Returns
-------... | VotingClassifier.get_feature_names_out | repository-level | external |
scikit-learn | 198 | sklearn/ensemble/_voting.py | def predict(self, X):
"""Predict class labels for X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The input samples.
Returns
-------
maj : array-like of shape (n_samples,)
Predicted class labe... | /usr/src/app/target_test_cases/failed_tests_VotingClassifier.predict.txt | def predict(self, X):
"""Predict class labels for X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
The input samples.
Returns
-------
maj : array-like of shape (n_samples,)
Predicted class labe... | VotingClassifier.predict | repository-level | external |
scikit-learn | 199 | sklearn/ensemble/_voting.py | def transform(self, X):
"""Return class labels or probabilities for X for each estimator.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is t... | /usr/src/app/target_test_cases/failed_tests_VotingClassifier.transform.txt | def transform(self, X):
"""Return class labels or probabilities for X for each estimator.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is t... | VotingClassifier.transform | repository-level | external |
scikit-learn | 200 | sklearn/ensemble/_voting.py | def get_feature_names_out(self, input_features=None):
"""Get output feature names for transformation.
Parameters
----------
input_features : array-like of str or None, default=None
Not used, present here for API consistency by convention.
Returns
-------... | /usr/src/app/target_test_cases/failed_tests_VotingRegressor.get_feature_names_out.txt | def get_feature_names_out(self, input_features=None):
"""Get output feature names for transformation.
Parameters
----------
input_features : array-like of str or None, default=None
Not used, present here for API consistency by convention.
Returns
-------... | VotingRegressor.get_feature_names_out | repository-level | external |
scikit-learn | 201 | sklearn/ensemble/_hist_gradient_boosting/binning.py | def fit(self, X, y=None):
"""Fit data X by computing the binning thresholds.
The last bin is reserved for missing values, whether missing values
are present in the data or not.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The dat... | /usr/src/app/target_test_cases/failed_tests__BinMapper.fit.txt | def fit(self, X, y=None):
"""Fit data X by computing the binning thresholds.
The last bin is reserved for missing values, whether missing values
are present in the data or not.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The dat... | _BinMapper.fit | repository-level | external |
scikit-learn | 202 | sklearn/ensemble/_hist_gradient_boosting/binning.py | def transform(self, X):
"""Bin data X.
Missing values will be mapped to the last bin.
For categorical features, the mapping will be incorrect for unknown
categories. Since the BinMapper is given known_categories of the
entire training data (i.e. before the call to train_tes... | /usr/src/app/target_test_cases/failed_tests__BinMapper.transform.txt | def transform(self, X):
"""Bin data X.
Missing values will be mapped to the last bin.
For categorical features, the mapping will be incorrect for unknown
categories. Since the BinMapper is given known_categories of the
entire training data (i.e. before the call to train_tes... | _BinMapper.transform | repository-level | external |
scikit-learn | 203 | sklearn/calibration.py | def predict_proba(self, X):
"""Calculate calibrated probabilities.
Calculates classification calibrated probabilities
for each class, in a one-vs-all manner, for `X`.
Parameters
----------
X : ndarray of shape (n_samples, n_features)
The sample data.
... | /usr/src/app/target_test_cases/failed_tests__CalibratedClassifier.predict_proba.txt | def predict_proba(self, X):
"""Calculate calibrated probabilities.
Calculates classification calibrated probabilities
for each class, in a one-vs-all manner, for `X`.
Parameters
----------
X : ndarray of shape (n_samples, n_features)
The sample data.
... | _CalibratedClassifier.predict_proba | repository-level | external |
scikit-learn | 204 | sklearn/linear_model/_glm/glm.py | def fit(self, X, y, sample_weight=None):
"""Fit a Generalized Linear Model.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
Target values.
sample_weig... | /usr/src/app/target_test_cases/failed_tests__GeneralizedLinearRegressor.fit.txt | def fit(self, X, y, sample_weight=None):
"""Fit a Generalized Linear Model.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
Target values.
sample_weig... | _GeneralizedLinearRegressor.fit | repository-level | external |
scikit-learn | 205 | sklearn/utils/_estimator_html_repr.py | def _get_doc_link(self):
"""Generates a link to the API documentation for a given estimator.
This method generates the link to the estimator's documentation page
by using the template defined by the attribute `_doc_link_template`.
Returns
-------
url : str
... | /usr/src/app/target_test_cases/failed_tests__HTMLDocumentationLinkMixin._get_doc_link.txt | def _get_doc_link(self):
"""Generates a link to the API documentation for a given estimator.
This method generates the link to the estimator's documentation page
by using the template defined by the attribute `_doc_link_template`.
Returns
-------
url : str
... | _HTMLDocumentationLinkMixin._get_doc_link | file-level | non_external |
scikit-learn | 206 | sklearn/linear_model/_ridge.py | def _compute_covariance(self, X, sqrt_sw):
"""Computes covariance matrix X^TX with possible centering.
Parameters
----------
X : sparse matrix of shape (n_samples, n_features)
The preprocessed design matrix.
sqrt_sw : ndarray of shape (n_samples,)
sq... | /usr/src/app/target_test_cases/failed_tests__RidgeGCV._compute_covariance.txt | def _compute_covariance(self, X, sqrt_sw):
"""Computes covariance matrix X^TX with possible centering.
Parameters
----------
X : sparse matrix of shape (n_samples, n_features)
The preprocessed design matrix.
sqrt_sw : ndarray of shape (n_samples,)
sq... | _RidgeGCV._compute_covariance | repository-level | external |
scikit-learn | 207 | sklearn/linear_model/_ridge.py | def _compute_gram(self, X, sqrt_sw):
"""Computes the Gram matrix XX^T with possible centering.
Parameters
----------
X : {ndarray, sparse matrix} of shape (n_samples, n_features)
The preprocessed design matrix.
sqrt_sw : ndarray of shape (n_samples,)
... | /usr/src/app/target_test_cases/failed_tests__RidgeGCV._compute_gram.txt | def _compute_gram(self, X, sqrt_sw):
"""Computes the Gram matrix XX^T with possible centering.
Parameters
----------
X : {ndarray, sparse matrix} of shape (n_samples, n_features)
The preprocessed design matrix.
sqrt_sw : ndarray of shape (n_samples,)
... | _RidgeGCV._compute_gram | repository-level | external |
scikit-learn | 208 | sklearn/utils/validation.py | def _allclose_dense_sparse(x, y, rtol=1e-7, atol=1e-9):
"""Check allclose for sparse and dense data.
Both x and y need to be either sparse or dense, they
can't be mixed.
Parameters
----------
x : {array-like, sparse matrix}
First array to compare.
y : {array-like, sparse matrix}
... | /usr/src/app/target_test_cases/failed_tests__allclose_dense_sparse.txt | def _allclose_dense_sparse(x, y, rtol=1e-7, atol=1e-9):
"""Check allclose for sparse and dense data.
Both x and y need to be either sparse or dense, they
can't be mixed.
Parameters
----------
x : {array-like, sparse matrix}
First array to compare.
y : {array-like, sparse matrix}
... | _allclose_dense_sparse | self-contained | external |
scikit-learn | 209 | sklearn/decomposition/_pca.py | def _assess_dimension(spectrum, rank, n_samples):
"""Compute the log-likelihood of a rank ``rank`` dataset.
The dataset is assumed to be embedded in gaussian noise of shape(n,
dimf) having spectrum ``spectrum``. This implements the method of
T. P. Minka.
Parameters
----------
spectrum : nd... | /usr/src/app/target_test_cases/failed_tests__assess_dimension.txt | def _assess_dimension(spectrum, rank, n_samples):
"""Compute the log-likelihood of a rank ``rank`` dataset.
The dataset is assumed to be embedded in gaussian noise of shape(n,
dimf) having spectrum ``spectrum``. This implements the method of
T. P. Minka.
Parameters
----------
spectrum : nd... | _assess_dimension | repository-level | external |
scikit-learn | 210 | sklearn/metrics/_base.py | def _average_binary_score(binary_metric, y_true, y_score, average, sample_weight=None):
"""Average a binary metric for multilabel classification.
Parameters
----------
y_true : array, shape = [n_samples] or [n_samples, n_classes]
True binary labels in binary label indicators.
y_score : arr... | /usr/src/app/target_test_cases/failed_tests__average_binary_score.txt | def _average_binary_score(binary_metric, y_true, y_score, average, sample_weight=None):
"""Average a binary metric for multilabel classification.
Parameters
----------
y_true : array, shape = [n_samples] or [n_samples, n_classes]
True binary labels in binary label indicators.
y_score : arr... | _average_binary_score | repository-level | external |
scikit-learn | 211 | sklearn/ensemble/_iforest.py | def _average_path_length(n_samples_leaf):
"""
The average path length in a n_samples iTree, which is equal to
the average path length of an unsuccessful BST search since the
latter has the same structure as an isolation tree.
Parameters
----------
n_samples_leaf : array-like of shape (n_samp... | /usr/src/app/target_test_cases/failed_tests__average_path_length.txt | def _average_path_length(n_samples_leaf):
"""
The average path length in a n_samples iTree, which is equal to
the average path length of an unsuccessful BST search since the
latter has the same structure as an isolation tree.
Parameters
----------
n_samples_leaf : array-like of shape (n_samp... | _average_path_length | repository-level | external |
scikit-learn | 212 | sklearn/inspection/_plot/decision_boundary.py | def _check_boundary_response_method(estimator, response_method, class_of_interest):
"""Validate the response methods to be used with the fitted estimator.
Parameters
----------
estimator : object
Fitted estimator to check.
response_method : {'auto', 'predict_proba', 'decision_function', 'p... | /usr/src/app/target_test_cases/failed_tests__check_boundary_response_method.txt | def _check_boundary_response_method(estimator, response_method, class_of_interest):
"""Validate the response methods to be used with the fitted estimator.
Parameters
----------
estimator : object
Fitted estimator to check.
response_method : {'auto', 'predict_proba', 'decision_function', 'p... | _check_boundary_response_method | repository-level | non_external |
scikit-learn | 213 | sklearn/inspection/_pd_utils.py | def _check_feature_names(X, feature_names=None):
"""Check feature names.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Input data.
feature_names : None or array-like of shape (n_names,), dtype=str
Feature names to check or `None`.
Returns
-------
... | /usr/src/app/target_test_cases/failed_tests__check_feature_names.txt | def _check_feature_names(X, feature_names=None):
"""Check feature names.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Input data.
feature_names : None or array-like of shape (n_names,), dtype=str
Feature names to check or `None`.
Returns
-------
... | _check_feature_names | self-contained | non_external |
scikit-learn | 214 | sklearn/model_selection/_validation.py | def _check_is_permutation(indices, n_samples):
"""Check whether indices is a reordering of the array np.arange(n_samples)
Parameters
----------
indices : ndarray
int array to test
n_samples : int
number of expected elements
Returns
-------
is_partition : bool
Tr... | /usr/src/app/target_test_cases/failed_tests__check_is_permutation.txt | def _check_is_permutation(indices, n_samples):
"""Check whether indices is a reordering of the array np.arange(n_samples)
Parameters
----------
indices : ndarray
int array to test
n_samples : int
number of expected elements
Returns
-------
is_partition : bool
Tr... | _check_is_permutation | self-contained | external |
scikit-learn | 215 | sklearn/utils/validation.py | def _check_method_params(X, params, indices=None):
"""Check and validate the parameters passed to a specific
method like `fit`.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Data array.
params : dict
Dictionary containing the parameters passed to the met... | /usr/src/app/target_test_cases/failed_tests__check_method_params.txt | def _check_method_params(X, params, indices=None):
"""Check and validate the parameters passed to a specific
method like `fit`.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Data array.
params : dict
Dictionary containing the parameters passed to the met... | _check_method_params | repository-level | external |
scikit-learn | 216 | sklearn/metrics/_scorer.py | def _check_multimetric_scoring(estimator, scoring):
"""Check the scoring parameter in cases when multiple metrics are allowed.
In addition, multimetric scoring leverages a caching mechanism to not call the same
estimator response method multiple times. Hence, the scorer is modified to only use
a single... | /usr/src/app/target_test_cases/failed_tests__check_multimetric_scoring.txt | def _check_multimetric_scoring(estimator, scoring):
"""Check the scoring parameter in cases when multiple metrics are allowed.
In addition, multimetric scoring leverages a caching mechanism to not call the same
estimator response method multiple times. Hence, the scorer is modified to only use
a single... | _check_multimetric_scoring | file-level | non_external |
scikit-learn | 217 | sklearn/neighbors/_base.py | def _check_precomputed(X):
"""Check precomputed distance matrix.
If the precomputed distance matrix is sparse, it checks that the non-zero
entries are sorted by distances. If not, the matrix is copied and sorted.
Parameters
----------
X : {sparse matrix, array-like}, (n_samples, n_samples)
... | /usr/src/app/target_test_cases/failed_tests__check_precomputed.txt | def _check_precomputed(X):
"""Check precomputed distance matrix.
If the precomputed distance matrix is sparse, it checks that the non-zero
entries are sorted by distances. If not, the matrix is copied and sorted.
Parameters
----------
X : {sparse matrix, array-like}, (n_samples, n_samples)
... | _check_precomputed | repository-level | external |
scikit-learn | 218 | sklearn/utils/validation.py | def _check_psd_eigenvalues(lambdas, enable_warnings=False):
"""Check the eigenvalues of a positive semidefinite (PSD) matrix.
Checks the provided array of PSD matrix eigenvalues for numerical or
conditioning issues and returns a fixed validated version. This method
should typically be used if the PSD m... | /usr/src/app/target_test_cases/failed_tests__check_psd_eigenvalues.txt | def _check_psd_eigenvalues(lambdas, enable_warnings=False):
"""Check the eigenvalues of a positive semidefinite (PSD) matrix.
Checks the provided array of PSD matrix eigenvalues for numerical or
conditioning issues and returns a fixed validated version. This method
should typically be used if the PSD m... | _check_psd_eigenvalues | repository-level | external |
scikit-learn | 219 | sklearn/utils/validation.py | def _check_response_method(estimator, response_method):
"""Check if `response_method` is available in estimator and return it.
.. versionadded:: 1.3
Parameters
----------
estimator : estimator instance
Classifier or regressor to check.
response_method : {"predict_proba", "predict_log_... | /usr/src/app/target_test_cases/failed_tests__check_response_method.txt | def _check_response_method(estimator, response_method):
"""Check if `response_method` is available in estimator and return it.
.. versionadded:: 1.3
Parameters
----------
estimator : estimator instance
Classifier or regressor to check.
response_method : {"predict_proba", "predict_log_... | _check_response_method | file-level | external |
scikit-learn | 220 | sklearn/utils/validation.py | def _check_sample_weight(
sample_weight, X, dtype=None, copy=False, ensure_non_negative=False
):
"""Validate sample weights.
Note that passing sample_weight=None will output an array of ones.
Therefore, in some cases, you may want to protect the call with:
if sample_weight is not None:
samp... | /usr/src/app/target_test_cases/failed_tests__check_sample_weight.txt | def _check_sample_weight(
sample_weight, X, dtype=None, copy=False, ensure_non_negative=False
):
"""Validate sample weights.
Note that passing sample_weight=None will output an array of ones.
Therefore, in some cases, you may want to protect the call with:
if sample_weight is not None:
samp... | _check_sample_weight | file-level | external |
scikit-learn | 221 | sklearn/metrics/_classification.py | def _check_targets(y_true, y_pred):
"""Check that y_true and y_pred belong to the same classification task.
This converts multiclass or binary types to a common shape, and raises a
ValueError for a mix of multilabel and multiclass targets, a mix of
multilabel formats, for the presence of continuous-val... | /usr/src/app/target_test_cases/failed_tests__check_targets.txt | def _check_targets(y_true, y_pred):
"""Check that y_true and y_pred belong to the same classification task.
This converts multiclass or binary types to a common shape, and raises a
ValueError for a mix of multilabel and multiclass targets, a mix of
multilabel formats, for the presence of continuous-val... | _check_targets | repository-level | external |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.