neulab/docprompting-conala huggingface dataset:
sklearn.preprocessing.robust_scale  
sklearn.preprocessing.robust_scale(X, *, axis=0, with_centering=True, with_scaling=True, quantile_range=25.0, 75.0, copy=True, unit_variance=False) [source]
 
Standardize a dataset along any axis Center to the median and component wise scale according to the interquartile range. Read more in the User Guide.  Parameters 
 
X{array-like, sparse matrix} of shape (n_sample, n_features) 

The data to center and scale.  
axisint, default=0 

axis used to compute the medians and IQR along. If 0, independently scale each feature, otherwise (if 1) scale each sample.  
with_centeringbool, default=True 

If True, center the data before scaling.  
with_scalingbool, default=True 

If True, scale the data to unit variance (or equivalently, unit standard deviation).  
quantile_rangetuple (q_min, q_max), 0.0 < q_min < q_max < 100.0 

default=(25.0, 75.0), == (1st quantile, 3rd quantile), == IQR Quantile range used to calculate scale_.  New in version 0.18.   
copybool, default=True 

set to False to perform inplace row normalization and avoid a copy (if the input is already a numpy array or a scipy.sparse CSR matrix and if axis is 1).  
unit_variancebool, default=False 

If True, scale data so that normally distributed features have a variance of 1. In general, if the difference between the x-values of q_max and q_min for a standard normal distribution is greater than 1, the dataset will be scaled down. If less than 1, the dataset will be scaled up.  New in version 0.24.     Returns 
 
X_tr{ndarray, sparse matrix} of shape (n_samples, n_features) 

The transformed data.      See also  
RobustScaler


Performs centering and scaling using the Transformer API (e.g. as part of a preprocessing Pipeline).    Notes This implementation will refuse to center scipy.sparse matrices since it would make them non-sparse and would potentially crash the program with memory exhaustion problems. Instead the caller is expected to either set explicitly with_centering=False (in that case, only variance scaling will be performed on the features of the CSR matrix) or to call X.toarray() if he/she expects the materialized dense array to fit in memory. To avoid memory copy the caller should pass a CSR matrix. For a comparison of the different scalers, transformers, and normalizers, see examples/preprocessing/plot_all_scaling.py.  Warning Risk of data leak Do not use robust_scale unless you know what you are doing. A common mistake is to apply it to the entire data before splitting into training and test sets. This will bias the model evaluation because information would have leaked from the test set to the training set. In general, we recommend using RobustScaler within a Pipeline in order to prevent most risks of data leaking: pipe = make_pipeline(RobustScaler(), LogisticRegression()).
sklearn.preprocessing.scale  
sklearn.preprocessing.scale(X, *, axis=0, with_mean=True, with_std=True, copy=True) [source]
 
Standardize a dataset along any axis. Center to the mean and component wise scale to unit variance. Read more in the User Guide.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The data to center and scale.  
axisint, default=0 

axis used to compute the means and standard deviations along. If 0, independently standardize each feature, otherwise (if 1) standardize each sample.  
with_meanbool, default=True 

If True, center the data before scaling.  
with_stdbool, default=True 

If True, scale the data to unit variance (or equivalently, unit standard deviation).  
copybool, default=True 

set to False to perform inplace row normalization and avoid a copy (if the input is already a numpy array or a scipy.sparse CSC matrix and if axis is 1).    Returns 
 
X_tr{ndarray, sparse matrix} of shape (n_samples, n_features) 

The transformed data.      See also  
StandardScaler


Performs scaling to unit variance using the Transformer API (e.g. as part of a preprocessing Pipeline).    Notes This implementation will refuse to center scipy.sparse matrices since it would make them non-sparse and would potentially crash the program with memory exhaustion problems. Instead the caller is expected to either set explicitly with_mean=False (in that case, only variance scaling will be performed on the features of the CSC matrix) or to call X.toarray() if he/she expects the materialized dense array to fit in memory. To avoid memory copy the caller should pass a CSC matrix. NaNs are treated as missing values: disregarded to compute the statistics, and maintained during the data transformation. We use a biased estimator for the standard deviation, equivalent to numpy.std(x, ddof=0). Note that the choice of ddof is unlikely to affect model performance. For a comparison of the different scalers, transformers, and normalizers, see examples/preprocessing/plot_all_scaling.py.  Warning Risk of data leak Do not use scale unless you know what you are doing. A common mistake is to apply it to the entire data before splitting into training and test sets. This will bias the model evaluation because information would have leaked from the test set to the training set. In general, we recommend using StandardScaler within a Pipeline in order to prevent most risks of data leaking: pipe = make_pipeline(StandardScaler(), LogisticRegression()).
sklearn.random_projection.johnson_lindenstrauss_min_dim  
sklearn.random_projection.johnson_lindenstrauss_min_dim(n_samples, *, eps=0.1) [source]
 
