How it Works ============ This package extracts models from `scikit-learn `_ and converts them into classes to be used with `msdss-models-api `_. .. digraph:: methods compound=true; rankdir=TB; graph [nodesep="0.5", ranksep="0.65"]; sklearn[label="scikit-learn" style=filled]; modelsapi[label="msdss-models-api" style=filled]; basemodel[label="msdss_models_api.models.Model" shape=rect]; models[label="msdss_models_sklearn.core.models" shape=rect]; getsklearnmodels[label="msdss_models_sklearn.core.get_sklearn_models" shape=rect style=rounded]; createinputmethod[label="create_input_method" shape=rect style=rounded]; createoutputmethod[label="create_output_method" shape=rect style=rounded]; createupdatemethod[label="create_update_method" shape=rect style=rounded]; subgraph cluster0 { label=< msdss_models_sklearn.tools >; createinputmethod; createoutputmethod; createupdatemethod; } sklearn -> getsklearnmodels -> basemodel; basemodel -> createoutputmethod[lhead=cluster0 ltail=cluster0]; createoutputmethod -> models[lhead=cluster0 ltail=cluster0]; models -> modelsapi; Manually Selected Modules ------------------------- First a list of modules with models are manually selected based on `scikit-learn documentation `_: .. jupyter-execute:: :hide-code: from msdss_models_sklearn.defaults import DEFAULT_MODULES from pprint import pprint pprint(DEFAULT_MODULES) Class Name Filters ------------------ For each module, classes are filtered to meet the following requirements: * First letter of the name is capitalized and not an underscore ``_`` * Class is under the module and not imported from elsewhere Model Conversion ---------------- The filtered classes are considered scikit-learn models and are converted to ``msdss-models-api`` compatible models by: * Creating a dynamic class, extending from :class:`msdss_models_api:msdss_models_api.models.Model` * Adding compatible methods to the dynamic class: * ``input`` using :func:`msdss_models_sklearn.tools.create_input_method` * ``output`` using :func:`msdss_models_sklearn.tools.create_output_method` * ``update`` using :func:`msdss_models_sklearn.tools.create_update_method` Model Results ------------- The result is a dictionary of ``msdss-models-api`` compatible models ready to be used with the API: .. jupyter-execute:: :hide-code: from msdss_models_sklearn import models as sklearn_models from pprint import pprint pprint(sklearn_models) See :func:`msdss_models_sklearn.core.get_sklearn_models` for more details.