package sklearn

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `IsotonicRegression
]
type t = [ `BaseEstimator | `IsotonicRegression | `Object | `RegressorMixin | `TransformerMixin ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val as_transformer : t -> [ `TransformerMixin ] Obj.t
val as_estimator : t -> [ `BaseEstimator ] Obj.t
val as_regressor : t -> [ `RegressorMixin ] Obj.t
val create : ?y_min:float -> ?y_max:float -> ?increasing:[ `Auto | `Bool of bool ] -> ?out_of_bounds:string -> unit -> t

Isotonic regression model.

Read more in the :ref:`User Guide <isotonic>`.

.. versionadded:: 0.13

Parameters ---------- y_min : float, default=None Lower bound on the lowest predicted value (the minimum value may still be higher). If not set, defaults to -inf.

y_max : float, default=None Upper bound on the highest predicted value (the maximum may still be lower). If not set, defaults to +inf.

increasing : bool or 'auto', default=True Determines whether the predictions should be constrained to increase or decrease with `X`. 'auto' will decide based on the Spearman correlation estimate's sign.

out_of_bounds : str, default='nan' The ``out_of_bounds`` parameter handles how `X` values outside of the training domain are handled. When set to 'nan', predictions will be NaN. When set to 'clip', predictions will be set to the value corresponding to the nearest train interval endpoint. When set to 'raise' a `ValueError` is raised.

Attributes ---------- X_min_ : float Minimum value of input array `X_` for left bound.

X_max_ : float Maximum value of input array `X_` for right bound.

f_ : function The stepwise interpolating function that covers the input domain ``X``.

increasing_ : bool Inferred value for ``increasing``.

Notes ----- Ties are broken using the secondary method from Leeuw, 1977.

References ---------- Isotonic Median Regression: A Linear Programming Approach Nilotpal Chakravarti Mathematics of Operations Research Vol. 14, No. 2 (May, 1989), pp. 303-308

Isotone Optimization in R : Pool-Adjacent-Violators Algorithm (PAVA) and Active Set Methods Leeuw, Hornik, Mair Journal of Statistical Software 2009

Correctness of Kruskal's algorithms for monotone regression with ties Leeuw, Psychometrica, 1977

Examples -------- >>> from sklearn.datasets import make_regression >>> from sklearn.isotonic import IsotonicRegression >>> X, y = make_regression(n_samples=10, n_features=1, random_state=41) >>> iso_reg = IsotonicRegression().fit(X.flatten(), y) >>> iso_reg.predict(.1, .2) array(1.8628..., 3.7256...)

val fit : ?sample_weight:[> `ArrayLike ] Np.Obj.t -> x:[> `ArrayLike ] Np.Obj.t -> y:[> `ArrayLike ] Np.Obj.t -> [> tag ] Obj.t -> t

Fit the model using X, y as training data.

Parameters ---------- X : array-like of shape (n_samples,) Training data.

y : array-like of shape (n_samples,) Training target.

sample_weight : array-like of shape (n_samples,), default=None Weights. If set to None, all weights will be set to 1 (equal weights).

Returns ------- self : object Returns an instance of self.

Notes ----- X is stored for future use, as :meth:`transform` needs X to interpolate new input data.

val fit_transform : ?y:[> `ArrayLike ] Np.Obj.t -> ?fit_params:(string * Py.Object.t) list -> x:[> `ArrayLike ] Np.Obj.t -> [> tag ] Obj.t -> [> `ArrayLike ] Np.Obj.t

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 ---------- X : array-like, sparse matrix, dataframe of shape (n_samples, n_features)

y : ndarray of shape (n_samples,), default=None Target values.

**fit_params : dict Additional fit parameters.

Returns ------- X_new : ndarray array of shape (n_samples, n_features_new) Transformed array.

val get_params : ?deep:bool -> [> tag ] Obj.t -> Dict.t

Get parameters for this estimator.

Parameters ---------- deep : bool, default=True If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns ------- params : mapping of string to any Parameter names mapped to their values.

val predict : t:[> `ArrayLike ] Np.Obj.t -> [> tag ] Obj.t -> [> `ArrayLike ] Np.Obj.t

Predict new data by linear interpolation.

Parameters ---------- T : array-like of shape (n_samples,) Data to transform.

Returns ------- y_pred : ndarray of shape (n_samples,) Transformed data.

val score : ?sample_weight:[> `ArrayLike ] Np.Obj.t -> x:[> `ArrayLike ] Np.Obj.t -> y:[> `ArrayLike ] Np.Obj.t -> [> tag ] Obj.t -> float

Return the coefficient of determination R^2 of the prediction.

The coefficient R^2 is defined as (1 - 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(). The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a R^2 score of 0.0.

Parameters ---------- X : array-like of shape (n_samples, n_features) Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead, shape = (n_samples, n_samples_fitted), where n_samples_fitted is the number of samples used in the fitting for the estimator.

y : array-like of shape (n_samples,) or (n_samples, n_outputs) True values for X.

sample_weight : array-like of shape (n_samples,), default=None Sample weights.

Returns ------- score : float R^2 of self.predict(X) wrt. y.

Notes ----- The R2 score used when calling ``score`` on a regressor uses ``multioutput='uniform_average'`` from version 0.23 to keep consistent with default value of :func:`~sklearn.metrics.r2_score`. This influences the ``score`` method of all the multioutput regressors (except for :class:`~sklearn.multioutput.MultiOutputRegressor`).

val set_params : ?params:(string * Py.Object.t) list -> [> tag ] Obj.t -> t

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form ``<component>__<parameter>`` so that it's possible to update each component of a nested object.

Parameters ---------- **params : dict Estimator parameters.

Returns ------- self : object Estimator instance.

val transform : t:[> `ArrayLike ] Np.Obj.t -> [> tag ] Obj.t -> [> `ArrayLike ] Np.Obj.t

Transform new data by linear interpolation

Parameters ---------- T : array-like of shape (n_samples,) Data to transform.

Returns ------- y_pred : ndarray of shape (n_samples,) The transformed data

val x_min_ : t -> float

Attribute X_min_: get value or raise Not_found if None.

val x_min_opt : t -> float option

Attribute X_min_: get value as an option.

val x_max_ : t -> float

Attribute X_max_: get value or raise Not_found if None.

val x_max_opt : t -> float option

Attribute X_max_: get value as an option.

val f_ : t -> Py.Object.t

Attribute f_: get value or raise Not_found if None.

val f_opt : t -> Py.Object.t option

Attribute f_: get value as an option.

val increasing_ : t -> bool

Attribute increasing_: get value or raise Not_found if None.

val increasing_opt : t -> bool option

Attribute increasing_: get value as an option.

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.