class miml.classifier.mi.miles_classifier.MILESClassifier(sigma2=20.25)#

Bases: object

Mapping bags to an instance based feature space, from paper

Attributes#

classifier

Classifier used from mil library

model

Model to use

mapping

Mapping to be used

sigma2float

Parameter of the classifier

References#

MILES: Multiple-Instance Learning via Embedded Instance Selection (Chen et al.) http://infolab.stanford.edu/~wangz/project/imsearch/SVM/PAMI06/chen.pdf

fit(x_train: array, y_train: array) 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: ndarray) 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

Parameters#

xnp.ndarray of shape (n_instances, n_features)

Probabilities of data of being a positive label.

Returns#

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

Predicted probabilities for given data