neulab/docprompting-conala huggingface dataset:
radius_neighbors(X=None, radius=None, return_distance=True, sort_results=False) [source]
 
Finds the neighbors within a given radius of a point or points. Return the indices and distances of each point from the dataset lying in a ball with size radius around the points of the query array. Points lying on the boundary are included in the results. The result points are not necessarily sorted by distance to their query point.  Parameters 
 
Xarray-like of (n_samples, n_features), default=None 

The query point or points. If not provided, neighbors of each indexed point are returned. In this case, the query point is not considered its own neighbor.  
radiusfloat, default=None 

Limiting distance of neighbors to return. The default is the value passed to the constructor.  
return_distancebool, default=True 

Whether or not to return the distances.  
sort_resultsbool, default=False 

If True, the distances and indices will be sorted by increasing distances before being returned. If False, the results may not be sorted. If return_distance=False, setting sort_results=True will result in an error.  New in version 0.22.     Returns 
 
neigh_distndarray of shape (n_samples,) of arrays 

Array representing the distances to each point, only present if return_distance=True. The distance values are computed according to the metric constructor parameter.  
neigh_indndarray of shape (n_samples,) of arrays 

An array of arrays of indices of the approximate nearest points from the population matrix that lie within a ball of size radius around the query points.     Notes Because the number of neighbors of each point is not necessarily equal, the results for multiple query points cannot be fit in a standard data array. For efficiency, radius_neighbors returns arrays of objects, where each object is a 1D array of indices or distances. Examples In the following example, we construct a NeighborsClassifier class from an array representing our data set and ask who’s the closest point to [1, 1, 1]: >>> import numpy as np
>>> samples = [[0., 0., 0.], [0., .5, 0.], [1., 1., .5]]
>>> from sklearn.neighbors import NearestNeighbors
>>> neigh = NearestNeighbors(radius=1.6)
>>> neigh.fit(samples)
NearestNeighbors(radius=1.6)
>>> rng = neigh.radius_neighbors([[1., 1., 1.]])
>>> print(np.asarray(rng[0][0]))
[1.5 0.5]
>>> print(np.asarray(rng[1][0]))
[1 2]
 The first array returned contains the distances to all points which are closer than 1.6, while the second array returned contains their indices. In general, multiple points can be queried at the same time.
radius_neighbors_graph(X=None, radius=None, mode='connectivity', sort_results=False) [source]
 
Computes the (weighted) graph of Neighbors for points in X Neighborhoods are restricted the points at a distance lower than radius.  Parameters 
 
Xarray-like of shape (n_samples, n_features), default=None 

The query point or points. If not provided, neighbors of each indexed point are returned. In this case, the query point is not considered its own neighbor.  
radiusfloat, default=None 

Radius of neighborhoods. The default is the value passed to the constructor.  
mode{‘connectivity’, ‘distance’}, default=’connectivity’ 

Type of returned matrix: ‘connectivity’ will return the connectivity matrix with ones and zeros, in ‘distance’ the edges are Euclidean distance between points.  
sort_resultsbool, default=False 

If True, in each row of the result, the non-zero entries will be sorted by increasing distances. If False, the non-zero entries may not be sorted. Only used with mode=’distance’.  New in version 0.22.     Returns 
 
Asparse-matrix of shape (n_queries, n_samples_fit) 

n_samples_fit is the number of samples in the fitted data A[i, j] is assigned the weight of edge that connects i to j. The matrix if of format CSR.      See also  
kneighbors_graph

  Examples >>> X = [[0], [3], [1]]
>>> from sklearn.neighbors import NearestNeighbors
>>> neigh = NearestNeighbors(radius=1.5)
>>> neigh.fit(X)
NearestNeighbors(radius=1.5)
>>> A = neigh.radius_neighbors_graph(X)
>>> A.toarray()
array([[1., 0., 1.],
       [0., 1., 0.],
       [1., 0., 1.]])
fit(X, y) [source]
 
Fit the model according to the given training data.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

The training samples.  
yarray-like of shape (n_samples,) 

The corresponding training labels.    Returns 
 
selfobject 

returns a trained NeighborhoodComponentsAnalysis model.
transform(X) [source]
 
