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.
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)
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...)
- Support for other serialization methods (such as joblib, shelve or json...)
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.
If you like the project and want to support us, you can buy us a coffee here:
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 |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file piskle-0.1.1.tar.gz
.
File metadata
- Download URL: piskle-0.1.1.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b4bd3ac77e810fcb3412151f50553094d28e676f440445ae615d4982cdef86d |
|
MD5 | 61f19d1973de09280877527ca41dee9e |
|
BLAKE2b-256 | 5d59b4fc3865cb5c3517310254383b98a359a488e7034d183e0959bd0cf71799 |
File details
Details for the file piskle-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: piskle-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.5 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.0.0.post20201207 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5aad248683ba9f3cdbc807c843aae31bc82874c53d5214e605f88e7e8dccdeaa |
|
MD5 | 2046007874ee089281032dab0fa33f2f |
|
BLAKE2b-256 | 10e3d451fd600f38814e6f44db97d4cbcb432fecc52f807cc0b0de1b32d55c57 |