Skip to main content

Piskle allows you to selectively and efficiently serialize scikit-learn models to save on memory and load times.

Project description

Piskle

Piskle allows you to selectively serialize python objects to save on memory and load times.

It has special support for exporting scikit-learn's models in an optimized way, exporting exactly what's needed to make predictions.

Banner

via GIPHY

Example:

To use piskle, you first need a model to export. You can use this as an example:

from sklearn import datasets
from sklearn.neural_network import MLPClassifier

data = datasets.load_iris()

model = MLPClassifier().fit(data.data, data.target)

Exporting the model is then as easy as the following:

import piskle

piskle.dump(model, 'model.pskl')

Loading it is even easier:

model = piskle.load('model.pskl')

If you want even faster serialization, you can disable the optimize feature. Note that this feature reduces the size of the exported file even further and improves loading time.

piskle.dump(model, 'model.pskl', optimize=False)

Currently Supported Models

Predictors ( Classifiers, Regressors, ...)

Estimator Reference
LinearSVC sklearn.svm
LinearRegression sklearn.linear_model
LogisticRegression sklearn.linear_model
Lasso sklearn.linear_model
Ridge sklearn.linear_model
Perceptron sklearn.linear_model
GaussianNB sklearn.naive_bayes
KNeighborsRegressor sklearn.neighbors
KNeighborsClassifier sklearn.neighbors
MLPClassifier sklearn.neural_network
MLPRegressor sklearn.neural_network
DecisionTreeClassifier sklearn.tree
DecisionTreeRegressor sklearn.tree
KMeans sklearn.cluster
GaussianMixture sklearn.mixture

Transformers

Estimator Reference
PCA sklearn.decomposition
FastICA sklearn.decomposition
CountVectorizer sklearn.feature_extraction.text
TfidfVectorizer sklearn.feature_extraction.text
SimpleImputer sklearn.impute
StandardScaler sklearn.preprocessing
LabelEncoder sklearn.preprocessing
OneHotEncoder sklearn.preprocessing

Future Improvements

This is still an early working version of piskle, there are still a few improvements planned:

  • More thorough testing
  • Version Management: Support for more versions of scikit-learn (earlier versions)
  • Support for more Estimators (Feel free to contact us for a specific request)
  • Support for "Nested" Estimators (Pipelines, RandomForests, etc...)

Contribute

As this is still a work in progress, while using piskle, you might encounter some bugs. It would be a great help to us, if you could report them in the github repo.

Feel free, to share with us any potential improvements you'd like to see in piskle.

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

piskle-0.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

piskle-0.0.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file piskle-0.0.1.tar.gz.

File metadata

  • Download URL: piskle-0.0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.9

File hashes

Hashes for piskle-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b7ee8a024e891ae393531091b2c60e2f410d1dfbb3d6a5c5dfbdebc173afcdbf
MD5 184d272a1db02c49d079c0856587c012
BLAKE2b-256 93e8a66b308e11754cf78e9747ed67d78d81ac199d1c8e11bfab2dc503267709

See more details on using hashes here.

File details

Details for the file piskle-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: piskle-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.9

File hashes

Hashes for piskle-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 46bab9540e27a1c2d30cc85f190928d4204c7abbdf7af9548f7fe44511f50855
MD5 d40648780fb72061f8ff0094ad4497c7
BLAKE2b-256 077e97014a5d287d213221af01015e1f8fc321fb396d8a99eb6587b2c5175c48

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