package sklearn

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val get_py : string -> Py.Object.t

Get an attribute of this module as a Py.Object.t. This is useful to pass a Python function to another function.

module Bunch : sig ... end
module FeatureUnion : sig ... end
module Pipeline : sig ... end
module Islice : sig ... end
val check_memory : [ `S of string | `Object_with_the_joblib_Memory_interface of Py.Object.t | `None ] -> Py.Object.t

Check that ``memory`` is joblib.Memory-like.

joblib.Memory-like means that ``memory`` can be converted into a joblib.Memory instance (typically a str denoting the ``location``) or has the same interface (has a ``cache`` method).

Parameters ---------- memory : None, str or object with the joblib.Memory interface

Returns ------- memory : object with the joblib.Memory interface

Raises ------ ValueError If ``memory`` is not joblib.Memory-like.

val clone : ?safe:bool -> estimator:[> `BaseEstimator ] Np.Obj.t -> unit -> Py.Object.t

Constructs a new estimator with the same parameters.

Clone does a deep copy of the model in an estimator without actually copying attached data. It yields a new estimator with the same parameters that has not been fit on any data.

Parameters ---------- estimator :

st, tuple, set

}

of estimator objects or estimator object The estimator or group of estimators to be cloned.

safe : bool, default=True If safe is false, clone will fall back to a deep copy on objects that are not estimators.

val delayed : ?check_pickle:Py.Object.t -> function_:Py.Object.t -> unit -> Py.Object.t

Decorator used to capture the arguments of a function.

val if_delegate_has_method : [ `S of string | `StringList of string list ] -> Py.Object.t

Create a decorator for methods that are delegated to a sub-estimator

This enables ducktyping by hasattr returning True according to the sub-estimator.

Parameters ---------- delegate : string, list of strings or tuple of strings Name of the sub-estimator that can be accessed as an attribute of the base object. If a list or a tuple of names are provided, the first sub-estimator that is an attribute of the base object will be used.

val make_pipeline : ?kwargs:(string * Py.Object.t) list -> [> `BaseEstimator ] Np.Obj.t list -> Pipeline.t

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 ---------- *steps : list of estimators.

memory : str 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.

verbose : bool, default=False If True, the time elapsed while fitting each step will be printed as it is completed.

See Also -------- sklearn.pipeline.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()))

Returns ------- p : Pipeline

val make_union : ?kwargs:(string * Py.Object.t) list -> [> `BaseEstimator ] Np.Obj.t list -> FeatureUnion.t

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 ---------- *transformers : list of estimators

n_jobs : int, default=None Number of jobs to run in parallel. ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context. ``-1`` means using all processors. See :term:`Glossary <n_jobs>` for more details.

.. versionchanged:: v0.20 `n_jobs` default changed from 1 to None

verbose : bool, default=False If True, the time elapsed while fitting each transformer will be printed as it is completed.

Returns ------- f : FeatureUnion

See Also -------- sklearn.pipeline.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()))