lale.lib.snapml.snap_logistic_regression module

class lale.lib.snapml.snap_logistic_regression.SnapLogisticRegression(*, max_iter=100, regularizer=1.0, use_gpu=False, device_ids=None, class_weight=None, dual=True, verbose=False, n_jobs=1, penalty='l2', tol=0.001, generate_training_history=None, privacy=False, eta=0.3, batch_size=100, privacy_epsilon=10.0, grad_clip=1.0, fit_intercept=True, intercept_scaling=1.0, normalize=True, kernel='linear', gamma=1.0, n_components=100, random_state=None)

Bases: PlannedIndividualOp

Logistic Regression from Snap ML.

This documentation is auto-generated from JSON schemas.

Parameters
  • max_iter (integer, >=1, >=10 for optimizer, <=1000 for optimizer, optional, default 100) – Maximum number of iterations used by the solver to converge.

  • regularizer (float, >0.0, >=1.0 for optimizer, <=100.0 for optimizer, uniform distribution, optional, default 1.0) – Larger regularization values imply stronger regularization.

  • use_gpu (boolean, optional, not for optimizer, default False) – Use GPU Acceleration.

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

    Device IDs of the GPUs which will be used when GPU acceleration is enabled.

    • None

      Use [0].

    • or array of items : integer

  • class_weight (‘balanced’ or None, optional, not for optimizer, default None) – If set to ‘balanced’ samples weights will be applied to account for class imbalance, otherwise no sample weights will be used.

  • dual (boolean, optional, not for optimizer, default True) –

    Use dual formulation (rather than primal).

    See also constraint-1, constraint-2.

  • verbose (boolean, optional, not for optimizer, default False) – If True, it prints the training cost, one per iteration. Warning: this will increase the training time. For performance evaluation, use verbose=False.

  • n_jobs (integer, >=1, optional, not for optimizer, default 1) – The number of threads used for running the training. The value of this parameter should be a multiple of 32 if the training is performed on GPU (use_gpu=True).

  • penalty (‘l1’ or ‘l2’, optional, not for optimizer, default ‘l2’) –

    The regularization / penalty type. Possible values are ‘l2’ for L2 regularization (LogisticRegression) or ‘l1’ for L1 regularization (SparseLogisticRegression). L1 regularization is possible only for the primal optimization problem (dual=False).

    See also constraint-1, constraint-3.

  • tol (float, >0.0, optional, not for optimizer, default 0.001) – The tolerance parameter. Training will finish when maximum change in model coefficients is less than tol.

  • generate_training_history (‘summary’, ‘full’, or None, optional, not for optimizer, default None) – Determines the level of summary statistics that are generated during training.

  • privacy (boolean, optional, not for optimizer, default False) –

    Train the model using a differentially private algorithm.

    See also constraint-2, constraint-3, constraint-4.

  • eta (float, >0.0, optional, not for optimizer, default 0.3) – Learning rate for the differentially private training algorithm.

  • batch_size (integer, >=1, optional, not for optimizer, default 100) – Mini-batch size for the differentially private training algorithm.

  • privacy_epsilon (float, >0.0, optional, not for optimizer, default 10.0) – Target privacy gaurantee. Learned model will be (privacy_epsilon, 0.01)-private.

  • grad_clip (float, >=0.0, optional, not for optimizer, default 1.0) – Gradient clipping parameter for the differentially private training algorithm.

  • fit_intercept (boolean, optional, always print, default True) –

    Add bias term – note, may affect speed of convergence, especially for sparse datasets.

    See also constraint-4.

  • intercept_scaling (float, >0.0, optional, not for optimizer, default 1.0) – Scaling of bias term. The inclusion of a bias term is implemented by appending an additional feature to the dataset. This feature has a constant value, that can be set using this parameter.

  • normalize (boolean, optional, not for optimizer, always print, default True) – Normalize rows of dataset (recommended for fast convergence).

  • kernel (‘rbf’ or ‘linear’, optional, not for optimizer, default ‘linear’) – Approximate feature map of a specified kernel function.

  • gamma (float, >0.0, optional, not for optimizer, default 1.0) – Parameter of RBF kernel: exp(-gamma * x^2).

  • n_components (integer, >=1, optional, not for optimizer, default 100) – Dimensionality of the feature space when approximating a kernel function.

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

    Seed of pseudo-random number generator.

    • None

      RandomState used by np.random

    • or integer

      Explicit seed.

Notes

constraint-1 : union type

L1 regularization is supported only for primal optimization problems.

  • penalty : ‘l2’

  • or dual : False

constraint-2 : union type

Privacy only supported for primal objective functions.

  • privacy : False

  • or dual : False

constraint-3 : union type

Privacy only supported for L2-regularized objective functions.

  • privacy : False

  • or penalty : ‘l2’

constraint-4 : union type

Privacy not supported with fit_intercept=True.

  • privacy : False

  • or fit_intercept : False

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

    The outer array is over samples aka rows.

    • items : array of items : float

      The inner array is over features aka columns.

  • y (union type) –

    The classes.

    • array of items : float

    • or array of items : string

    • or array of items : boolean

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

    The outer array is over samples aka rows.

    • items : array of items : float

      The inner array is over features aka columns.

  • n_jobs (integer, >=0, optional, default 0) – Number of threads used to run inference. By default inference runs with maximum number of available threads.

Returns

result – The predicted classes.

  • array of items : float

  • or array of items : string

  • or array of items : boolean

Return type

union type

predict_proba(X)

Probability estimates for all classes.

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

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

Parameters
  • X (array, optional) –

    The outer array is over samples aka rows.

    • items : array of items : float

      The inner array is over features aka columns.

  • n_jobs (integer, >=0, optional, default 0) – Number of threads used to run inference. By default inference runs with maximum number of available threads.

Returns

result – The outer array is over samples aka rows.

  • items : array of items : float

    The inner array contains probabilities corresponding to each class.

Return type

array