evalml.pipelines.components.KNeighborsClassifier¶
-
class
evalml.pipelines.components.
KNeighborsClassifier
(n_neighbors=5, weights='uniform', algorithm='auto', leaf_size=30, p=2, random_seed=0, **kwargs)[source]¶ K-Nearest Neighbors Classifier.
-
name
= 'KNN Classifier'¶
-
model_family
= 'k_neighbors'¶
-
supported_problem_types
= [<ProblemTypes.BINARY: 'binary'>, <ProblemTypes.MULTICLASS: 'multiclass'>, <ProblemTypes.TIME_SERIES_BINARY: 'time series binary'>, <ProblemTypes.TIME_SERIES_MULTICLASS: 'time series multiclass'>]¶
-
hyperparameter_ranges
= {'algorithm': ['auto', 'ball_tree', 'kd_tree', 'brute'], 'leaf_size': Integer(low=10, high=30, prior='uniform', transform='identity'), 'n_neighbors': Integer(low=2, high=12, prior='uniform', transform='identity'), 'p': Integer(low=1, high=5, prior='uniform', transform='identity'), 'weights': ['uniform', 'distance']}¶
-
default_parameters
= {'algorithm': 'auto', 'leaf_size': 30, 'n_neighbors': 5, 'p': 2, 'weights': 'uniform'}¶
-
predict_uses_y
= False¶
Instance attributes
feature_importance
Returns array of 0’s matching the input number of features as feature_importance is not defined for KNN classifiers.
needs_fitting
parameters
Returns the parameters which were used to initialize the component
Methods:
Initialize self.
Constructs a new component with the same parameters and random state.
Describe a component and its parameters
Fits component to data
Loads component at file path
Make predictions using selected features.
Make probability estimates for labels.
Saves component at file path
-