ahurriyetoglu / destimator

Describe your scikit-learn estimators for posterity!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

destimator

destimator makes it easy to store trained scikit-learn estimators together with their metadata (training data, package versions, performance numbers etc.). This makes it much safer to store already-trained classifiers/regressors and allows for better reproducibility (see this talk by Alex Gaynor for some rationale).

Specifically, the DescribedEstimator class proxies most calls to the original Estimator it is wrapping, but also contains the following information:

  • training and test (validation) data (features_train, labels_train, features_test, labels_test)
  • creation date (created_at)
  • feature names (feature_names)
  • performance numbers on the test set (precision, recall, fscore, support via sklearn)
  • distribution info (distribution_info; python distribution and versions of all installed packages)
  • VCS hash (vcs_hash, if used inside a git repository, otherwise and empty string).

An instantiated DescribedEstimator can be easily serialized using the .save() method and deserialized using either .from_file() or .from_url(). Did you ever want to store your models in S3? Now it's easy!

DescribedEstimator can be used as follows:

Now you can use the classifier as usual:

and you can also access a bunch of other properties, such as the training data you supplied:

the performance numbers:

or information about the Python distribution used for training:

Finally, the object can be serialized to a zip file containing all the above data:

and deserialized either from a file,

or from a URL:

About

Describe your scikit-learn estimators for posterity!

License:MIT License


Languages

Language:Python 100.0%