lale.lib.sklearn.linear_svc module¶
- class lale.lib.sklearn.linear_svc.LinearSVC(*, penalty='l2', loss='squared_hinge', dual=True, tol=0.0001, C=1.0, multi_class='ovr', fit_intercept=True, intercept_scaling=1.0, class_weight=None, verbose=0, random_state=None, max_iter=1000)¶
Bases:
PlannedIndividualOp
Linear Support Vector Classification from scikit-learn.
This documentation is auto-generated from JSON schemas.
- Parameters
penalty (‘l1’ or ‘l2’, default ‘l2’) –
Norm used in the penalization.
See also constraint-1, constraint-2, constraint-3.
loss (‘hinge’ or ‘squared_hinge’, default ‘squared_hinge’) –
Loss function.
See also constraint-1, constraint-2, constraint-3.
dual (union type, default True) –
Select the algorithm to either solve the dual or primal optimization problem.
boolean
Prefer dual=False when n_samples > n_features.
or ‘auto’
Choose the value of the parameter automatically, based on the values of n_samples, n_features, loss, multi_class and penalty. If n_samples < n_features and optimizer supports chosen loss, multi_class and penalty, then dual will be set to True, otherwise it will be set to False.
See also constraint-2, constraint-3.
tol (float, >0.0, <=0.01 for optimizer, default 0.0001) – Tolerance for stopping criteria.
C (float, >0.0, >=0.03125 for optimizer, <=32768 for optimizer, loguniform distribution, default 1.0) – Penalty parameter C of the error term.
multi_class (‘ovr’ or ‘crammer_singer’, default ‘ovr’) –
Determines the multi-class strategy if y contains more than two classes.
See also constraint-1, constraint-2, constraint-3.
fit_intercept (boolean, default True) – Whether to calculate the intercept for this model.
intercept_scaling (float, >0.0, <=1.0 for optimizer, not for optimizer, default 1.0) – Append a constant feature with constant value intercept_scaling to the instance vector.
class_weight (union type, not for optimizer, default None) –
None
By default, all classes have weight 1.
or ‘balanced’
Adjust weights by inverse frequency.
or dict, not for optimizer
Dictionary mapping class labels to weights.
verbose (integer, not for optimizer, default 0) – Enable verbose output.
random_state (union type, not for optimizer, default None) –
Seed of pseudo-random number generator.
numpy.random.RandomState
or None
RandomState used by np.random
or integer
Explicit seed.
max_iter (integer, >=1, >=10 for optimizer, <=1000 for optimizer, not for optimizer, default 1000) – The maximum number of iterations to be run.
Notes
constraint-1 : union type
The combination of penalty=`l1` and loss=`hinge` is not supported. If multi_class=’crammer_singer’, the options loss, penalty and dual will be ignored.
penalty : ‘l2’
or loss : ‘squared_hinge’
or multi_class : ‘crammer_singer’
constraint-2 : union type
The combination of penalty=`l2` and loss=`hinge` is not supported when dual=False. If multi_class=’crammer_singer’, the options loss, penalty and dual will be ignored.
penalty : ‘l1’
or loss : ‘squared_hinge’
or dual : True
or multi_class : ‘crammer_singer’
constraint-3 : union type
The combination of penalty=`l1` and loss=`squared_hinge` is not supported when dual=True. If multi_class=’crammer_singer’, the options loss, penalty and dual will be ignored.
penalty : ‘l2’
or loss : ‘hinge’
or dual : False
or multi_class : ‘crammer_singer’
- 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) –
The outer array is over samples aka rows.
items : array of items : float
The inner array is over features aka columns.
- Returns
result – Confidence scores for samples for each class in the model.
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) –
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 predicted classes.
array of items : float
or array of items : string
or array of items : boolean
sample_weight (union type, optional) –
Sample weights.
array of items : float
or None
Samples are equally weighted.
- 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, optional) –
The outer array is over samples aka rows.
items : array of items : float
The inner array is over features aka columns.
- Returns
result – Predict class labels for samples in X.
array of items : float
or array of items : string
or array of items : boolean
- Return type
union type