neulab/docprompting-conala huggingface dataset:
sklearn.model_selection.RepeatedStratifiedKFold  
class sklearn.model_selection.RepeatedStratifiedKFold(*, n_splits=5, n_repeats=10, random_state=None) [source]
 
Repeated Stratified K-Fold cross validator. Repeats Stratified K-Fold n times with different randomization in each repetition. Read more in the User Guide.  Parameters 
 
n_splitsint, default=5 

Number of folds. Must be at least 2.  
n_repeatsint, default=10 

Number of times cross-validator needs to be repeated.  
random_stateint, RandomState instance or None, default=None 

Controls the generation of the random states for each repetition. Pass an int for reproducible output across multiple function calls. See Glossary.      See also  
RepeatedKFold


Repeats K-Fold n times.    Notes Randomized CV splitters may return different results for each call of split. You can make the results identical by setting random_state to an integer. Examples >>> import numpy as np
>>> from sklearn.model_selection import RepeatedStratifiedKFold
>>> X = np.array([[1, 2], [3, 4], [1, 2], [3, 4]])
>>> y = np.array([0, 0, 1, 1])
>>> rskf = RepeatedStratifiedKFold(n_splits=2, n_repeats=2,
...     random_state=36851234)
>>> for train_index, test_index in rskf.split(X, y):
...     print("TRAIN:", train_index, "TEST:", test_index)
...     X_train, X_test = X[train_index], X[test_index]
...     y_train, y_test = y[train_index], y[test_index]
...
TRAIN: [1 2] TEST: [0 3]
TRAIN: [0 3] TEST: [1 2]
TRAIN: [1 3] TEST: [0 2]
TRAIN: [0 2] TEST: [1 3]
 Methods  
get_n_splits([X, y, groups]) Returns the number of splitting iterations in the cross-validator  
split(X[, y, groups]) Generates indices to split data into training and test set.    
get_n_splits(X=None, y=None, groups=None) [source]
 
Returns the number of splitting iterations in the cross-validator  Parameters 
 
Xobject 

Always ignored, exists for compatibility. np.zeros(n_samples) may be used as a placeholder.  
yobject 

Always ignored, exists for compatibility. np.zeros(n_samples) may be used as a placeholder.  
groupsarray-like of shape (n_samples,), default=None 

Group labels for the samples used while splitting the dataset into train/test set.    Returns 
 
n_splitsint 

Returns the number of splitting iterations in the cross-validator.     
  
split(X, y=None, groups=None) [source]
 
Generates indices to split data into training and test set.  Parameters 
 
Xarray-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.  
yarray-like of shape (n_samples,) 

The target variable for supervised learning problems.  
groupsarray-like of shape (n_samples,), default=None 

Group labels for the samples used while splitting the dataset into train/test set.    Yields 
 
trainndarray 

The training set indices for that split.  
testndarray 

The testing set indices for that split.     
 
 Examples using sklearn.model_selection.RepeatedStratifiedKFold
 
  Statistical comparison of models using grid search
split(X, y=None, groups=None) [source]
 
Generate indices to split data into training and test set.  Parameters 
 
Xarray-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.  
yarray-like of shape (n_samples,) 

The target variable for supervised learning problems.  
groupsarray-like of shape (n_samples,), default=None 

Group labels for the samples used while splitting the dataset into train/test set.    Yields 
 
trainndarray 

The training set indices for that split.  
testndarray 

The testing set indices for that split.     Notes Randomized CV splitters may return different results for each call of split. You can make the results identical by setting random_state to an integer.
split(X, y, groups=None) [source]
 
Generate indices to split data into training and test set.  Parameters 
 
Xarray-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. Note that providing y is sufficient to generate the splits and hence np.zeros(n_samples) may be used as a placeholder for X instead of actual training data.  
yarray-like of shape (n_samples,) 

The target variable for supervised learning problems. Stratification is done based on the y labels.  
groupsobject 

Always ignored, exists for compatibility.    Yields 
 
trainndarray 

