Adding custom analyzers

To add support for new ML library or new types of data, you need to implement a hook for analyzer and the type it produces.

Model support

For models, you need to implement BindingModelHook, ModelWrapper and ModelIO. BindingModelHook should check an object if it is the object that you want to add support for (for example, check it’s base module to be the library you providing support for). Result of _wrapper_factory() must be an instance of ModelWrapper implementation you provided. We recommend to mixin TypeHookMixin to simplify hook implementation. Even if it’s not possible please provide valid_types value anyway. In ModelWrapper you must implement _exposed_methods_mapping() method and constructor which creates corresponding ModelIO subclass instance. In ModelIO you must implement dump() and load() methods.

Data type support

For data types, you need to implement DatasetHook and DatasetType. DatasetHook should check an object if it is the object that you want to add support for (for example, check it’s base module to be the library you providing support for). Result of process() must be an instance of DatasetType implementation you provided. In DatasetType you must implement methods serialize(), deserialize() and get_spec().

Tips

If you want better understating of what is going on, check some of the extensions, for example lightgbm provides these implementations for both model and data type.

Also, check out analyzer for some convenient mixins.