Applies the learned transformation to the given data.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Data samples.    Returns 
 X_embedded: ndarray of shape (n_samples, n_components)

The data samples transformed.    Raises 
 NotFittedError

If fit has not been called before.
fit(X, y) [source]
 
Fit the radius neighbors classifier from the training dataset.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) or (n_samples, n_samples) if metric=’precomputed’ 

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

Target values.    Returns 
 
selfRadiusNeighborsClassifier 

The fitted radius neighbors classifier.
fit(X, y) [source]
 
Fit the radius neighbors regressor from the training dataset.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) or (n_samples, n_samples) if metric=’precomputed’ 

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

Target values.    Returns 
 
selfRadiusNeighborsRegressor 

The fitted radius neighbors regressor.
predict(X) [source]
 
Predict the target for the provided data  Parameters 
 
Xarray-like of shape (n_queries, n_features), or (n_queries, n_indexed) if metric == ‘precomputed’ 

Test samples.    Returns 
 
yndarray of shape (n_queries,) or (n_queries, n_outputs), dtype=double 

Target values.
fit(X, y=None) [source]
 
Fit the radius neighbors transformer from the training dataset.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) or (n_samples, n_samples) if metric=’precomputed’ 

Training data.    Returns 
 
selfRadiusNeighborsTransformer 

The fitted radius neighbors transformer.
transform(X) [source]
 
Computes the (weighted) graph of Neighbors for points in X  Parameters 
 
Xarray-like of shape (n_samples_transform, n_features) 

Sample data    Returns 
 
Xtsparse matrix of shape (n_samples_transform, n_samples_fit) 

Xt[i, j] is assigned the weight of edge that connects i to j. Only the neighbors have an explicit value. The diagonal is always explicit. The matrix is of CSR format.
sklearn.neighbors.radius_neighbors_graph(X, radius, *, mode='connectivity', metric='minkowski', p=2, metric_params=None, include_self=False, n_jobs=None) [source]
 
Computes the (weighted) graph of Neighbors for points in X Neighborhoods are restricted the points at a distance lower than radius. Read more in the User Guide.  Parameters 
 
Xarray-like of shape (n_samples, n_features) or BallTree 

Sample data, in the form of a numpy array or a precomputed BallTree.  
radiusfloat 

Radius of neighborhoods.  
mode{‘connectivity’, ‘distance’}, default=’connectivity’ 

Type of returned matrix: ‘connectivity’ will return the connectivity matrix with ones and zeros, and ‘distance’ will return the distances between neighbors according to the given metric.  
metricstr, default=’minkowski’ 

The distance metric used to calculate the neighbors within a given radius for each sample point. The DistanceMetric class gives a list of available metrics. The default distance is ‘euclidean’ (‘minkowski’ metric with the param equal to 2.)  
pint, default=2 

Power parameter for the Minkowski metric. When p = 1, this is equivalent to using manhattan_distance (l1), and euclidean_distance (l2) for p = 2. For arbitrary p, minkowski_distance (l_p) is used.  
metric_paramsdict, default=None 

additional keyword arguments for the metric function.  
include_selfbool or ‘auto’, default=False 

Whether or not to mark each sample as the first nearest neighbor to itself. If ‘auto’, then True is used for mode=’connectivity’ and False for mode=’distance’.  
n_jobsint, default=None 

The number of parallel jobs to run for neighbors search. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors. See Glossary for more details.    Returns 
 
Asparse matrix of shape (n_samples, n_samples) 

Graph where A[i, j] is assigned the weight of edge that connects i to j. The matrix is of CSR format.      See also  
kneighbors_graph

  Examples >>> X = [[0], [3], [1]]
>>> from sklearn.neighbors import radius_neighbors_graph
>>> A = radius_neighbors_graph(X, 1.5, mode='connectivity',
...                            include_self=True)
>>> A.toarray()
array([[1., 0., 1.],
       [0., 1., 0.],
       [1., 0., 1.]])
fit(X, y=None) [source]
 
Fit the model to the data X.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Training data.    Returns 
 
selfBernoulliRBM 

The fitted model.
gibbs(v) [source]
 
Perform one Gibbs sampling step.  Parameters 
 
