neulab/docprompting-conala huggingface dataset:
transform(X) [source]
 
Transform dataset.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Input data to be transformed. Use dtype=np.float32 for maximum efficiency. Sparse matrices are also supported, use sparse csr_matrix for maximum efficiency.    Returns 
 
X_transformedsparse matrix of shape (n_samples, n_out) 

Transformed dataset.
decision_function(X) [source]
 
Predict decision function for samples in X using final_estimator_.decision_function.  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.    Returns 
 
decisionsndarray of shape (n_samples,), (n_samples, n_classes), or (n_samples, n_classes * (n_classes-1) / 2) 

The decision function computed the final estimator.
fit(X, y, sample_weight=None) [source]
 
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 of features.  
yarray-like of shape (n_samples,) 

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

Sample weights. If None, then samples are equally weighted. Note that this is supported only if all underlying estimators support sample weights.    Returns 
 
selfobject
get_params(deep=True) [source]
 
Get the parameters of an estimator from the ensemble. Returns the parameters given in the constructor as well as the estimators contained within the estimators parameter.  Parameters 
 
deepbool, default=True 

Setting it to True gets the various estimators and the parameters of the estimators as well.
predict(X, **predict_params) [source]
 
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.  
**predict_paramsdict of str -> obj 

Parameters to the predict called by the final_estimator. Note that this may be used to return uncertainties from some estimators with return_std or return_cov. Be aware that it will only accounts for uncertainty in the final estimator.    Returns 
 
y_predndarray of shape (n_samples,) or (n_samples, n_output) 

Predicted targets.
predict_proba(X) [source]
 
Predict class probabilities for X using final_estimator_.predict_proba.  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.    Returns 
 
probabilitiesndarray of shape (n_samples, n_classes) or list of ndarray of shape (n_output,) 

The class probabilities of the input samples.
set_params(**params) [source]
 
Set the parameters of an estimator from the ensemble. Valid parameter keys can be listed with get_params(). Note that you can directly set the parameters of the estimators contained in estimators.  Parameters 
 
**paramskeyword arguments 

Specific parameters using e.g. set_params(parameter_name=new_value). In addition, to setting the parameters of the estimator, the individual estimator of the estimators can also be set, or can be removed by setting them to ‘drop’.
transform(X) [source]
 
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 the number of features.    Returns 
 
y_predsndarray of shape (n_samples, n_estimators) or (n_samples, n_classes * n_estimators) 

Prediction outputs for each estimator.
transform(X) [source]
 
Return the predictions 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 the number of features.    Returns 
 
y_predsndarray of shape (n_samples, n_estimators) 

Prediction outputs for each estimator.
fit(X, y, sample_weight=None) [source]
 
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 of features.  
yarray-like of shape (n_samples,) 

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

Sample weights. If None, then samples are equally weighted. Note that this is supported only if all underlying estimators support sample weights.  New in version 0.18.     Returns 
 
selfobject
fit_transform(X, y=None, **fit_params) [source]
 
Return class labels or probabilities for each estimator. Return predictions for X for each estimator.  Parameters 
 
X{array-like, sparse matrix, dataframe} of shape (n_samples, n_features) 

Input samples  
yndarray of shape (n_samples,), default=None 

Target values (None for unsupervised transformations).  
**fit_paramsdict 

Additional fit parameters.    Returns 
 
X_newndarray array of shape (n_samples, n_features_new) 

Transformed array.
predict(X) [source]
 
Predict class labels for X.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The input samples.    Returns 
 
majarray-like of shape (n_samples,) 

Predicted class labels.
property predict_proba  
Compute probabilities of possible outcomes for samples in X.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The input samples.    Returns 
 
avgarray-like of shape (n_samples, n_classes) 

Weighted average probability for each class per sample.
transform(X) [source]
 
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 the number of features.    Returns 
 probabilities_or_labels

 
If voting='soft' and flatten_transform=True: 

