idq.classifiers

We support several types of classifiers within this object oriented architecture. In particular, the idq.classifiers.SupervisedClassifier and idq.classifiers.IncrementalSupervisedClassifier objects declare the API for how classifiers intereact with the outside world.

This specification will be followed within idq-timeseries, idq-train, idq-evaluate, and idq-calibrate, meaning that new algorithms can be stood up quickly by following this API. Note, actual inheritence from the parent classes is recommended, but may not be required.

Class Architecture

We support 2 types of supervised classification schemes, each encapsulated in a single object

These objects are conceptually similar and generally follow the same API with the single exception in how they (re)train their internal models. idq.classifiers.SupervisedClassifier and its children train through a batch prescription; that is they re-train by starting from scratch and analyzing a large batch of data. This means that if any historical information is to be retained through the re-trainig process, that data must be included in the set passed to the idq.classifiers.SupervisedClassifier.train() call.

In contrast, idq.classifiers.IncrementalSupervisedClassifier and its children train incrementally. This means that the data passed through the call to idq.classifiers.IncrementalSupervisedClassifier.train() is added to the previously used data in some sense. The incremental scheme should be computationally lighter, particularly when we retrain continuously, and better matches the streaming nature of the overall architecture.

We note that idq.classifiers.IncrementalSupervisedClassifier is a subclass of idq.classifiers.SupervisedClassifier and therefore re-uses a lot of the code define therein. This also means the API is specified within idq.classifiers.SupervisedClassifier, with a few exceptions (see idq.classifiers.OVL for an example).

Attribute and Method Inheritance

Describe the following attributes and the rationale for their inheritance behavior

  • __flavor

  • _required_kwargs

  • _model

  • _calibration_map

  • kwargs

Describe the following methods and their inheritance logic

  • get_flavor

  • get_model

  • set_model

  • get_calibration_map

  • set_calibration_map

  • calibrate

  • train

  • evaluate

  • timeseries

  • featureImportance

Note: this logic is also described within the idq.classifiers.SupervisedClassifier docstring.

Exceptions

We define idq.classifiers.UntrainedError and idq.classifiers.UncalibratedError to handle use cases where idq.classifiers.SupervisedClassifier objects have not been trained or calibrated, respectively. These are raised if you attempt to do something that requires the object to have been trained or calibrated. Hopefully, this will make the Traceback more informative.