vndarray of shape (n_samples, n_features) 

Values of the visible layer to start from.    Returns 
 
v_newndarray of shape (n_samples, n_features) 

Values of the visible layer after one Gibbs step.
partial_fit(X, y=None) [source]
 
Fit the model to the data X which should contain a partial segment of the data.  Parameters 
 
Xndarray of shape (n_samples, n_features) 

Training data.    Returns 
 
selfBernoulliRBM 

The fitted model.
score_samples(X) [source]
 
Compute the pseudo-likelihood of X.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Values of the visible layer. Must be all-boolean (not checked).    Returns 
 
pseudo_likelihoodndarray of shape (n_samples,) 

Value of the pseudo-likelihood (proxy for likelihood).     Notes This method is not deterministic: it computes a quantity called the free energy on X, then on a randomly corrupted version of X, and returns the log of the logistic function of the difference.
transform(X) [source]
 
Compute the hidden layer activation probabilities, P(h=1|v=X).  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The data to be transformed.    Returns 
 
hndarray of shape (n_samples, n_components) 

Latent representations of the data.
fit(X, y) [source]
 
Fit the model to data matrix X and target(s) y.  Parameters 
 
Xndarray or sparse matrix of shape (n_samples, n_features) 

The input data.  
yndarray of shape (n_samples,) or (n_samples, n_outputs) 

The target values (class labels in classification, real numbers in regression).    Returns 
 
selfreturns a trained MLP model.
property partial_fit  
Update the model with a single iteration over the given data.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

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

The target values.  
classesarray of shape (n_classes,), default=None 

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 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.    Returns 
 
selfreturns a trained MLP model.
predict(X) [source]
 
Predict using the multi-layer perceptron classifier  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The input data.    Returns 
 
yndarray, shape (n_samples,) or (n_samples, n_classes) 

The predicted classes.
predict_log_proba(X) [source]
 
Return the log of probability estimates.  Parameters 
 
Xndarray of shape (n_samples, n_features) 

The input data.    Returns 
 
log_y_probndarray of shape (n_samples, n_classes) 

The predicted log-probability of the sample for each class in the model, where classes are ordered as they are in self.classes_. Equivalent to log(predict_proba(X))
predict_proba(X) [source]
 
Probability estimates.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The input data.    Returns 
 
y_probndarray of shape (n_samples, n_classes) 

The predicted probability of the sample for each class in the model, where classes are ordered as they are in self.classes_.
property partial_fit  
Update the model with a single iteration over the given data.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The input data.  
yndarray of shape (n_samples,) 

The target values.    Returns 
 
selfreturns a trained MLP model.
predict(X) [source]
 
Predict using the multi-layer perceptron model.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The input data.    Returns 
 
yndarray of shape (n_samples, n_outputs) 

The predicted values.
fit(X, y=None, **fit_params) [source]
 
Fit all transformers using X.  Parameters 
 
Xiterable or array-like, depending on transformers 

Input data, used to fit transformers.  
yarray-like of shape (n_samples, n_outputs), default=None 

Targets for supervised learning.    Returns 
 
selfFeatureUnion 

This estimator
fit_transform(X, y=None, **fit_params) [source]
 
Fit all transformers, transform the data and concatenate results.  Parameters 
 
Xiterable or array-like, depending on transformers 

Input data to be transformed.  
yarray-like of shape (n_samples, n_outputs), default=None 

Targets for supervised learning.    Returns 
 
X_tarray-like or sparse matrix of shape (n_samples, sum_n_components) 

hstack of results of transformers. sum_n_components is the sum of n_components (output dimension) over transformers.
get_params(deep=True) [source]
 
Get parameters for this estimator. Returns the parameters given in the constructor as well as the estimators contained within the transformer_list of the FeatureUnion.  Parameters 
 
deepbool, default=True 

If True, will return the parameters for this estimator and contained subobjects that are estimators.    Returns 
 
paramsmapping of string to any 

Parameter names mapped to their values.
set_params(**kwargs) [source]
 
Set the parameters of this estimator. Valid parameter keys can be listed with get_params(). Note that you can directly set the parameters of the estimators contained in tranformer_list.  Returns 
 self
transform(X) [source]
 