returns ndarray of shape (n_classifiers, n_samples * n_classes), being class probabilities calculated by each classifier.  
If voting='soft' and `flatten_transform=False: 

ndarray of shape (n_classifiers, n_samples, n_classes)  
If voting='hard': 

ndarray of shape (n_samples, n_classifiers), being class labels predicted by each classifier.
fit(X, y, sample_weight=None) [source]
 
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 of features.  
yarray-like of shape (n_samples,) 

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

Sample weights. If None, then samples are equally weighted. Note that this is supported only if all underlying estimators support sample weights.    Returns 
 
selfobject 

Fitted estimator.
predict(X) [source]
 
Predict regression target for X. The predicted regression target of an input sample is computed as the mean predicted regression targets of the estimators in the ensemble.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The input samples.    Returns 
 
yndarray of shape (n_samples,) 

The predicted values.
transform(X) [source]
 
Return predictions for X for each estimator.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The input samples.    Returns 
 predictions: ndarray of shape (n_samples, n_classifiers)

Values predicted by each regressor.
class sklearn.exceptions.ConvergenceWarning [source]
 
Custom warning to capture convergence problems  Changed in version 0.18: Moved from sklearn.utils.   Attributes 
 args
   Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
sklearn.exceptions.ConvergenceWarning  
class sklearn.exceptions.ConvergenceWarning [source]
 
Custom warning to capture convergence problems  Changed in version 0.18: Moved from sklearn.utils.   Attributes 
 args
   Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self. 
 
 Examples using sklearn.exceptions.ConvergenceWarning
 
  Multiclass sparse logistic regression on 20newgroups  

  Early stopping of Stochastic Gradient Descent  

  Visualization of MLP weights on MNIST  

  Compare Stochastic learning strategies for MLPClassifier  

  Feature discretization
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
sklearn.exceptions.DataConversionWarning  
class sklearn.exceptions.DataConversionWarning [source]
 
Warning used to notify implicit data conversions happening in the code. This warning occurs when some input data needs to be converted or interpreted in a way that may not match the user’s expectations.  For example, this warning may occur when the user

 passes an integer array to a function which expects float input and will convert the input requests a non-copying operation, but a copy is required to meet the implementation’s data-type expectations; passes an input whose shape can be interpreted ambiguously.     Changed in version 0.18: Moved from sklearn.utils.validation.   Attributes 
 args
   Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
class sklearn.exceptions.DataConversionWarning [source]
 
Warning used to notify implicit data conversions happening in the code. This warning occurs when some input data needs to be converted or interpreted in a way that may not match the user’s expectations.  For example, this warning may occur when the user

 passes an integer array to a function which expects float input and will convert the input requests a non-copying operation, but a copy is required to meet the implementation’s data-type expectations; passes an input whose shape can be interpreted ambiguously.     Changed in version 0.18: Moved from sklearn.utils.validation.   Attributes 
 args
   Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
sklearn.exceptions.DataDimensionalityWarning  
class sklearn.exceptions.DataDimensionalityWarning [source]
 
Custom warning to notify potential issues with data dimensionality. For example, in random projection, this warning is raised when the number of components, which quantifies the dimensionality of the target projection space, is higher than the number of features, which quantifies the dimensionality of the original source space, to imply that the dimensionality of the problem will not be reduced.  Changed in version 0.18: Moved from sklearn.utils.   Attributes 
 args
   Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
class sklearn.exceptions.DataDimensionalityWarning [source]
 
Custom warning to notify potential issues with data dimensionality. For example, in random projection, this warning is raised when the number of components, which quantifies the dimensionality of the target projection space, is higher than the number of features, which quantifies the dimensionality of the original source space, to imply that the dimensionality of the problem will not be reduced.  Changed in version 0.18: Moved from sklearn.utils.   Attributes 
 args
   Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
class sklearn.exceptions.EfficiencyWarning [source]
 
Warning used to notify the user of inefficient computation. This warning notifies the user that the efficiency may not be optimal due to some reason which may be included as a part of the warning message. This may be subclassed into a more specific Warning class.  New in version 0.18.   Attributes 
 args
   Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
sklearn.exceptions.EfficiencyWarning  
class sklearn.exceptions.EfficiencyWarning [source]
 
Warning used to notify the user of inefficient computation. This warning notifies the user that the efficiency may not be optimal due to some reason which may be included as a part of the warning message. This may be subclassed into a more specific Warning class.  New in version 0.18.   Attributes 
 args
   Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
class sklearn.exceptions.FitFailedWarning [source]
 
Warning class used if there is an error while fitting the estimator. This Warning is used in meta estimators GridSearchCV and RandomizedSearchCV and the cross-validation helper function cross_val_score to warn when there is an error while fitting the estimator.  Changed in version 0.18: Moved from sklearn.cross_validation.   Attributes 
 args
   Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
sklearn.exceptions.FitFailedWarning  
class sklearn.exceptions.FitFailedWarning [source]
 
Warning class used if there is an error while fitting the estimator. This Warning is used in meta estimators GridSearchCV and RandomizedSearchCV and the cross-validation helper function cross_val_score to warn when there is an error while fitting the estimator.  Changed in version 0.18: Moved from sklearn.cross_validation.   Attributes 
 args
   Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
sklearn.exceptions.NotFittedError  
class sklearn.exceptions.NotFittedError [source]
 
Exception class to raise if estimator is used before fitting. This class inherits from both ValueError and AttributeError to help with exception handling and backward compatibility.  Attributes 
 args
   Examples >>> from sklearn.svm import LinearSVC
>>> from sklearn.exceptions import NotFittedError
>>> try:
...     LinearSVC().predict([[1, 2], [2, 3], [3, 4]])
... except NotFittedError as e:
...     print(repr(e))
NotFittedError("This LinearSVC instance is not fitted yet. Call 'fit' with
appropriate arguments before using this estimator."...)
  Changed in version 0.18: Moved from sklearn.utils.validation.  Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
class sklearn.exceptions.NotFittedError [source]
 
Exception class to raise if estimator is used before fitting. This class inherits from both ValueError and AttributeError to help with exception handling and backward compatibility.  Attributes 
 args
   Examples >>> from sklearn.svm import LinearSVC
>>> from sklearn.exceptions import NotFittedError
>>> try:
...     LinearSVC().predict([[1, 2], [2, 3], [3, 4]])
... except NotFittedError as e:
...     print(repr(e))
NotFittedError("This LinearSVC instance is not fitted yet. Call 'fit' with
appropriate arguments before using this estimator."...)
  Changed in version 0.18: Moved from sklearn.utils.validation.  Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
class sklearn.exceptions.UndefinedMetricWarning [source]
 
Warning used when the metric is invalid  Changed in version 0.18: Moved from sklearn.base.   Attributes 
 args
   Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
sklearn.exceptions.UndefinedMetricWarning  
class sklearn.exceptions.UndefinedMetricWarning [source]
 
Warning used when the metric is invalid  Changed in version 0.18: Moved from sklearn.base.   Attributes 
 args
   Methods  
with_traceback Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.    
with_traceback()  
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
fit(X, y=None) [source]
 
Learn a list of feature name -> indices mappings.  Parameters 
 
XMapping or iterable over Mappings 

Dict(s) or Mapping(s) from feature names (arbitrary Python objects) to feature values (strings or convertible to dtype).  Changed in version 0.24: Accepts multiple string values for one categorical feature.   
y(ignored) 
  Returns 
 self
fit_transform(X, y=None) [source]
 
Learn a list of feature name -> indices mappings and transform X. Like fit(X) followed by transform(X), but does not require materializing X in memory.  Parameters 
 
XMapping or iterable over Mappings 

Dict(s) or Mapping(s) from feature names (arbitrary Python objects) to feature values (strings or convertible to dtype).  Changed in version 0.24: Accepts multiple string values for one categorical feature.   
y(ignored) 
  Returns 
 
Xa{array, sparse matrix} 

Feature vectors; always 2-d.
get_feature_names() [source]
 
Returns a list of feature names, ordered by their indices. If one-of-K coding is applied to categorical features, this will include the constructed feature names but not the original ones.
inverse_transform(X, dict_type=<class 'dict'>) [source]
 
Transform array or sparse matrix X back to feature mappings. X must have been produced by this DictVectorizer’s transform or fit_transform method; it may only have passed through transformers that preserve the number of features and their order. In the case of one-hot/one-of-K coding, the constructed feature names and values are returned rather than the original ones.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Sample matrix.  
dict_typetype, default=dict 

Constructor for feature mappings. Must conform to the collections.Mapping API.    Returns 
 
Dlist of dict_type objects of shape (n_samples,) 

Feature mappings for the samples in X.
restrict(support, indices=False) [source]
 
Restrict the features to those in support using feature selection. This function modifies the estimator in-place.  Parameters 
 
supportarray-like 

Boolean mask or list of indices (as returned by the get_support member of feature selectors).  
indicesbool, default=False 

Whether support is a list of indices.    Returns 
 self
   Examples >>> from sklearn.feature_extraction import DictVectorizer
>>> from sklearn.feature_selection import SelectKBest, chi2
>>> v = DictVectorizer()
>>> D = [{'foo': 1, 'bar': 2}, {'foo': 3, 'baz': 1}]
>>> X = v.fit_transform(D)
>>> support = SelectKBest(chi2, k=2).fit(X, [0, 1])
>>> v.get_feature_names()
['bar', 'baz', 'foo']
>>> v.restrict(support.get_support())
DictVectorizer()
>>> v.get_feature_names()
['bar', 'foo']
transform(X) [source]
 
Transform feature->value dicts to array or sparse matrix. Named features not encountered during fit or fit_transform will be silently ignored.  Parameters 
 
XMapping or iterable over Mappings of shape (n_samples,) 

Dict(s) or Mapping(s) from feature names (arbitrary Python objects) to feature values (strings or convertible to dtype).    Returns 
 
Xa{array, sparse matrix} 

Feature vectors; always 2-d.
fit(X=None, y=None) [source]
 
No-op. This method doesn’t do anything. It exists purely for compatibility with the scikit-learn transformer API.  Parameters 
 
Xndarray 
  Returns 
 
selfFeatureHasher
transform(raw_X) [source]
 
Transform a sequence of instances to a scipy.sparse matrix.  Parameters 
 
raw_Xiterable over iterable over raw features, length = n_samples 

Samples. Each sample must be iterable an (e.g., a list or tuple) containing/generating feature names (and optionally values, see the input_type constructor argument) which will be hashed. raw_X need not support the len function, so it can be the result of a generator; n_samples is determined on the fly.    Returns 
 
Xsparse matrix of shape (n_samples, n_features) 

Feature matrix, for use with estimators or further transformers.
sklearn.feature_extraction.image.extract_patches_2d(image, patch_size, *, max_patches=None, random_state=None) [source]
 
Reshape a 2D image into a collection of patches The resulting patches are allocated in a dedicated array. Read more in the User Guide.  Parameters 
 
imagendarray of shape (image_height, image_width) or (image_height, image_width, n_channels) 

The original image data. For color images, the last dimension specifies the channel: a RGB image would have n_channels=3.  
patch_sizetuple of int (patch_height, patch_width) 

The dimensions of one patch.  
max_patchesint or float, default=None 

The maximum number of patches to extract. If max_patches is a float between 0 and 1, it is taken to be a proportion of the total number of patches.  
random_stateint, RandomState instance, default=None 

Determines the random number generator used for random sampling when max_patches is not None. Use an int to make the randomness deterministic. See Glossary.    Returns 
 
patchesarray of shape (n_patches, patch_height, patch_width) or (n_patches, patch_height, patch_width, n_channels) 

The collection of patches extracted from the image, where n_patches is either max_patches or the total number of patches that can be extracted.     Examples >>> from sklearn.datasets import load_sample_image
>>> from sklearn.feature_extraction import image
>>> # Use the array data from the first image in this dataset:
>>> one_image = load_sample_image("china.jpg")
>>> print('Image shape: {}'.format(one_image.shape))
Image shape: (427, 640, 3)
>>> patches = image.extract_patches_2d(one_image, (2, 2))
>>> print('Patches shape: {}'.format(patches.shape))
Patches shape: (272214, 2, 2, 3)
>>> # Here are just two of these patches:
>>> print(patches[1])
[[[174 201 231]
  [174 201 231]]
 [[173 200 230]
  [173 200 230]]]
>>> print(patches[800])
[[[187 214 243]
  [188 215 244]]
 [[187 214 243]
  [188 215 244]]]
sklearn.feature_extraction.image.grid_to_graph(n_x, n_y, n_z=1, *, mask=None, return_as=<class 'scipy.sparse.coo.coo_matrix'>, dtype=<class 'int'>) [source]
 
Graph of the pixel-to-pixel connections Edges exist if 2 voxels are connected.  Parameters 
 
n_xint 

Dimension in x axis  
n_yint 

Dimension in y axis  
n_zint, default=1 

Dimension in z axis  
maskndarray of shape (n_x, n_y, n_z), dtype=bool, default=None 

An optional mask of the image, to consider only part of the pixels.  
return_asnp.ndarray or a sparse matrix class, default=sparse.coo_matrix 

The class to use to build the returned adjacency matrix.  
dtypedtype, default=int 

The data of the returned sparse matrix. By default it is int     Notes For scikit-learn versions 0.14.1 and prior, return_as=np.ndarray was handled by returning a dense np.matrix instance. Going forward, np.ndarray returns an np.ndarray, as expected. For compatibility, user code relying on this method should wrap its calls in np.asarray to avoid type issues.