Skip to main content

Microkernel Architecture for Machine Learning

Project description

mkml

mkml implements a Microkernel Architecture for Machine Learning Library

try it out

  • Install from PyPi
pip install mkml
  • By default, 3 Plug-in modules have been loaded
MKMLMetaclass.register('standardization', StandardizationPlugin)
MKMLMetaclass.register('monitoring', MonitoringPlugin)
MKMLMetaclass.register('local_datasource', LocalDataSourcePlugin)

StandardizationPlugin enforces the method signatures of the model class. In our case, the model class must have fit, predict and score methods

MonitoringPlugin monitors all the functions of the model class. In our case, it logs the input parameters, exception as well as the duration of each function in the model class

LocalDataSourcePlugin helps loading the data locally. It dynamically ingest data-loading functions into the model class to help data scientist retrieve the data without worrying how to retrieve it

  • Create your own model
from mkml import BaseModel

class UserModel(BaseModel):
    def __init__(self):
        self._model = LinearRegression()

    def fit(self, features, labels):
        self._model.fit(X_train, y_train)

    def predict(self, features):
        self._model.predict(features)

    def score(self, features, labels):
        return self._model.score(features, labels)
  • Instantiate the model class instantnce and load features and labels for training and prediction
um = UserModel()

features = um.get_local_data(feature_mart_location='data', group_id='train_features')
labels = um.get_local_data(feature_mart_location='data', group_id='train_labels')

um.fit(features, labels)

test_features = um.get_local_data(feature_mart_location='data', group_id='test_features')
test_labels = um.predict(test_features)
  • Create and register your own Plug-in Module (ie. Remote DataSource)
from mkml import BasePlugin

class RemoteDataSourcePlugin(BasePlugin):

    def __init__(self, name):
        self._name = name

    def apply(self, attrs, **kwargs):
        logger.debug('Entering data source plugin')
        attrs['get_remote_data'] = self._get_remote_data

    def _get_remote_data(self, feature_mart_location, group_id):
        # To be implemented
        pass


## You can add additional instantiation parameters to the Plug-in class as well	
MKMLMetaclass.register('remote_datasource', RemoteDataSourcePlugin, 'remote_ds_plugin')
  • Use the new Remote DataSource Plug-in to retrieve features and labels
um = UserModel()

features = um.get_remote_data(feature_mart_location='http://fm', group_id='train_features')
labels = um.get_remote_data(feature_mart_location='http://fm', group_id='train_labels')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkml-0.0.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

mkml-0.0.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file mkml-0.0.2.tar.gz.

File metadata

  • Download URL: mkml-0.0.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.1 CPython/3.7.9

File hashes

Hashes for mkml-0.0.2.tar.gz
Algorithm Hash digest
SHA256 0788c316f9336fcb8e2d19e8ad34c65d03b0742098572d37c5ee9a349b4a5eb4
MD5 a5fc943d4e1cfbfb4351e4eb755d6acc
BLAKE2b-256 f31eb7ca0db26fda439a03c2a2d0c16b87bab0ef99c6c8a8931e0a749c01211e

See more details on using hashes here.

File details

Details for the file mkml-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: mkml-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.56.1 CPython/3.7.9

File hashes

Hashes for mkml-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ab9c2189d9850004cd6be063bc74840b9579543cc33d544357c985b9443c36fa
MD5 e88d5b4f9b250133796b05d3e96f1e14
BLAKE2b-256 78e4d4c1ab2e6ef38674a573b4cdb96a0881ef75b1c765a286f13d333dafb9b0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page