Transform X separately by each transformer, concatenate results.  Parameters 
 
Xiterable or array-like, depending on transformers 

Input data to be transformed.    Returns 
 
X_tarray-like or sparse matrix of shape (n_samples, sum_n_components) 

hstack of results of transformers. sum_n_components is the sum of n_components (output dimension) over transformers.
sklearn.pipeline.make_pipeline(*steps, memory=None, verbose=False) [source]
 
Construct a Pipeline from the given estimators. This is a shorthand for the Pipeline constructor; it does not require, and does not permit, naming the estimators. Instead, their names will be set to the lowercase of their types automatically.  Parameters 
 
*stepslist of estimators. 

memorystr or object with the joblib.Memory interface, default=None 

Used to cache the fitted transformers of the pipeline. By default, no caching is performed. If a string is given, it is the path to the caching directory. Enabling caching triggers a clone of the transformers before fitting. Therefore, the transformer instance given to the pipeline cannot be inspected directly. Use the attribute named_steps or steps to inspect estimators within the pipeline. Caching the transformers is advantageous when fitting is time consuming.  
verbosebool, default=False 

If True, the time elapsed while fitting each step will be printed as it is completed.    Returns 
 
pPipeline 
    See also  
Pipeline


Class for creating a pipeline of transforms with a final estimator.    Examples >>> from sklearn.naive_bayes import GaussianNB
>>> from sklearn.preprocessing import StandardScaler
>>> make_pipeline(StandardScaler(), GaussianNB(priors=None))
Pipeline(steps=[('standardscaler', StandardScaler()),
                ('gaussiannb', GaussianNB())])
sklearn.pipeline.make_union(*transformers, n_jobs=None, verbose=False) [source]
 
Construct a FeatureUnion from the given transformers. This is a shorthand for the FeatureUnion constructor; it does not require, and does not permit, naming the transformers. Instead, they will be given names automatically based on their types. It also does not allow weighting.  Parameters 
 
*transformerslist of estimators 

n_jobsint, default=None 

Number of jobs to run in parallel. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors. See Glossary for more details.  Changed in version v0.20: n_jobs default changed from 1 to None   
verbosebool, default=False 

If True, the time elapsed while fitting each transformer will be printed as it is completed.    Returns 
 
fFeatureUnion 
    See also  
FeatureUnion


Class for concatenating the results of multiple transformer objects.    Examples >>> from sklearn.decomposition import PCA, TruncatedSVD
>>> from sklearn.pipeline import make_union
>>> make_union(PCA(), TruncatedSVD())
 FeatureUnion(transformer_list=[('pca', PCA()),
                               ('truncatedsvd', TruncatedSVD())])
decision_function(X) [source]
 
Apply transforms, and decision_function of the final estimator  Parameters 
 
Xiterable 

Data to predict on. Must fulfill input requirements of first step of the pipeline.    Returns 
 
y_scorearray-like of shape (n_samples, n_classes)
fit(X, y=None, **fit_params) [source]
 
Fit the model Fit all the transforms one after the other and transform the data, then fit the transformed data using the final estimator.  Parameters 
 
Xiterable 

Training data. Must fulfill input requirements of first step of the pipeline.  
yiterable, default=None 

Training targets. Must fulfill label requirements for all steps of the pipeline.  
**fit_paramsdict of string -> object 

Parameters passed to the fit method of each step, where each parameter name is prefixed such that parameter p for step s has key s__p.    Returns 
 
selfPipeline 

This estimator
fit_predict(X, y=None, **fit_params) [source]
 
Applies fit_predict of last step in pipeline after transforms. Applies fit_transforms of a pipeline to the data, followed by the fit_predict method of the final estimator in the pipeline. Valid only if the final estimator implements fit_predict.  Parameters 
 
Xiterable 

Training data. Must fulfill input requirements of first step of the pipeline.  
yiterable, default=None 

Training targets. Must fulfill label requirements for all steps of the pipeline.  
**fit_paramsdict of string -> object 

Parameters passed to the fit method of each step, where each parameter name is prefixed such that parameter p for step s has key s__p.    Returns 
 
y_predarray-like
fit_transform(X, y=None, **fit_params) [source]
 