The training set indices for that split.  
testndarray 

The testing set indices for that split.     Notes Randomized CV splitters may return different results for each call of split. You can make the results identical by setting random_state to an integer.
split(X, y, groups=None) [source]
 
Generate indices to split data into training and test set.  Parameters 
 
Xarray-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. Note that providing y is sufficient to generate the splits and hence np.zeros(n_samples) may be used as a placeholder for X instead of actual training data.  
yarray-like of shape (n_samples,) or (n_samples, n_labels) 

The target variable for supervised learning problems. Stratification is done based on the y labels.  
groupsobject 

Always ignored, exists for compatibility.    Yields 
 
trainndarray 

The training set indices for that split.  
testndarray 

The testing set indices for that split.     Notes Randomized CV splitters may return different results for each call of split. You can make the results identical by setting random_state to an integer.
split(X, y=None, groups=None) [source]
 
Generate indices to split data into training and test set.  Parameters 
 
Xarray-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.  
yarray-like of shape (n_samples,) 

Always ignored, exists for compatibility.  
groupsarray-like of shape (n_samples,) 

Always ignored, exists for compatibility.    Yields 
 
trainndarray 

The training set indices for that split.  
testndarray 

The testing set indices for that split.
sklearn.model_selection.train_test_split(*arrays, test_size=None, train_size=None, random_state=None, shuffle=True, stratify=None) [source]
 
Split arrays or matrices into random train and test subsets Quick utility that wraps input validation and next(ShuffleSplit().split(X, y)) and application to input data into a single call for splitting (and optionally subsampling) data in a oneliner. Read more in the User Guide.  Parameters 
 
*arrayssequence of indexables with same length / shape[0] 

Allowed inputs are lists, numpy arrays, scipy-sparse matrices or pandas dataframes.  
test_sizefloat or int, default=None 

If float, should be between 0.0 and 1.0 and represent the proportion of the dataset to include in the test split. If int, represents the absolute number of test samples. If None, the value is set to the complement of the train size. If train_size is also None, it will be set to 0.25.  
train_sizefloat or int, default=None 

If float, should be between 0.0 and 1.0 and represent the proportion of the dataset to include in the train split. If int, represents the absolute number of train samples. If None, the value is automatically set to the complement of the test size.  
random_stateint, RandomState instance or None, default=None 

Controls the shuffling applied to the data before applying the split. Pass an int for reproducible output across multiple function calls. See Glossary.  
shufflebool, default=True 

Whether or not to shuffle the data before splitting. If shuffle=False then stratify must be None.  
stratifyarray-like, default=None 

If not None, data is split in a stratified fashion, using this as the class labels. Read more in the User Guide.    Returns 
 
splittinglist, length=2 * len(arrays) 

List containing train-test split of inputs.  New in version 0.16: If the input is sparse, the output will be a scipy.sparse.csr_matrix. Else, output type is the same as the input type.      Examples >>> import numpy as np
>>> from sklearn.model_selection import train_test_split
>>> X, y = np.arange(10).reshape((5, 2)), range(5)
>>> X
array([[0, 1],
       [2, 3],
       [4, 5],
       [6, 7],
       [8, 9]])
>>> list(y)
[0, 1, 2, 3, 4]
 >>> X_train, X_test, y_train, y_test = train_test_split(
...     X, y, test_size=0.33, random_state=42)
...
>>> X_train
array([[4, 5],
       [0, 1],
       [6, 7]])
>>> y_train
[2, 0, 3]
>>> X_test
array([[2, 3],
       [8, 9]])
>>> y_test
[1, 4]
 >>> train_test_split(y, shuffle=False)
[[0, 1, 2], [3, 4]]
decision_function(X) [source]
 
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 votes for all the classes are equal leading to a tie.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 
  Returns 
 
Yarray-like of shape (n_samples, n_classes) or (n_samples,) for binary classification. 

 Changed in version 0.19: output shape changed to (n_samples,) to conform to scikit-learn conventions for binary classification.
