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 |
Metadata
Release files for piskle 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| piskle-0.1.2.tar.gz | 5.4 kB | Without provenance | Details for piskle-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| piskle-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for piskle-0.1.2-py3-none-any.whl |
Total release size: 13.0 kB
Release files / piskle-0.1.2.tar.gz
| Download URL | piskle-0.1.2.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e021a1f477c2a2ffdb1a28ace5bfbbce997b4e7b1961059d0ba182822330415
|
|
BLAKE2b-256 checksum How to use checksums |
1db3092aaf60b20c73d212a8b2ee5278cd9a3d224a995097ed9b047c5728f653
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / piskle-0.1.2-py3-none-any.whl
| Download URL | piskle-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1a2c29e7d58b5ed7d09e6ba6a8ca75a057a8fc62e1a5760082f8ef66af5d779
|
|
BLAKE2b-256 checksum How to use checksums |
d0a904c638862739ba418bcc9b8ac1953d5bf19d619e4f8b022f2b22ed4a84bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for piskle 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.