Fit the model and transform with the final estimator Fits all the transforms one after the other and transforms the data, then uses fit_transform on transformed data with the final estimator.  Parameters 
 
Xiterable 

Training data. Must fulfill input requirements of first step of the pipeline.  
yiterable, default=None 

Training targets. Must fulfill label requirements for all steps of the pipeline.  
**fit_paramsdict of string -> object 

Parameters passed to the fit method of each step, where each parameter name is prefixed such that parameter p for step s has key s__p.    Returns 
 
Xtarray-like of shape (n_samples, n_transformed_features) 

Transformed samples
get_params(deep=True) [source]
 
Get parameters for this estimator. Returns the parameters given in the constructor as well as the estimators contained within the steps of the Pipeline.  Parameters 
 
deepbool, default=True 

If True, will return the parameters for this estimator and contained subobjects that are estimators.    Returns 
 
paramsmapping of string to any 

Parameter names mapped to their values.
property inverse_transform  
Apply inverse transformations in reverse order All estimators in the pipeline must support inverse_transform.  Parameters 
 
Xtarray-like of shape (n_samples, n_transformed_features) 

Data samples, where n_samples is the number of samples and n_features is the number of features. Must fulfill input requirements of last step of pipeline’s inverse_transform method.    Returns 
 
Xtarray-like of shape (n_samples, n_features)
predict(X, **predict_params) [source]
 
Apply transforms to the data, and predict with the final estimator  Parameters 
 
Xiterable 

Data to predict on. Must fulfill input requirements of first step of the pipeline.  
**predict_paramsdict of string -> object 

Parameters to the predict called at the end of all transformations in the pipeline. Note that while this may be used to return uncertainties from some models with return_std or return_cov, uncertainties that are generated by the transformations in the pipeline are not propagated to the final estimator.  New in version 0.20.     Returns 
 
y_predarray-like
predict_log_proba(X) [source]
 
Apply transforms, and predict_log_proba of the final estimator  Parameters 
 
Xiterable 

Data to predict on. Must fulfill input requirements of first step of the pipeline.    Returns 
 
y_scorearray-like of shape (n_samples, n_classes)
predict_proba(X) [source]
 
Apply transforms, and predict_proba of the final estimator  Parameters 
 
Xiterable 

Data to predict on. Must fulfill input requirements of first step of the pipeline.    Returns 
 
y_probaarray-like of shape (n_samples, n_classes)
score(X, y=None, sample_weight=None) [source]
 
Apply transforms, and score with the final estimator  Parameters 
 
Xiterable 

Data to predict on. Must fulfill input requirements of first step of the pipeline.  
yiterable, default=None 

Targets used for scoring. Must fulfill label requirements for all steps of the pipeline.  
sample_weightarray-like, default=None 

If not None, this argument is passed as sample_weight keyword argument to the score method of the final estimator.    Returns 
 
scorefloat
score_samples(X) [source]
 
Apply transforms, and score_samples of the final estimator.  Parameters 
 
Xiterable 

Data to predict on. Must fulfill input requirements of first step of the pipeline.    Returns 
 
y_scorendarray of shape (n_samples,)
set_params(**kwargs) [source]
 
Set the parameters of this estimator. Valid parameter keys can be listed with get_params(). Note that you can directly set the parameters of the estimators contained in steps.  Returns 
 self
property transform  
Apply transforms, and transform with the final estimator This also works where final estimator is None: all prior transformations are applied.  Parameters 
 
Xiterable 

Data to transform. Must fulfill input requirements of first step of the pipeline.    Returns 
 
Xtarray-like of shape (n_samples, n_transformed_features)
sklearn.preprocessing.add_dummy_feature(X, value=1.0) [source]
 
Augment dataset with an additional dummy feature. This is useful for fitting an intercept term with implementations which cannot otherwise fit it directly.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Data.  
valuefloat 

Value to use for the dummy feature.    Returns 
 
X{ndarray, sparse matrix} of shape (n_samples, n_features + 1) 

Same data with dummy feature added as first column.     Examples >>> from sklearn.preprocessing import add_dummy_feature
>>> add_dummy_feature([[0, 1], [1, 0]])
array([[1., 0., 1.],
       [1., 1., 0.]])