pystruct.learners.
OneSlackSSVM
(model, max_iter=10000, C=1.0, check_constraints=False, verbose=0, negativity_constraint=None, n_jobs=1, break_on_bad=False, show_loss_every=0, tol=0.001, inference_cache=0, inactive_threshold=1e-05, inactive_window=50, logger=None, cache_tol='auto', switch_to=None)[source]¶Structured SVM solver for the 1-slack QP with l1 slack penalty.
Implements margin rescaled structural SVM using the 1-slack formulation and cutting plane method, solved using CVXOPT. The optimization is restarted in each iteration.
Parameters: | model : StructuredModel
max_iter : int, default=10000
C : float, default=1
check_constraints : bool
verbose : int
negativity_constraint : list of ints
break_on_bad : bool default=False
n_jobs : int, default=1
show_loss_every : int, default=0
tol : float, default=1e-3
inference_cache : int, default=0
cache_tol : float, None or ‘auto’ default=’auto’
inactive_threshold : float, default=1e-5
inactive_window : float, default=50
switch_to : None or string, default=None
logger : logger object, default=None
|
---|---|
Attributes: | w : nd-array, shape=(model.size_joint_feature,)
old_solution : dict
``loss_curve_`` : list of float
``objective_curve_`` : list of float
``primal_objective_curve_`` : list of float
``timestamps_`` : list of int
|
References
Methods
fit (X, Y[, constraints, warm_start, initialize]) |
Learn parameters using cutting plane method. |
get_params ([deep]) |
Get parameters for this estimator. |
predict (X) |
Predict output on examples in X. |
prune_constraints (constraints, a) |
|
score (X, Y) |
Compute score as 1 - loss over whole data set. |
set_params (**params) |
Set the parameters of this estimator. |
__init__
(model, max_iter=10000, C=1.0, check_constraints=False, verbose=0, negativity_constraint=None, n_jobs=1, break_on_bad=False, show_loss_every=0, tol=0.001, inference_cache=0, inactive_threshold=1e-05, inactive_window=50, logger=None, cache_tol='auto', switch_to=None)[source]¶fit
(X, Y, constraints=None, warm_start=False, initialize=True)[source]¶Learn parameters using cutting plane method.
Parameters: | X : iterable
Y : iterable
contraints : ignored warm_start : bool, default=False
initialize : boolean, default=True
|
---|
get_params
(deep=True)¶Get parameters for this estimator.
Parameters: | deep: boolean, optional :
|
---|---|
Returns: | params : mapping of string to any
|
predict
(X)¶Predict output on examples in X.
Parameters: | X : iterable
|
---|---|
Returns: | Y_pred : list
|
score
(X, Y)¶Compute score as 1 - loss over whole data set.
Returns the average accuracy (in terms of model.loss) over X and Y.
Parameters: | X : iterable
Y : iterable
|
---|---|
Returns: | score : float
|
set_params
(**params)¶Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as pipelines). The former have parameters of the form
<component>__<parameter>
so that it’s possible to update each
component of a nested object.
Returns: | self : |
---|