Finit classifier is a module that implement classification on finite sets.
- class finit_classifier.FinitClassifier(unseen=False)¶
General class of final classification.
- fit(y, z)¶
Find a function that maximizes balanced accuray.
- Parameters:
y (numpy.array) – Features of the training set.
z (numpy.array) – Labels of the training set.
- Returns:
None.
- Return type:
None
- is_seen(y)¶
Check if data has been seen during training.
- Parameters:
y (numpy.array) – Features to try.
- Returns:
List of boolean indicatin if each data point has been seen.
- Return type:
list(bool)
- predict(y)¶
Return predicted label of the input data.
- Parameters:
y (numpy.array) – Features used to predict the labels.
- Returns:
List of labels.
- Return type:
numpy.array
- class finit_classifier.index¶
Index a finit set.
- build_index(E)¶
Build an index for each element of E.
- Parameters:
E (numpy.array) – List to be indexed.
- Returns:
None.
- Return type:
None
- inv(n)¶
Return element of E of index n.
- Parameters:
n (int) – Index of an element.
- Returns:
Element of E matching index n.
- Return type:
Same type as the elements of E.
- class finit_classifier.indexFunction¶
Transform functions on indexes to functions on elements using two index classes.
- build_index(phi, psi)¶
Build an index transformation using one index class for E and one for F.
- Parameters:
phi (finit_classifier.index) – An index for E.
psi – An index for F.
- Returns:
None.
- Return type:
None
- inv(g, e)¶
Transform a function on indexes to a function on elements.
- Parameters:
g (function:int->int) – Function on the indexes.
e (Same as elements of E) – Element to aplied the transformed function to.
- Returns:
Elements matching the index g applied to the index matching e.
- Return type:
Same as elements of E
- class finit_classifier.optimalBA¶
Finit classification to maximize balanced accuracy on indexes.
- fit(x, y)¶
Find a function that maximizes balanced accuray.
- Parameters:
x (numpy.array[int]) – Feature of the training set.
y (numpy.array[int]) – Labels of the training set.
- Returns:
None.
- Return type:
None
- predict(x)¶
Return prediction of labels using x.
- Parameters:
x (np.array[int]) – Feature to be classified.
- Returns:
Predicted labels.
- Return type:
np.array[int]