pystruct.learners.
NSlackSSVM
(model, max_iter=100, C=1.0, check_constraints=True, verbose=0, negativity_constraint=None, n_jobs=1, break_on_bad=False, show_loss_every=0, batch_size=100, tol=0.001, inactive_threshold=1e-05, inactive_window=50, logger=None, switch_to=None)[source]¶Structured SVM solver for the n-slack QP with l1 slack penalty.
Implements margin rescaled structural SVM using the n-slack formulation and cutting plane method, solved using CVXOPT. The optimization is restarted in each iteration.
Parameters: | model : StructuredModel
max_iter : int
C : float
check_constraints : bool (default=True)
verbose : int (default=0)
negativity_constraint: list of ints :
break_on_bad: bool (default=False) :
n_jobs : int, default=1
show_loss_every : int, default=0
batch_size : int, default=100
tol : float, default=-10
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
Altun, Yasemin and Singer, Yoram: Large margin methods for structured and interdependent output variables, JMLR 2006
Cutting-plane training of structural SVMs, JMLR 2009
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=100, C=1.0, check_constraints=True, verbose=0, negativity_constraint=None, n_jobs=1, break_on_bad=False, show_loss_every=0, batch_size=100, tol=0.001, inactive_threshold=1e-05, inactive_window=50, logger=None, switch_to=None)[source]¶fit
(X, Y, constraints=None, warm_start=None, initialize=True)[source]¶Learn parameters using cutting plane method.
Parameters: | X : iterable
Y : iterable
contraints : iterable
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 : |
---|