niml.model.nisclassifier package¶
Submodules¶
niml.model.nisclassifier.classifier module¶
- class niml.model.nisclassifier.classifier.Classifier(cls_state=None, sdr_width=None, subclass_thresh=None, unknown_thresh=None, min_overlap=None)¶
Processes oSDR data to create classification signatures during fit, and performs predictions during evaluate and predict. The evaluate method will return a dictionary of scikit-learn metrics while predict returns a list of classifications for each oSDR
- Parameters
sdr_width (integer) – the largest symbol an SDR might contain+1, typically the number of neurons in the pooler.
subclass_thresh (float) – A value that directs the model when to create a new subclass during fit. Anything below the threshold will cause the creation of a new subclass
unknown_thresh (float) – A value that indicates when the model needs to create a new subclass during continuous learning. Anything below the threshold will cause the creation of a new subclass (only applies when learning is on)
min_overlap (float) – A value that represents the minimum percentage of overlap between an output SDR and subclass signature to determine if the item represented by the output SDR should be considered a member of the subclass
- fit(data, labels)¶
Train the classifier using the provided data and labels
- Parameters
data (list) – oSDR data generated from a pooler process
labels (list) – Observation ground-truth labels
- Returns
True if a valid classifier exists and we were able to process the
training data. False otherwise.
- predict(sdrs)¶
Generates a list of top-level classification labels for the oSDR sets passed in by passing them to predict_subclass and slicing off the label from each tuple provided from that function.
- Parameters
sdrs (list) – oSDRs against which to make predictions
- Return type
List (possibly empty) of predicted labels for each SDR
- save_classifier(output_file=None)¶
Provides a means for saving the current state of the classifier
- Parameters
output_file (string) – file name string
- Returns
True if a valid classifier exists and we were able to save the
configuration to the specified file. False otherwise.