doc_content stringlengths 1 386k | doc_id stringlengths 5 188 |
|---|---|
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... | sklearn.modules.generated.sklearn.naive_bayes.complementnb#sklearn.naive_bayes.ComplementNB.partial_fit |
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 | sklearn.modules.generated.sklearn.naive_bayes.complementnb#sklearn.naive_bayes.ComplementNB.predict |
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... | sklearn.modules.generated.sklearn.naive_bayes.complementnb#sklearn.naive_bayes.ComplementNB.predict_log_proba |
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 orde... | sklearn.modules.generated.sklearn.naive_bayes.complementnb#sklearn.naive_bayes.ComplementNB.predict_proba |
score(X, y, sample_weight=None) [source]
Return the mean accuracy on the given test data and labels. In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted. Parameters
Xarray-like of shape (n_samples, n_featur... | sklearn.modules.generated.sklearn.naive_bayes.complementnb#sklearn.naive_bayes.ComplementNB.score |
set_params(**params) [source]
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object. Parameters
**paramsdict
Es... | sklearn.modules.generated.sklearn.naive_bayes.complementnb#sklearn.naive_bayes.ComplementNB.set_params |
class sklearn.naive_bayes.GaussianNB(*, priors=None, var_smoothing=1e-09) [source]
Gaussian Naive Bayes (GaussianNB) Can perform online updates to model parameters via partial_fit. For details on algorithm used to update feature means and variance online, see Stanford CS tech report STAN-CS-79-773 by Chan, Golub, and... | sklearn.modules.generated.sklearn.naive_bayes.gaussiannb#sklearn.naive_bayes.GaussianNB |
sklearn.naive_bayes.GaussianNB
class sklearn.naive_bayes.GaussianNB(*, priors=None, var_smoothing=1e-09) [source]
Gaussian Naive Bayes (GaussianNB) Can perform online updates to model parameters via partial_fit. For details on algorithm used to update feature means and variance online, see Stanford CS tech report S... | sklearn.modules.generated.sklearn.naive_bayes.gaussiannb |
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... | sklearn.modules.generated.sklearn.naive_bayes.gaussiannb#sklearn.naive_bayes.GaussianNB.fit |
get_params(deep=True) [source]
Get parameters for this estimator. Parameters
deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns
paramsdict
Parameter names mapped to their values. | sklearn.modules.generated.sklearn.naive_bayes.gaussiannb#sklearn.naive_bayes.GaussianNB.get_params |
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... | sklearn.modules.generated.sklearn.naive_bayes.gaussiannb#sklearn.naive_bayes.GaussianNB.partial_fit |
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 | sklearn.modules.generated.sklearn.naive_bayes.gaussiannb#sklearn.naive_bayes.GaussianNB.predict |
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... | sklearn.modules.generated.sklearn.naive_bayes.gaussiannb#sklearn.naive_bayes.GaussianNB.predict_log_proba |
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 orde... | sklearn.modules.generated.sklearn.naive_bayes.gaussiannb#sklearn.naive_bayes.GaussianNB.predict_proba |
score(X, y, sample_weight=None) [source]
Return the mean accuracy on the given test data and labels. In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted. Parameters
Xarray-like of shape (n_samples, n_featur... | sklearn.modules.generated.sklearn.naive_bayes.gaussiannb#sklearn.naive_bayes.GaussianNB.score |
set_params(**params) [source]
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object. Parameters
**paramsdict
Es... | sklearn.modules.generated.sklearn.naive_bayes.gaussiannb#sklearn.naive_bayes.GaussianNB.set_params |
class sklearn.naive_bayes.MultinomialNB(*, alpha=1.0, fit_prior=True, class_prior=None) [source]
Naive Bayes classifier for multinomial models The multinomial Naive Bayes classifier is suitable for classification with discrete features (e.g., word counts for text classification). The multinomial distribution normally... | sklearn.modules.generated.sklearn.naive_bayes.multinomialnb#sklearn.naive_bayes.MultinomialNB |
sklearn.naive_bayes.MultinomialNB
class sklearn.naive_bayes.MultinomialNB(*, alpha=1.0, fit_prior=True, class_prior=None) [source]
Naive Bayes classifier for multinomial models The multinomial Naive Bayes classifier is suitable for classification with discrete features (e.g., word counts for text classification). T... | sklearn.modules.generated.sklearn.naive_bayes.multinomialnb |
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. ... | sklearn.modules.generated.sklearn.naive_bayes.multinomialnb#sklearn.naive_bayes.MultinomialNB.fit |
get_params(deep=True) [source]
Get parameters for this estimator. Parameters
deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns
paramsdict
Parameter names mapped to their values. | sklearn.modules.generated.sklearn.naive_bayes.multinomialnb#sklearn.naive_bayes.MultinomialNB.get_params |
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... | sklearn.modules.generated.sklearn.naive_bayes.multinomialnb#sklearn.naive_bayes.MultinomialNB.partial_fit |
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 | sklearn.modules.generated.sklearn.naive_bayes.multinomialnb#sklearn.naive_bayes.MultinomialNB.predict |
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... | sklearn.modules.generated.sklearn.naive_bayes.multinomialnb#sklearn.naive_bayes.MultinomialNB.predict_log_proba |
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 orde... | sklearn.modules.generated.sklearn.naive_bayes.multinomialnb#sklearn.naive_bayes.MultinomialNB.predict_proba |
score(X, y, sample_weight=None) [source]
Return the mean accuracy on the given test data and labels. In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted. Parameters
Xarray-like of shape (n_samples, n_featur... | sklearn.modules.generated.sklearn.naive_bayes.multinomialnb#sklearn.naive_bayes.MultinomialNB.score |
set_params(**params) [source]
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object. Parameters
**paramsdict
Es... | sklearn.modules.generated.sklearn.naive_bayes.multinomialnb#sklearn.naive_bayes.MultinomialNB.set_params |
class sklearn.neighbors.BallTree(X, leaf_size=40, metric='minkowski', **kwargs)
BallTree for fast generalized N-point problems Read more in the User Guide. Parameters
Xarray-like of shape (n_samples, n_features)
n_samples is the number of points in the data set, and n_features is the dimension of the parameter ... | sklearn.modules.generated.sklearn.neighbors.balltree#sklearn.neighbors.BallTree |
sklearn.neighbors.BallTree
class sklearn.neighbors.BallTree(X, leaf_size=40, metric='minkowski', **kwargs)
BallTree for fast generalized N-point problems Read more in the User Guide. Parameters
Xarray-like of shape (n_samples, n_features)
n_samples is the number of points in the data set, and n_features is th... | sklearn.modules.generated.sklearn.neighbors.balltree |
get_arrays(self)
Get data and node arrays. Returns
arrays: tuple of array
Arrays for storing tree data, index, node data and node bounds. | sklearn.modules.generated.sklearn.neighbors.balltree#sklearn.neighbors.BallTree.get_arrays |
get_n_calls(self)
Get number of calls. Returns
n_calls: int
number of distance computation calls | sklearn.modules.generated.sklearn.neighbors.balltree#sklearn.neighbors.BallTree.get_n_calls |
get_tree_stats(self)
Get tree status. Returns
tree_stats: tuple of int
(number of trims, number of leaves, number of splits) | sklearn.modules.generated.sklearn.neighbors.balltree#sklearn.neighbors.BallTree.get_tree_stats |
kernel_density(self, X, h, kernel='gaussian', atol=0, rtol=1e-08, breadth_first=True, return_log=False)
Compute the kernel density estimate at points X with the given kernel, using the distance metric specified at tree creation. Parameters
Xarray-like of shape (n_samples, n_features)
An array of points to query... | sklearn.modules.generated.sklearn.neighbors.balltree#sklearn.neighbors.BallTree.kernel_density |
query(X, k=1, return_distance=True, dualtree=False, breadth_first=False)
query the tree for the k nearest neighbors Parameters
Xarray-like of shape (n_samples, n_features)
An array of points to query
kint, default=1
The number of nearest neighbors to return
return_distancebool, default=True
if True, ret... | sklearn.modules.generated.sklearn.neighbors.balltree#sklearn.neighbors.BallTree.query |
query_radius(X, r, return_distance=False, count_only=False, sort_results=False)
query the tree for neighbors within a radius r Parameters
Xarray-like of shape (n_samples, n_features)
An array of points to query
rdistance within which neighbors are returned
r can be a single value, or an array of values of s... | sklearn.modules.generated.sklearn.neighbors.balltree#sklearn.neighbors.BallTree.query_radius |
reset_n_calls(self)
Reset number of calls to 0. | sklearn.modules.generated.sklearn.neighbors.balltree#sklearn.neighbors.BallTree.reset_n_calls |
two_point_correlation(X, r, dualtree=False)
Compute the two-point correlation function Parameters
Xarray-like of shape (n_samples, n_features)
An array of points to query. Last dimension should match dimension of training data.
rarray-like
A one-dimensional array of distances
dualtreebool, default=False
... | sklearn.modules.generated.sklearn.neighbors.balltree#sklearn.neighbors.BallTree.two_point_correlation |
sklearn.neighbors.DistanceMetric
class sklearn.neighbors.DistanceMetric
DistanceMetric class This class provides a uniform interface to fast distance metric functions. The various metrics can be accessed via the get_metric class method and the metric string identifier (see below). Examples >>> from sklearn.neighbor... | sklearn.modules.generated.sklearn.neighbors.distancemetric |
class sklearn.neighbors.DistanceMetric
DistanceMetric class This class provides a uniform interface to fast distance metric functions. The various metrics can be accessed via the get_metric class method and the metric string identifier (see below). Examples >>> from sklearn.neighbors import DistanceMetric
>>> dist = ... | sklearn.modules.generated.sklearn.neighbors.distancemetric#sklearn.neighbors.DistanceMetric |
dist_to_rdist()
Convert the true distance to the reduced distance. The reduced distance, defined for some metrics, is a computationally more efficient measure which preserves the rank of the true distance. For example, in the Euclidean distance metric, the reduced distance is the squared-euclidean distance. | sklearn.modules.generated.sklearn.neighbors.distancemetric#sklearn.neighbors.DistanceMetric.dist_to_rdist |
get_metric()
Get the given distance metric from the string identifier. See the docstring of DistanceMetric for a list of available metrics. Parameters
metricstring or class name
The distance metric to use **kwargs
additional arguments will be passed to the requested metric | sklearn.modules.generated.sklearn.neighbors.distancemetric#sklearn.neighbors.DistanceMetric.get_metric |
pairwise()
Compute the pairwise distances between X and Y This is a convenience routine for the sake of testing. For many metrics, the utilities in scipy.spatial.distance.cdist and scipy.spatial.distance.pdist will be faster. Parameters
Xarray-like
Array of shape (Nx, D), representing Nx points in D dimensions.... | sklearn.modules.generated.sklearn.neighbors.distancemetric#sklearn.neighbors.DistanceMetric.pairwise |
rdist_to_dist()
Convert the Reduced distance to the true distance. The reduced distance, defined for some metrics, is a computationally more efficient measure which preserves the rank of the true distance. For example, in the Euclidean distance metric, the reduced distance is the squared-euclidean distance. | sklearn.modules.generated.sklearn.neighbors.distancemetric#sklearn.neighbors.DistanceMetric.rdist_to_dist |
class sklearn.neighbors.KDTree(X, leaf_size=40, metric='minkowski', **kwargs)
KDTree for fast generalized N-point problems Read more in the User Guide. Parameters
Xarray-like of shape (n_samples, n_features)
n_samples is the number of points in the data set, and n_features is the dimension of the parameter spac... | sklearn.modules.generated.sklearn.neighbors.kdtree#sklearn.neighbors.KDTree |
sklearn.neighbors.KDTree
class sklearn.neighbors.KDTree(X, leaf_size=40, metric='minkowski', **kwargs)
KDTree for fast generalized N-point problems Read more in the User Guide. Parameters
Xarray-like of shape (n_samples, n_features)
n_samples is the number of points in the data set, and n_features is the dime... | sklearn.modules.generated.sklearn.neighbors.kdtree |
get_arrays(self)
Get data and node arrays. Returns
arrays: tuple of array
Arrays for storing tree data, index, node data and node bounds. | sklearn.modules.generated.sklearn.neighbors.kdtree#sklearn.neighbors.KDTree.get_arrays |
get_n_calls(self)
Get number of calls. Returns
n_calls: int
number of distance computation calls | sklearn.modules.generated.sklearn.neighbors.kdtree#sklearn.neighbors.KDTree.get_n_calls |
get_tree_stats(self)
Get tree status. Returns
tree_stats: tuple of int
(number of trims, number of leaves, number of splits) | sklearn.modules.generated.sklearn.neighbors.kdtree#sklearn.neighbors.KDTree.get_tree_stats |
kernel_density(self, X, h, kernel='gaussian', atol=0, rtol=1e-08, breadth_first=True, return_log=False)
Compute the kernel density estimate at points X with the given kernel, using the distance metric specified at tree creation. Parameters
Xarray-like of shape (n_samples, n_features)
An array of points to query... | sklearn.modules.generated.sklearn.neighbors.kdtree#sklearn.neighbors.KDTree.kernel_density |
query(X, k=1, return_distance=True, dualtree=False, breadth_first=False)
query the tree for the k nearest neighbors Parameters
Xarray-like of shape (n_samples, n_features)
An array of points to query
kint, default=1
The number of nearest neighbors to return
return_distancebool, default=True
if True, ret... | sklearn.modules.generated.sklearn.neighbors.kdtree#sklearn.neighbors.KDTree.query |
query_radius(X, r, return_distance=False, count_only=False, sort_results=False)
query the tree for neighbors within a radius r Parameters
Xarray-like of shape (n_samples, n_features)
An array of points to query
rdistance within which neighbors are returned
r can be a single value, or an array of values of s... | sklearn.modules.generated.sklearn.neighbors.kdtree#sklearn.neighbors.KDTree.query_radius |
reset_n_calls(self)
Reset number of calls to 0. | sklearn.modules.generated.sklearn.neighbors.kdtree#sklearn.neighbors.KDTree.reset_n_calls |
two_point_correlation(X, r, dualtree=False)
Compute the two-point correlation function Parameters
Xarray-like of shape (n_samples, n_features)
An array of points to query. Last dimension should match dimension of training data.
rarray-like
A one-dimensional array of distances
dualtreebool, default=False
... | sklearn.modules.generated.sklearn.neighbors.kdtree#sklearn.neighbors.KDTree.two_point_correlation |
class sklearn.neighbors.KernelDensity(*, bandwidth=1.0, algorithm='auto', kernel='gaussian', metric='euclidean', atol=0, rtol=0, breadth_first=True, leaf_size=40, metric_params=None) [source]
Kernel Density Estimation. Read more in the User Guide. Parameters
bandwidthfloat, default=1.0
The bandwidth of the kern... | sklearn.modules.generated.sklearn.neighbors.kerneldensity#sklearn.neighbors.KernelDensity |
sklearn.neighbors.KernelDensity
class sklearn.neighbors.KernelDensity(*, bandwidth=1.0, algorithm='auto', kernel='gaussian', metric='euclidean', atol=0, rtol=0, breadth_first=True, leaf_size=40, metric_params=None) [source]
Kernel Density Estimation. Read more in the User Guide. Parameters
bandwidthfloat, defau... | sklearn.modules.generated.sklearn.neighbors.kerneldensity |
fit(X, y=None, sample_weight=None) [source]
Fit the Kernel Density model on the data. Parameters
Xarray-like of shape (n_samples, n_features)
List of n_features-dimensional data points. Each row corresponds to a single data point.
yNone
Ignored. This parameter exists only for compatibility with Pipeline.
... | sklearn.modules.generated.sklearn.neighbors.kerneldensity#sklearn.neighbors.KernelDensity.fit |
get_params(deep=True) [source]
Get parameters for this estimator. Parameters
deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns
paramsdict
Parameter names mapped to their values. | sklearn.modules.generated.sklearn.neighbors.kerneldensity#sklearn.neighbors.KernelDensity.get_params |
sample(n_samples=1, random_state=None) [source]
Generate random samples from the model. Currently, this is implemented only for gaussian and tophat kernels. Parameters
n_samplesint, default=1
Number of samples to generate.
random_stateint, RandomState instance or None, default=None
Determines random number ... | sklearn.modules.generated.sklearn.neighbors.kerneldensity#sklearn.neighbors.KernelDensity.sample |
score(X, y=None) [source]
Compute the total log probability density under the model. Parameters
Xarray-like of shape (n_samples, n_features)
List of n_features-dimensional data points. Each row corresponds to a single data point.
yNone
Ignored. This parameter exists only for compatibility with Pipeline. ... | sklearn.modules.generated.sklearn.neighbors.kerneldensity#sklearn.neighbors.KernelDensity.score |
score_samples(X) [source]
Evaluate the log density model on the data. Parameters
Xarray-like of shape (n_samples, n_features)
An array of points to query. Last dimension should match dimension of training data (n_features). Returns
densityndarray of shape (n_samples,)
The array of log(density) evaluatio... | sklearn.modules.generated.sklearn.neighbors.kerneldensity#sklearn.neighbors.KernelDensity.score_samples |
set_params(**params) [source]
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object. Parameters
**paramsdict
Es... | sklearn.modules.generated.sklearn.neighbors.kerneldensity#sklearn.neighbors.KernelDensity.set_params |
class sklearn.neighbors.KNeighborsClassifier(n_neighbors=5, *, weights='uniform', algorithm='auto', leaf_size=30, p=2, metric='minkowski', metric_params=None, n_jobs=None, **kwargs) [source]
Classifier implementing the k-nearest neighbors vote. Read more in the User Guide. Parameters
n_neighborsint, default=5
N... | sklearn.modules.generated.sklearn.neighbors.kneighborsclassifier#sklearn.neighbors.KNeighborsClassifier |
sklearn.neighbors.KNeighborsClassifier
class sklearn.neighbors.KNeighborsClassifier(n_neighbors=5, *, weights='uniform', algorithm='auto', leaf_size=30, p=2, metric='minkowski', metric_params=None, n_jobs=None, **kwargs) [source]
Classifier implementing the k-nearest neighbors vote. Read more in the User Guide. Pa... | sklearn.modules.generated.sklearn.neighbors.kneighborsclassifier |
fit(X, y) [source]
Fit the k-nearest 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 v... | sklearn.modules.generated.sklearn.neighbors.kneighborsclassifier#sklearn.neighbors.KNeighborsClassifier.fit |
get_params(deep=True) [source]
Get parameters for this estimator. Parameters
deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns
paramsdict
Parameter names mapped to their values. | sklearn.modules.generated.sklearn.neighbors.kneighborsclassifier#sklearn.neighbors.KNeighborsClassifier.get_params |
kneighbors(X=None, n_neighbors=None, return_distance=True) [source]
Finds the K-neighbors of a point. Returns indices of and distances to the neighbors of each point. Parameters
Xarray-like, shape (n_queries, n_features), or (n_queries, n_indexed) if metric == ‘precomputed’, default=None
The query point or poin... | sklearn.modules.generated.sklearn.neighbors.kneighborsclassifier#sklearn.neighbors.KNeighborsClassifier.kneighbors |
kneighbors_graph(X=None, n_neighbors=None, mode='connectivity') [source]
Computes the (weighted) graph of k-Neighbors for points in X Parameters
Xarray-like of shape (n_queries, n_features), or (n_queries, n_indexed) if metric == ‘precomputed’, default=None
The query point or points. If not provided, neighbors ... | sklearn.modules.generated.sklearn.neighbors.kneighborsclassifier#sklearn.neighbors.KNeighborsClassifier.kneighbors_graph |
predict(X) [source]
Predict the class labels 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)
Class labels for each data sample. | sklearn.modules.generated.sklearn.neighbors.kneighborsclassifier#sklearn.neighbors.KNeighborsClassifier.predict |
predict_proba(X) [source]
Return probability estimates for the test data X. Parameters
Xarray-like of shape (n_queries, n_features), or (n_queries, n_indexed) if metric == ‘precomputed’
Test samples. Returns
pndarray of shape (n_queries, n_classes), or a list of n_outputs
of such arrays if n_outputs > 1... | sklearn.modules.generated.sklearn.neighbors.kneighborsclassifier#sklearn.neighbors.KNeighborsClassifier.predict_proba |
score(X, y, sample_weight=None) [source]
Return the mean accuracy on the given test data and labels. In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted. Parameters
Xarray-like of shape (n_samples, n_featur... | sklearn.modules.generated.sklearn.neighbors.kneighborsclassifier#sklearn.neighbors.KNeighborsClassifier.score |
set_params(**params) [source]
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object. Parameters
**paramsdict
Es... | sklearn.modules.generated.sklearn.neighbors.kneighborsclassifier#sklearn.neighbors.KNeighborsClassifier.set_params |
class sklearn.neighbors.KNeighborsRegressor(n_neighbors=5, *, weights='uniform', algorithm='auto', leaf_size=30, p=2, metric='minkowski', metric_params=None, n_jobs=None, **kwargs) [source]
Regression based on k-nearest neighbors. The target is predicted by local interpolation of the targets associated of the nearest... | sklearn.modules.generated.sklearn.neighbors.kneighborsregressor#sklearn.neighbors.KNeighborsRegressor |
sklearn.neighbors.KNeighborsRegressor
class sklearn.neighbors.KNeighborsRegressor(n_neighbors=5, *, weights='uniform', algorithm='auto', leaf_size=30, p=2, metric='minkowski', metric_params=None, n_jobs=None, **kwargs) [source]
Regression based on k-nearest neighbors. The target is predicted by local interpolation ... | sklearn.modules.generated.sklearn.neighbors.kneighborsregressor |
fit(X, y) [source]
Fit the k-nearest 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 va... | sklearn.modules.generated.sklearn.neighbors.kneighborsregressor#sklearn.neighbors.KNeighborsRegressor.fit |
get_params(deep=True) [source]
Get parameters for this estimator. Parameters
deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns
paramsdict
Parameter names mapped to their values. | sklearn.modules.generated.sklearn.neighbors.kneighborsregressor#sklearn.neighbors.KNeighborsRegressor.get_params |
kneighbors(X=None, n_neighbors=None, return_distance=True) [source]
Finds the K-neighbors of a point. Returns indices of and distances to the neighbors of each point. Parameters
Xarray-like, shape (n_queries, n_features), or (n_queries, n_indexed) if metric == ‘precomputed’, default=None
The query point or poin... | sklearn.modules.generated.sklearn.neighbors.kneighborsregressor#sklearn.neighbors.KNeighborsRegressor.kneighbors |
kneighbors_graph(X=None, n_neighbors=None, mode='connectivity') [source]
Computes the (weighted) graph of k-Neighbors for points in X Parameters
Xarray-like of shape (n_queries, n_features), or (n_queries, n_indexed) if metric == ‘precomputed’, default=None
The query point or points. If not provided, neighbors ... | sklearn.modules.generated.sklearn.neighbors.kneighborsregressor#sklearn.neighbors.KNeighborsRegressor.kneighbors_graph |
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=int
Target values. | sklearn.modules.generated.sklearn.neighbors.kneighborsregressor#sklearn.neighbors.KNeighborsRegressor.predict |
score(X, y, sample_weight=None) [source]
Return the coefficient of determination \(R^2\) of the prediction. The coefficient \(R^2\) is defined as \((1 - \frac{u}{v})\), where \(u\) is the residual sum of squares ((y_true - y_pred)
** 2).sum() and \(v\) is the total sum of squares ((y_true -
y_true.mean()) ** 2).sum()... | sklearn.modules.generated.sklearn.neighbors.kneighborsregressor#sklearn.neighbors.KNeighborsRegressor.score |
set_params(**params) [source]
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object. Parameters
**paramsdict
Es... | sklearn.modules.generated.sklearn.neighbors.kneighborsregressor#sklearn.neighbors.KNeighborsRegressor.set_params |
class sklearn.neighbors.KNeighborsTransformer(*, mode='distance', n_neighbors=5, algorithm='auto', leaf_size=30, metric='minkowski', p=2, metric_params=None, n_jobs=1) [source]
Transform X into a (weighted) graph of k nearest neighbors The transformed data is a sparse graph as returned by kneighbors_graph. Read more ... | sklearn.modules.generated.sklearn.neighbors.kneighborstransformer#sklearn.neighbors.KNeighborsTransformer |
sklearn.neighbors.KNeighborsTransformer
class sklearn.neighbors.KNeighborsTransformer(*, mode='distance', n_neighbors=5, algorithm='auto', leaf_size=30, metric='minkowski', p=2, metric_params=None, n_jobs=1) [source]
Transform X into a (weighted) graph of k nearest neighbors The transformed data is a sparse graph a... | sklearn.modules.generated.sklearn.neighbors.kneighborstransformer |
fit(X, y=None) [source]
Fit the k-nearest 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
selfKNeighborsTransformer
The fitted k-nearest neighbors transforme... | sklearn.modules.generated.sklearn.neighbors.kneighborstransformer#sklearn.neighbors.KNeighborsTransformer.fit |
fit_transform(X, y=None) [source]
Fit to data, then transform it. Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X. Parameters
Xarray-like of shape (n_samples, n_features)
Training set.
yignored
Returns
Xtsparse matrix of shape (n_samples, n_samples)... | sklearn.modules.generated.sklearn.neighbors.kneighborstransformer#sklearn.neighbors.KNeighborsTransformer.fit_transform |
get_params(deep=True) [source]
Get parameters for this estimator. Parameters
deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns
paramsdict
Parameter names mapped to their values. | sklearn.modules.generated.sklearn.neighbors.kneighborstransformer#sklearn.neighbors.KNeighborsTransformer.get_params |
kneighbors(X=None, n_neighbors=None, return_distance=True) [source]
Finds the K-neighbors of a point. Returns indices of and distances to the neighbors of each point. Parameters
Xarray-like, shape (n_queries, n_features), or (n_queries, n_indexed) if metric == ‘precomputed’, default=None
The query point or poin... | sklearn.modules.generated.sklearn.neighbors.kneighborstransformer#sklearn.neighbors.KNeighborsTransformer.kneighbors |
kneighbors_graph(X=None, n_neighbors=None, mode='connectivity') [source]
Computes the (weighted) graph of k-Neighbors for points in X Parameters
Xarray-like of shape (n_queries, n_features), or (n_queries, n_indexed) if metric == ‘precomputed’, default=None
The query point or points. If not provided, neighbors ... | sklearn.modules.generated.sklearn.neighbors.kneighborstransformer#sklearn.neighbors.KNeighborsTransformer.kneighbors_graph |
set_params(**params) [source]
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object. Parameters
**paramsdict
Es... | sklearn.modules.generated.sklearn.neighbors.kneighborstransformer#sklearn.neighbors.KNeighborsTransformer.set_params |
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 nei... | sklearn.modules.generated.sklearn.neighbors.kneighborstransformer#sklearn.neighbors.KNeighborsTransformer.transform |
sklearn.neighbors.kneighbors_graph(X, n_neighbors, *, mode='connectivity', metric='minkowski', p=2, metric_params=None, include_self=False, n_jobs=None) [source]
Computes the (weighted) graph of k-Neighbors for points in X Read more in the User Guide. Parameters
Xarray-like of shape (n_samples, n_features) or Bal... | sklearn.modules.generated.sklearn.neighbors.kneighbors_graph#sklearn.neighbors.kneighbors_graph |
class sklearn.neighbors.LocalOutlierFactor(n_neighbors=20, *, algorithm='auto', leaf_size=30, metric='minkowski', p=2, metric_params=None, contamination='auto', novelty=False, n_jobs=None) [source]
Unsupervised Outlier Detection using Local Outlier Factor (LOF) The anomaly score of each sample is called Local Outlier... | sklearn.modules.generated.sklearn.neighbors.localoutlierfactor#sklearn.neighbors.LocalOutlierFactor |
sklearn.neighbors.LocalOutlierFactor
class sklearn.neighbors.LocalOutlierFactor(n_neighbors=20, *, algorithm='auto', leaf_size=30, metric='minkowski', p=2, metric_params=None, contamination='auto', novelty=False, n_jobs=None) [source]
Unsupervised Outlier Detection using Local Outlier Factor (LOF) The anomaly score... | sklearn.modules.generated.sklearn.neighbors.localoutlierfactor |
property decision_function
Shifted opposite of the Local Outlier Factor of X. Bigger is better, i.e. large values correspond to inliers. Only available for novelty detection (when novelty is set to True). The shift offset allows a zero threshold for being an outlier. The argument X is supposed to contain new data: if... | sklearn.modules.generated.sklearn.neighbors.localoutlierfactor#sklearn.neighbors.LocalOutlierFactor.decision_function |
fit(X, y=None) [source]
Fit the local outlier factor detector 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.
yIgnored
Not used, present for API consistency by convention. Returns
selfL... | sklearn.modules.generated.sklearn.neighbors.localoutlierfactor#sklearn.neighbors.LocalOutlierFactor.fit |
property fit_predict
Fits the model to the training set X and returns the labels. Not available for novelty detection (when novelty is set to True). Label is 1 for an inlier and -1 for an outlier according to the LOF score and the contamination parameter. Parameters
Xarray-like of shape (n_samples, n_features), d... | sklearn.modules.generated.sklearn.neighbors.localoutlierfactor#sklearn.neighbors.LocalOutlierFactor.fit_predict |
get_params(deep=True) [source]
Get parameters for this estimator. Parameters
deepbool, default=True
If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns
paramsdict
Parameter names mapped to their values. | sklearn.modules.generated.sklearn.neighbors.localoutlierfactor#sklearn.neighbors.LocalOutlierFactor.get_params |
kneighbors(X=None, n_neighbors=None, return_distance=True) [source]
Finds the K-neighbors of a point. Returns indices of and distances to the neighbors of each point. Parameters
Xarray-like, shape (n_queries, n_features), or (n_queries, n_indexed) if metric == ‘precomputed’, default=None
The query point or poin... | sklearn.modules.generated.sklearn.neighbors.localoutlierfactor#sklearn.neighbors.LocalOutlierFactor.kneighbors |
kneighbors_graph(X=None, n_neighbors=None, mode='connectivity') [source]
Computes the (weighted) graph of k-Neighbors for points in X Parameters
Xarray-like of shape (n_queries, n_features), or (n_queries, n_indexed) if metric == ‘precomputed’, default=None
The query point or points. If not provided, neighbors ... | sklearn.modules.generated.sklearn.neighbors.localoutlierfactor#sklearn.neighbors.LocalOutlierFactor.kneighbors_graph |
property predict
Predict the labels (1 inlier, -1 outlier) of X according to LOF. Only available for novelty detection (when novelty is set to True). This method allows to generalize prediction to new observations (not in the training set). Parameters
Xarray-like of shape (n_samples, n_features)
The query sampl... | sklearn.modules.generated.sklearn.neighbors.localoutlierfactor#sklearn.neighbors.LocalOutlierFactor.predict |
property score_samples
Opposite of the Local Outlier Factor of X. It is the opposite as bigger is better, i.e. large values correspond to inliers. Only available for novelty detection (when novelty is set to True). The argument X is supposed to contain new data: if X contains a point from training, it considers the l... | sklearn.modules.generated.sklearn.neighbors.localoutlierfactor#sklearn.neighbors.LocalOutlierFactor.score_samples |
set_params(**params) [source]
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object. Parameters
**paramsdict
Es... | sklearn.modules.generated.sklearn.neighbors.localoutlierfactor#sklearn.neighbors.LocalOutlierFactor.set_params |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.