lale.lib.sklearn.perceptron module

class lale.lib.sklearn.perceptron.Perceptron(*, penalty=None, alpha=0.0001, fit_intercept=True, max_iter=1000, tol=0.001, shuffle=True, verbose=0, eta0=1.0, n_jobs=None, random_state=None, early_stopping=False, validation_fraction=0.1, n_iter_no_change=5, class_weight, warm_start=False)

Bases: PlannedIndividualOp

Perceptron classifier from scikit-learn.

This documentation is auto-generated from JSON schemas.

Parameters
  • penalty (‘l2’, ‘l1’, ‘elasticnet’, or None, not for optimizer, default None) – The penalty (aka regularization term) to be used.

  • alpha (float, >=1e-10 for optimizer, <=1.0 for optimizer, loguniform distribution, default 0.0001) – Constant that multiplies the regularization term if regularization is used.

  • fit_intercept (boolean, default True) – Whether the intercept should be estimated or not. If False, the data is assumed to be already centered.

  • max_iter (integer, >=10 for optimizer, <=10000 for optimizer, loguniform distribution, default 1000) – The maximum number of passes over the training data (aka epochs).

  • tol (union type, default 0.001) –

    The stopping criterion

    • float, >=1e-08 for optimizer, <=0.01 for optimizer

      If not None, the iterations will stop when (loss > previous_loss - tol).

    • or None

  • shuffle (boolean, default True) – Whether or not the training data should be shuffled after each epoch.

  • verbose (integer, not for optimizer, default 0) – The verbosity level.

  • eta0 (float, >=0.01 for optimizer, <=1.0 for optimizer, loguniform distribution, default 1.0) – Constant by which the updates are multiplied.

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

    The number of CPUs to use to do the OVA (One Versus All, for multi-class problems) computation.

    • None

      1 unless in joblib.parallel_backend context.

    • or -1

      Use all processors.

    • or integer, >=1

      Number of CPU cores.

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

    If int, random_state is the seed used by the random number generator;

    • integer

    • or numpy.random.RandomState

    • or None

  • early_stopping (boolean, not for optimizer, default False) – Whether to use early stopping to terminate training when validation score is not improving.

  • validation_fraction (float, >=0, <=1, not for optimizer, default 0.1) – The proportion of training data to set aside as validation set for early stopping.

  • n_iter_no_change (integer, not for optimizer, default 5) – Number of iterations with no improvement to wait before early stopping.

  • class_weight (union type, not for optimizer) –

    Weights associated with classes in the form {class_label: weight}.

    • dict

    • or array of items : dict

    • or ‘balanced’ or None

  • warm_start (boolean, not for optimizer, default False) – When set to True, reuse the solution of the previous call to fit as initialization, otherwise, just erase the previous solution.

decision_function(X)

Confidence scores for all classes.

Note: The decision_function 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) –

Returns

result

  • array of items : array of items : float

    In the multi-way case, score per (sample, class) combination.

  • or array of items : float

    In the binary case, score for self._classes[1].

Return type

union type

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) –

  • y (union type) –

    • array of items : string

    • or array of items : float

    • or array of items : boolean

  • coef_init (union type, optional) –

    The initial coefficients to warm-start the optimization.

    • array of items : array of items : float

    • or None

  • intercept_init (union type, optional) –

    The initial intercept to warm-start the optimization.

    • array of items : float

    • or None

  • sample_weight (union type, optional, default None) –

    Weights applied to individual samples.

    • array of items : float

    • or None

      Uniform weights.

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

Incremental fit to train train the operator on a batch of samples.

Note: The partial_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) –

  • y (union type) –

    • array of items : string

    • or array of items : float

    • or array of items : boolean

  • classes (union type, optional) –

    • array of items : string

    • or array of items : float

    • or array of items : boolean

  • sample_weight (union type, optional, default None) –

    Weights applied to individual samples.

    • array of items : float

    • or None

      Uniform weights.

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) –

Returns

result

  • array of items : string

  • or array of items : float

  • or array of items : boolean

Return type

union type