Find a ‘safe’ number of components to randomly project to. The distortion introduced by a random projection p only changes the distance between two points by a factor (1 +- eps) in an euclidean space with good probability. The projection p is an eps-embedding as defined by: (1 - eps) ||u - v||^2 < ||p(u) - p(v)||^2 < (1 + eps) ||u - v||^2 Where u and v are any rows taken from a dataset of shape (n_samples, n_features), eps is in ]0, 1[ and p is a projection by a random Gaussian N(0, 1) matrix of shape (n_components, n_features) (or a sparse Achlioptas matrix). The minimum number of components to guarantee the eps-embedding is given by: n_components >= 4 log(n_samples) / (eps^2 / 2 - eps^3 / 3) Note that the number of dimensions is independent of the original number of features but instead depends on the size of the dataset: the larger the dataset, the higher is the minimal dimensionality of an eps-embedding. Read more in the User Guide.  Parameters 
 
n_samplesint or array-like of int 

Number of samples that should be a integer greater than 0. If an array is given, it will compute a safe number of components array-wise.  
epsfloat or ndarray of shape (n_components,), dtype=float, default=0.1 

Maximum distortion rate in the range (0,1 ) as defined by the Johnson-Lindenstrauss lemma. If an array is given, it will compute a safe number of components array-wise.    Returns 
 
n_componentsint or ndarray of int 

The minimal number of components to guarantee with good probability an eps-embedding with n_samples.     References  
1  
https://en.wikipedia.org/wiki/Johnson%E2%80%93Lindenstrauss_lemma  
2  
Sanjoy Dasgupta and Anupam Gupta, 1999, “An elementary proof of the Johnson-Lindenstrauss Lemma.” http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.45.3654   Examples >>> johnson_lindenstrauss_min_dim(1e6, eps=0.5)
663
 >>> johnson_lindenstrauss_min_dim(1e6, eps=[0.5, 0.1, 0.01])
array([    663,   11841, 1112658])
 >>> johnson_lindenstrauss_min_dim([1e4, 1e5, 1e6], eps=0.1)
array([ 7894,  9868, 11841])
 
 Examples using sklearn.random_projection.johnson_lindenstrauss_min_dim
 
  The Johnson-Lindenstrauss bound for embedding with random projections
sklearn.set_config  
sklearn.set_config(assume_finite=None, working_memory=None, print_changed_only=None, display=None) [source]
 
Set global scikit-learn configuration  New in version 0.19.   Parameters 
 
assume_finitebool, default=None 

If True, validation for finiteness will be skipped, saving time, but leading to potential crashes. If False, validation for finiteness will be performed, avoiding error. Global default: False.  New in version 0.19.   
working_memoryint, default=None 

If set, scikit-learn will attempt to limit the size of temporary arrays to this number of MiB (per job when parallelised), often saving both computation time and memory on expensive operations that can be performed in chunks. Global default: 1024.  New in version 0.20.   
print_changed_onlybool, default=None 

If True, only the parameters that were set to non-default values will be printed when printing an estimator. For example, print(SVC()) while True will only print ‘SVC()’ while the default behaviour would be to print ‘SVC(C=1.0, cache_size=200, …)’ with all the non-changed parameters.  New in version 0.21.   
display{‘text’, ‘diagram’}, default=None 

If ‘diagram’, estimators will be displayed as a diagram in a Jupyter lab or notebook context. If ‘text’, estimators will be displayed as text. Default is ‘text’.  New in version 0.23.       See also  
config_context


Context manager for global scikit-learn configuration.  
get_config


Retrieve current values of the global configuration.    
 Examples using sklearn.set_config
 
  Release Highlights for scikit-learn 0.23  

  Compact estimator representations  

  Column Transformer with Mixed Types
sklearn.show_versions  
sklearn.show_versions() [source]
 
Print useful debugging information”  New in version 0.20.
sklearn.svm.l1_min_c  
sklearn.svm.l1_min_c(X, y, *, loss='squared_hinge', fit_intercept=True, intercept_scaling=1.0) [source]
 
Return the lowest bound for C such that for C in (l1_min_C, infinity) the model is guaranteed not to be empty. This applies to l1 penalized classifiers, such as LinearSVC with penalty=’l1’ and linear_model.LogisticRegression with penalty=’l1’. This value is valid if class_weight parameter in fit() is not set.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

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

Target vector relative to X.  
loss{‘squared_hinge’, ‘log’}, default=’squared_hinge’ 

Specifies the loss function. With ‘squared_hinge’ it is the squared hinge loss (a.k.a. L2 loss). With ‘log’ it is the loss of logistic regression models.  
fit_interceptbool, default=True 

Specifies if the intercept should be fitted by the model. It must match the fit() method parameter.  
intercept_scalingfloat, default=1.0 

when fit_intercept is True, instance vector x becomes [x, intercept_scaling], i.e. a “synthetic” feature with constant value equals to intercept_scaling is appended to the instance vector. It must match the fit() method parameter.    Returns 
 
l1_min_cfloat 

minimum value for C     
 Examples using sklearn.svm.l1_min_c
 
  Regularization path of L1- Logistic Regression
sklearn.tree.export_text  
sklearn.tree.export_text(decision_tree, *, feature_names=None, max_depth=10, spacing=3, decimals=2, show_weights=False) [source]
 
Build a text report showing the rules of a decision tree. Note that backwards compatibility may not be supported.  Parameters 
 
decision_treeobject 

The decision tree estimator to be exported. It can be an instance of DecisionTreeClassifier or DecisionTreeRegressor.  
feature_nameslist of str, default=None 

A list of length n_features containing the feature names. If None generic names will be used (“feature_0”, “feature_1”, …).  
max_depthint, default=10 

Only the first max_depth levels of the tree are exported. Truncated branches will be marked with “…”.  
spacingint, default=3 

Number of spaces between edges. The higher it is, the wider the result.  
decimalsint, default=2 

Number of decimal digits to display.  
show_weightsbool, default=False 

If true the classification weights will be exported on each leaf. The classification weights are the number of samples each class.    Returns 
 
reportstring 

Text summary of all the rules in the decision tree.     Examples >>> from sklearn.datasets import load_iris
>>> from sklearn.tree import DecisionTreeClassifier
>>> from sklearn.tree import export_text
>>> iris = load_iris()
>>> X = iris['data']
>>> y = iris['target']
>>> decision_tree = DecisionTreeClassifier(random_state=0, max_depth=2)
>>> decision_tree = decision_tree.fit(X, y)
>>> r = export_text(decision_tree, feature_names=iris['feature_names'])
>>> print(r)
|--- petal width (cm) <= 0.80
|   |--- class: 0
|--- petal width (cm) >  0.80
|   |--- petal width (cm) <= 1.75
|   |   |--- class: 1
|   |--- petal width (cm) >  1.75
|   |   |--- class: 2
sklearn.tree.plot_tree  
sklearn.tree.plot_tree(decision_tree, *, max_depth=None, feature_names=None, class_names=None, label='all', filled=False, impurity=True, node_ids=False, proportion=False, rotate='deprecated', rounded=False, precision=3, ax=None, fontsize=None) [source]
 
Plot a decision tree. The sample counts that are shown are weighted with any sample_weights that might be present. The visualization is fit automatically to the size of the axis. Use the figsize or dpi arguments of plt.figure to control the size of the rendering. Read more in the User Guide.  New in version 0.21.   Parameters 
 
decision_treedecision tree regressor or classifier 

The decision tree to be plotted.  
max_depthint, default=None 

The maximum depth of the representation. If None, the tree is fully generated.  
feature_nameslist of strings, default=None 

Names of each of the features. If None, generic names will be used (“X[0]”, “X[1]”, …).  
class_nameslist of str or bool, default=None 

Names of each of the target classes in ascending numerical order. Only relevant for classification and not supported for multi-output. If True, shows a symbolic representation of the class name.  
label{‘all’, ‘root’, ‘none’}, default=’all’ 

Whether to show informative labels for impurity, etc. Options include ‘all’ to show at every node, ‘root’ to show only at the top root node, or ‘none’ to not show at any node.  
filledbool, default=False 

When set to True, paint nodes to indicate majority class for classification, extremity of values for regression, or purity of node for multi-output.  
impuritybool, default=True 

When set to True, show the impurity at each node.  
node_idsbool, default=False 

When set to True, show the ID number on each node.  
proportionbool, default=False 

When set to True, change the display of ‘values’ and/or ‘samples’ to be proportions and percentages respectively.  
rotatebool, default=False 

This parameter has no effect on the matplotlib tree visualisation and it is kept here for backward compatibility.  Deprecated since version 0.23: rotate is deprecated in 0.23 and will be removed in 1.0 (renaming of 0.25).   
roundedbool, default=False 

When set to True, draw node boxes with rounded corners and use Helvetica fonts instead of Times-Roman.  
precisionint, default=3 

Number of digits of precision for floating point in the values of impurity, threshold and value attributes of each node.  
axmatplotlib axis, default=None 

Axes to plot to. If None, use current axis. Any previous content is cleared.  
fontsizeint, default=None 

Size of text font. If None, determined automatically to fit figure.    Returns 
 
annotationslist of artists 

List containing the artists for the annotation boxes making up the tree.     Examples >>> from sklearn.datasets import load_iris
>>> from sklearn import tree
 >>> clf = tree.DecisionTreeClassifier(random_state=0)
>>> iris = load_iris()
 >>> clf = clf.fit(iris.data, iris.target)
>>> tree.plot_tree(clf)  
[Text(251.5,345.217,'X[3] <= 0.8...
 
 Examples using sklearn.tree.plot_tree
 
  Plot the decision surface of a decision tree on the iris dataset  

  Understanding the decision tree structure
sklearn.utils.all_estimators  
sklearn.utils.all_estimators(type_filter=None) [source]
 
Get a list of all estimators from sklearn. This function crawls the module and gets all classes that inherit from BaseEstimator. Classes that are defined in test-modules are not included.  Parameters 
 
type_filter{“classifier”, “regressor”, “cluster”, “transformer”} or list of such str, default=None 

Which kind of estimators should be returned. If None, no filter is applied and all estimators are returned. Possible values are ‘classifier’, ‘regressor’, ‘cluster’ and ‘transformer’ to get estimators only of these specific types, or a list of these to get the estimators that fit at least one of the types.    Returns 
 
estimatorslist of tuples 

List of (name, class), where name is the class name as string and class is the actuall type of the class.
sklearn.utils.arrayfuncs.min_pos  
sklearn.utils.arrayfuncs.min_pos()  
Find the minimum value of an array over positive values Returns a huge value if none of the values are positive
sklearn.utils.assert_all_finite  
sklearn.utils.assert_all_finite(X, *, allow_nan=False) [source]
 
Throw a ValueError if X contains NaN or infinity.  Parameters 
 
X{ndarray, sparse matrix} 

allow_nanbool, default=False
sklearn.utils.as_float_array  
sklearn.utils.as_float_array(X, *, copy=True, force_all_finite=True) [source]
 
Converts an array-like to an array of floats. The new dtype will be np.float32 or np.float64, depending on the original type. The function can create a copy or modify the argument depending on the argument copy.  Parameters 
 
X{array-like, sparse matrix} 

copybool, default=True 

If True, a copy of X will be created. If False, a copy may still be returned if X’s dtype is not a floating point type.  
force_all_finitebool or ‘allow-nan’, default=True 

Whether to raise an error on np.inf, np.nan, pd.NA in X. The possibilities are:  True: Force all values of X to be finite. False: accepts np.inf, np.nan, pd.NA in X. ‘allow-nan’: accepts only np.nan and pd.NA values in X. Values cannot be infinite.   New in version 0.20: force_all_finite accepts the string 'allow-nan'.   Changed in version 0.23: Accepts pd.NA and converts it into np.nan     Returns 
 
XT{ndarray, sparse matrix} 

An array of type float.
sklearn.utils.Bunch  
sklearn.utils.Bunch(**kwargs) [source]
 
Container object exposing keys as attributes. Bunch objects are sometimes used as an output for functions and methods. They extend dictionaries by enabling values to be accessed by key, bunch["value_key"], or by an attribute, bunch.value_key. Examples >>> b = Bunch(a=1, b=2)
>>> b['b']
2
>>> b.b
2
>>> b.a = 3
>>> b['a']
3
>>> b.c = 6
>>> b['c']
6
 
 Examples using sklearn.utils.Bunch
 
  Species distribution modeling
sklearn.utils.check_consistent_length  
sklearn.utils.check_consistent_length(*arrays) [source]
 
Check that all arrays have consistent first dimensions. Checks whether all objects in arrays have the same shape or length.  Parameters 
 
*arrayslist or tuple of input objects. 

Objects that will be checked for consistent length.
sklearn.utils.check_random_state  
sklearn.utils.check_random_state(seed) [source]
 
Turn seed into a np.random.RandomState instance  Parameters 
 
seedNone, int or instance of RandomState 

If seed is None, return the RandomState singleton used by np.random. If seed is an int, return a new RandomState instance seeded with seed. If seed is already a RandomState instance, return it. Otherwise raise ValueError.     
 Examples using sklearn.utils.check_random_state
 
  Empirical evaluation of the impact of k-means initialization  

  MNIST classification using multinomial logistic + L1  

  Manifold Learning methods on a severed sphere  

  Isotonic Regression  

  Face completion with a multi-output estimators  

  Scaling the regularization parameter for SVCs
sklearn.utils.check_scalar  
sklearn.utils.check_scalar(x, name, target_type, *, min_val=None, max_val=None) [source]
 
Validate scalar parameters type and value.  Parameters 
 
xobject 

The scalar parameter to validate.  
namestr 

The name of the parameter to be printed in error messages.  
target_typetype or tuple 

Acceptable data types for the parameter.  
min_valfloat or int, default=None 

The minimum valid value the parameter can take. If None (default) it is implied that the parameter does not have a lower bound.  
max_valfloat or int, default=None 

The maximum valid value the parameter can take. If None (default) it is implied that the parameter does not have an upper bound.    Raises 
 TypeError

If the parameter’s type does not match the desired type.  ValueError

If the parameter’s value violates the given bounds.
sklearn.utils.class_weight.compute_class_weight  
sklearn.utils.class_weight.compute_class_weight(class_weight, *, classes, y) [source]
 
Estimate class weights for unbalanced datasets.  Parameters 
 
class_weightdict, ‘balanced’ or None 

If ‘balanced’, class weights will be given by n_samples / (n_classes * np.bincount(y)). If a dictionary is given, keys are classes and values are corresponding class weights. If None is given, the class weights will be uniform.  
classesndarray 

Array of the classes occurring in the data, as given by np.unique(y_org) with y_org the original class labels.  
yarray-like of shape (n_samples,) 

Array of original class labels per sample.    Returns 
 
class_weight_vectndarray of shape (n_classes,) 

Array with class_weight_vect[i] the weight for i-th class.     References The “balanced” heuristic is inspired by Logistic Regression in Rare Events Data, King, Zen, 2001.
sklearn.utils.class_weight.compute_sample_weight  
sklearn.utils.class_weight.compute_sample_weight(class_weight, y, *, indices=None) [source]
 
Estimate sample weights by class for unbalanced datasets.  Parameters 
 
class_weightdict, list of dicts, “balanced”, or None 

Weights associated with classes in the form {class_label: weight}. If not given, all classes are supposed to have weight one. For multi-output problems, a list of dicts can be provided in the same order as the columns of y. Note that for multioutput (including multilabel) weights should be defined for each class of every column in its own dict. For example, for four-class multilabel classification weights should be [{0: 1, 1: 1}, {0: 1, 1: 5}, {0: 1, 1: 1}, {0: 1, 1: 1}] instead of [{1:1}, {2:5}, {3:1}, {4:1}]. The “balanced” mode uses the values of y to automatically adjust weights inversely proportional to class frequencies in the input data: n_samples / (n_classes * np.bincount(y)). For multi-output, the weights of each column of y will be multiplied.  
yarray-like of shape (n_samples,) or (n_samples, n_outputs) 

Array of original class labels per sample.  
indicesarray-like of shape (n_subsample,), default=None 

Array of indices to be used in a subsample. Can be of length less than n_samples in the case of a subsample, or equal to n_samples in the case of a bootstrap subsample with repeated indices. If None, the sample weight will be calculated over the full sample. Only “balanced” is supported for class_weight if this is provided.    Returns 
 
sample_weight_vectndarray of shape (n_samples,) 

Array with sample weights as applied to the original y.
sklearn.utils.deprecated  
sklearn.utils.deprecated(extra='') [source]
 
Decorator to mark a function or class as deprecated. Issue a warning when the function is called/the class is instantiated and adds a warning to the docstring. The optional extra argument will be appended to the deprecation message and the docstring. Note: to use this with the default value for extra, put in an empty of parentheses: >>> from sklearn.utils import deprecated
>>> deprecated()
<sklearn.utils.deprecation.deprecated object at ...>
 >>> @deprecated()
... def some_function(): pass
  Parameters 
 
extrastr, default=’’ 

To be added to the deprecation messages.