lale.lib.sklearn.k_neighbors_regressor module

class lale.lib.sklearn.k_neighbors_regressor.KNeighborsRegressor(*, n_neighbors=5, weights='uniform', algorithm='auto', leaf_size=30, p=2, metric='minkowski', metric_params=None, n_jobs=None)

Bases: PlannedIndividualOp

K nearest neighbors regressor from scikit-learn.

This documentation is auto-generated from JSON schemas.

Parameters
  • n_neighbors (integer, >=1, <='X/maxItems', <=100 for optimizer, uniform distribution, default 5) – Number of neighbors to use by default for kneighbors queries.

  • weights (‘uniform’ or ‘distance’, default ‘uniform’) – Weight function used in prediction.

  • algorithm (‘ball_tree’, ‘kd_tree’, ‘brute’, or ‘auto’, default ‘auto’) – Algorithm used to compute the nearest neighbors.

  • leaf_size (integer, >=1, <=100 for optimizer, uniform distribution, not for optimizer, default 30) – Leaf size passed to BallTree or KDTree.

  • p (integer, >=1, <=3 for optimizer, uniform distribution, default 2) – Power parameter for the Minkowski metric.

  • metric (union type, default 'minkowski') –

    The distance metric to use for the tree.

    • ’cityblock’, ‘cosine’, ‘euclidean’, ‘haversine’, ‘l1’, ‘l2’, ‘manhattan’, ‘nan_euclidean’, or ‘precomputed’

    • or callable, not for optimizer

      It takes two arrays representing 1D vectors as inputs and must return one value indicating the distance between those vectors. This works for Scipy’s metrics, but is less efficient than passing the metric name as a string.

    • or Any, not for optimizer

      It will be passed directly to the underlying computation routines.

  • metric_params (union type, not for optimizer, default None) –

    Additional keyword arguments for the metric function.

    • None

    • or dict

  • n_jobs (union type, not for optimizer, default None) –

    Number of parallel jobs to run for the neighbor search.

    • None

      1 unless in joblib.parallel_backend context.

    • or -1

      Use all processors.

    • or integer, >=1

      Number of CPU cores.

fit(X, y=None, **fit_params)

Train the operator.

Note: The fit method is not available until this operator is trainable.

Once this method is available, it will have the following signature:

Parameters
  • X (array of items : array of items : float) – Features; the outer array is over samples.

  • y (union type) –

    Target class labels; the array is over samples.

    • array of items : float

    • or array of items : array of items : float

predict(X, **predict_params)

Make predictions.

Note: The predict method is not available until this operator is trained.

Once this method is available, it will have the following signature:

Parameters

X (array of items : array of items : float) – Features; the outer array is over samples.

Returns

result – Returns predicted values.

  • array of items : float

  • or array of items : array of items : float

Return type

union type