fit(X, y) [source]
 
Fit underlying estimators.  Parameters 
 
X(sparse) array-like of shape (n_samples, n_features) 

Data.  
yarray-like of shape (n_samples,) 

Multi-class targets.    Returns 
 self
partial_fit(X, y, classes=None) [source]
 
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.  Parameters 
 
X(sparse) array-like of shape (n_samples, n_features) 

Data.  
yarray-like of shape (n_samples,) 

Multi-class targets.  
classesarray, shape (n_classes, ) 

Classes across all calls to partial_fit. Can be obtained via np.unique(y_all), where y_all is the target vector of the entire dataset. This argument is only required in the first call of partial_fit and can be omitted in the subsequent calls.    Returns 
 self
predict(X) [source]
 
Estimate the best class label for each sample in X. This is implemented as argmax(decision_function(X), axis=1) which will return the label of the class with most votes by estimators predicting the outcome of a decision for each possible class pair.  Parameters 
 
X(sparse) array-like of shape (n_samples, n_features) 

Data.    Returns 
 
ynumpy array of shape [n_samples] 

Predicted multi-class targets.
decision_function(X) [source]
 
Returns the distance of each sample from the decision boundary for each class. This can only be used with estimators which implement the decision_function method.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 
  Returns 
 
Tarray-like of shape (n_samples, n_classes) or (n_samples,) for binary classification. 

 Changed in version 0.19: output shape changed to (n_samples,) to conform to scikit-learn conventions for binary classification.
fit(X, y) [source]
 
Fit underlying estimators.  Parameters 
 
X(sparse) array-like of shape (n_samples, n_features) 

Data.  
y(sparse) array-like of shape (n_samples,) or (n_samples, n_classes) 

Multi-class targets. An indicator matrix turns on multilabel classification.    Returns 
 self
partial_fit(X, y, classes=None) [source]
 
Partially fit underlying estimators Should be used when memory is inefficient to train all data. Chunks of data can be passed in several iteration.  Parameters 
 
X(sparse) array-like of shape (n_samples, n_features) 

Data.  
y(sparse) array-like of shape (n_samples,) or (n_samples, n_classes) 

Multi-class targets. An indicator matrix turns on multilabel classification.  
classesarray, shape (n_classes, ) 

Classes across all calls to partial_fit. Can be obtained via np.unique(y_all), where y_all is the target vector of the entire dataset. This argument is only required in the first call of partial_fit and can be omitted in the subsequent calls.    Returns 
 self
predict(X) [source]
 
Predict multi-class targets using underlying estimators.  Parameters 
 
X(sparse) array-like of shape (n_samples, n_features) 

Data.    Returns 
 
y(sparse) array-like of shape (n_samples,) or (n_samples, n_classes) 

Predicted multi-class targets.
predict_proba(X) [source]
 
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 label in question. For example, it is entirely consistent that two labels both have a 90% probability of applying to a given sample. In the single label multiclass case, the rows of the returned matrix sum to 1.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 
  Returns 
 
T(sparse) array-like of shape (n_samples, n_classes) 

Returns the probability of the sample for each class in the model, where classes are ordered as they are in self.classes_.
fit(X, y) [source]
 
Fit underlying estimators.  Parameters 
 
X(sparse) array-like of shape (n_samples, n_features) 

Data.  
ynumpy array of shape [n_samples] 

Multi-class targets.    Returns 
 self
predict(X) [source]
 
Predict multi-class targets using underlying estimators.  Parameters 
 
X(sparse) array-like of shape (n_samples, n_features) 

Data.    Returns 
 
ynumpy array of shape [n_samples] 

Predicted multi-class targets.
decision_function(X) [source]
 
Evaluate the decision_function of the models in the chain.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 
  Returns 
 
Y_decisionarray-like of shape (n_samples, n_classes) 

Returns the decision function of the sample for each model in the chain.
fit(X, Y) [source]
 
Fit the model to data matrix X and targets Y.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The input data.  
Yarray-like of shape (n_samples, n_classes) 

