class miml.classifier.mi.all_positive_apr_classifier.AllPositiveAPRClassifier#

Bases: object

Classifier for All-Positive Bags using Axis-Aligned Positive Region.

This classifier assigns a positive label to bags that contain instances within a predefined axis-parallel rectangle (APR) defined by the minimum and maximum feature values of positive instances in the training set.

Attributes#

aprlist

List containing the minimum and maximum feature values defining the APR.

References#

Dietterich, Thomas G., Richard H. Lathrop, and Tomás Lozano-Pérez. “Solving the multiple instance problem with axis-parallel rectangles.” Artificial intelligence 89.1 (1997): 31-71.

fit(x_train: ndarray, y_train: ndarray) None#

Fit the classifier to the training data.

Parameters#

x_trainndarray of shape (n_bags, n_instances, n_features)

Features values of bags in the training set.

y_trainndarray (n_bags, n_instances, n_labels)

Labels of bags in the training set.

predict(bag: array) int#

Predict the label of the bag

Parameters#

bag: np.ndarray of shape(n_instances, n_features)

features values of a bag

Returns#

label: int

Predicted label of the bag

predict_proba(x: ndarray)#

Predict probabilities of given data of having a positive label

Parameters#

xnp.ndarray of shape (n_instances, n_features)

Data to predict probabilities

Returns#

results: np.ndarray of shape (n_instances, n_features)

Predicted probabilities for given data