miml.classifier.mi.mi_wrapper_classifier.MIWrapperClassifier

miml.classifier.mi.mi_wrapper_classifier.MIWrapperClassifier#

class miml.classifier.mi.mi_wrapper_classifier.MIWrapperClassifier(base_classifier=DecisionTreeClassifier())#

Bases: object

MIWrapper Classifier.

A simple Wrapper method for applying standard propositional learners to multi-instance data.

Attributes#

base_classifier

Classifier to be used

References#

E. T. Frank, X. Xu (2003). Applying propositional learning algorithms to multi-instance data. Department of Computer Science, University of Waikato, Hamilton, NZ.

fit(x_train: ndarray, y_train: ndarray, weight: int = 2)#

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.

weightint, default = 2
The type of weight setting for each single-instance:

0: weight = 1.0 1: weight = 1.0/Total number of single-instance in the corresponding bag 2: weight = Total number of single-instance / (Total number of bags * Total number of single-instance in the corresponding bag).

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_test: ndarray) ndarray#

Predict probabilities of given data of having a positive label

Parameters#

x_testnp.ndarray of shape (n_bags, n_instances, n_features)

Data to predict probabilities

Returns#

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

Predicted probabilities for given data