The target values.    Returns 
 
selfobject
predict(X) [source]
 
Predict on the data matrix X using the ClassifierChain model.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The input data.    Returns 
 
Y_predarray-like of shape (n_samples, n_classes) 

The predicted values.
predict_proba(X) [source]
 
Predict probability estimates.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 
  Returns 
 
Y_probarray-like of shape (n_samples, n_classes)
fit(X, Y, sample_weight=None, **fit_params) [source]
 
Fit the model to data matrix X and targets Y.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The input data.  
Yarray-like of shape (n_samples, n_classes) 

The target values.  
sample_weightarray-like of shape (n_samples,), default=None 

Sample weights. If None, then samples are equally weighted. Only supported if the underlying classifier supports sample weights.  
**fit_paramsdict of string -> object 

Parameters passed to the estimator.fit method of each step.  New in version 0.23.     Returns 
 
selfobject
partial_fit(X, y, classes=None, sample_weight=None) [source]
 
Incrementally fit the model to data. Fit a separate model for each output variable.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Data.  
y{array-like, sparse matrix} of shape (n_samples, n_outputs) 

Multi-output targets.  
classeslist of ndarray of shape (n_outputs,) 

Each array is unique classes for one output in str/int Can be obtained by via [np.unique(y[:, i]) for i in range(y.shape[1])], where y is the target matrix of the entire dataset. This argument is required for the first call to partial_fit and can be omitted in the subsequent calls. Note that y doesn’t need to contain all labels in classes.  
sample_weightarray-like of shape (n_samples,), default=None 

Sample weights. If None, then samples are equally weighted. Only supported if the underlying regressor supports sample weights.    Returns 
 
selfobject
predict(X) [source]
 
 Predict multi-output variable using a model

trained for each target variable.    Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Data.    Returns 
 
y{array-like, sparse matrix} of shape (n_samples, n_outputs) 

Multi-output targets predicted across multiple predictors. Note: Separate models are generated for each predictor.
property predict_proba  
Probability estimates. Returns prediction probabilities for each class of each output. This method will raise a ValueError if any of the estimators do not have predict_proba.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Data    Returns 
 
parray of shape (n_samples, n_classes), or a list of n_outputs such arrays if n_outputs > 1. 

The class probabilities of the input samples. The order of the classes corresponds to that in the attribute classes_.  Changed in version 0.19: This function now returns a list of arrays where the length of the list is n_outputs, and each array is (n_samples, n_classes) for that particular output.
score(X, y) [source]
 
Returns the mean accuracy on the given test data and labels.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Test samples  
yarray-like of shape (n_samples, n_outputs) 

True values for X    Returns 
 
scoresfloat 

accuracy_score of self.predict(X) versus y
fit(X, y, sample_weight=None, **fit_params) [source]
 
Fit the model to data. Fit a separate model for each output variable.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Data.  
y{array-like, sparse matrix} of shape (n_samples, n_outputs) 

Multi-output targets. An indicator matrix turns on multilabel estimation.  
sample_weightarray-like of shape (n_samples,), default=None 

Sample weights. If None, then samples are equally weighted. Only supported if the underlying regressor supports sample weights.  
**fit_paramsdict of string -> object 

Parameters passed to the estimator.fit method of each step.  New in version 0.23.     Returns 
 
selfobject
partial_fit(X, y, sample_weight=None) [source]
 
Incrementally fit the model to data. Fit a separate model for each output variable.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Data.  
y{array-like, sparse matrix} of shape (n_samples, n_outputs) 

Multi-output targets.  
sample_weightarray-like of shape (n_samples,), default=None 

Sample weights. If None, then samples are equally weighted. Only supported if the underlying regressor supports sample weights.    Returns 
 
selfobject
fit(X, Y, **fit_params) [source]
 
Fit the model to data matrix X and targets Y.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The input data.  
Yarray-like of shape (n_samples, n_classes) 

The target values.  
**fit_paramsdict of string -> object 

