pystruct.models.
MultiLabelClf
(n_labels=None, n_features=None, edges=None, inference_method=None)[source]¶Multilabel model for predicting several binary classes.
Multilabel classification is a generalization of multiclass classification, in that multiple classes can be present in each example. This can also be thought of as predicting binary indicator per class.
This class supports different models via the “edges” parameter. Giving no edges yields independent classifiers for each class. Giving “full” yields a fully connected graph over the labels, while “tree” yields the best treeshaped graph (using the ChowLiu algorithm). It is also possible to specify a custom connectivity structure.
Parameters:  n_labels : int (default=None)
n_features : int (default=None)
edges : arraylike, string or None
inference_method : :


Methods
batch_inference (X, w[, relaxed]) 

batch_joint_feature (X, Y[, Y_true]) 

batch_loss (Y, Y_hat) 

batch_loss_augmented_inference (X, Y, w[, ...]) 

continuous_loss (y, y_hat) 

inference (x, w[, relaxed, return_energy]) 
Inference for x using parameters w. 
initialize (X, Y) 

joint_feature (x, y) 

loss (y, y_hat) 

loss_augmented_inference (x, y, w[, relaxed, ...]) 
Lossaugmented Inference for x relative to y using parameters w. 
max_loss (y) 
inference
(x, w, relaxed=False, return_energy=False)¶Inference for x using parameters w.
Finds (approximately) armin_y np.dot(w, joint_feature(x, y)) using self.inference_method.
Parameters:  x : tuple
w : ndarray, shape=(size_joint_feature,)
relaxed : bool, default=False
return_energy : bool, default=False


Returns:  y_pred : ndarray or tuple

loss_augmented_inference
(x, y, w, relaxed=False, return_energy=False)¶Lossaugmented Inference for x relative to y using parameters w.
Finds (approximately) armin_y_hat np.dot(w, joint_feature(x, y_hat)) + loss(y, y_hat) using self.inference_method.
Parameters:  x : tuple
y : ndarray, shape (n_nodes,)
w : ndarray, shape=(size_joint_feature,)
relaxed : bool, default=False
return_energy : bool, default=False


Returns:  y_pred : ndarray or tuple