Parameters passed to the fit method at each step of the regressor chain.  New in version 0.23.     Returns 
 
selfobject
fit(X, y, sample_weight=None) [source]
 
Fit Naive Bayes classifier according to X, y  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.  
yarray-like of shape (n_samples,) 

Target values.  
sample_weightarray-like of shape (n_samples,), default=None 

Weights applied to individual samples (1. for unweighted).    Returns 
 
selfobject
partial_fit(X, y, classes=None, sample_weight=None) [source]
 
Incremental fit on a batch of samples. This method is expected to be called several times consecutively on different chunks of a dataset so as to implement out-of-core or online learning. This is especially useful when the whole dataset is too big to fit in memory at once. This method has some performance overhead hence it is better to call partial_fit on chunks of data that are as large as possible (as long as fitting in the memory budget) to hide the overhead.  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.  
yarray-like of shape (n_samples,) 

Target values.  
classesarray-like of shape (n_classes), default=None 

List of all the classes that can possibly appear in the y vector. Must be provided at the first call to partial_fit, can be omitted in subsequent calls.  
sample_weightarray-like of shape (n_samples,), default=None 

Weights applied to individual samples (1. for unweighted).    Returns 
 
selfobject
predict(X) [source]
 
Perform classification on an array of test vectors X.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 
  Returns 
 
Cndarray of shape (n_samples,) 

Predicted target values for X
predict_log_proba(X) [source]
 
Return log-probability estimates for the test vector X.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 
  Returns 
 
Carray-like of shape (n_samples, n_classes) 

Returns the log-probability of the samples for each class in the model. The columns correspond to the classes in sorted order, as they appear in the attribute classes_.
predict_proba(X) [source]
 
Return probability estimates for the test vector X.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 
  Returns 
 
Carray-like of shape (n_samples, n_classes) 

Returns the probability of the samples for each class in the model. The columns correspond to the classes in sorted order, as they appear in the attribute classes_.
fit(X, y, sample_weight=None) [source]
 
Fit Naive Bayes classifier according to X, y  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. Here, each feature of X is assumed to be from a different categorical distribution. It is further assumed that all categories of each feature are represented by the numbers 0, …, n - 1, where n refers to the total number of categories for the given feature. This can, for instance, be achieved with the help of OrdinalEncoder.  
yarray-like of shape (n_samples,) 

Target values.  
sample_weightarray-like of shape (n_samples), default=None 

Weights applied to individual samples (1. for unweighted).    Returns 
 
selfobject
partial_fit(X, y, classes=None, sample_weight=None) [source]
 
Incremental fit on a batch of samples. This method is expected to be called several times consecutively on different chunks of a dataset so as to implement out-of-core or online learning. This is especially useful when the whole dataset is too big to fit in memory at once. This method has some performance overhead hence it is better to call partial_fit on chunks of data that are as large as possible (as long as fitting in the memory budget) to hide the overhead.  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. Here, each feature of X is assumed to be from a different categorical distribution. It is further assumed that all categories of each feature are represented by the numbers 0, …, n - 1, where n refers to the total number of categories for the given feature. This can, for instance, be achieved with the help of OrdinalEncoder.  
yarray-like of shape (n_samples) 

Target values.  
classesarray-like of shape (n_classes), default=None 

List of all the classes that can possibly appear in the y vector. Must be provided at the first call to partial_fit, can be omitted in subsequent calls.  
sample_weightarray-like of shape (n_samples), default=None 

Weights applied to individual samples (1. for unweighted).    Returns 
 
selfobject
fit(X, y, sample_weight=None) [source]
 
Fit Gaussian Naive Bayes according to X, y  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Training vectors, where n_samples is the number of samples and n_features is the number of features.  
yarray-like of shape (n_samples,) 

Target values.  
sample_weightarray-like of shape (n_samples,), default=None 

Weights applied to individual samples (1. for unweighted).  New in version 0.17: Gaussian Naive Bayes supports fitting with sample_weight.     Returns 
 
selfobject