A collection of useful mixins for machine learning development code.
Project description
ML Mixins
Installation
this package can be installed via pip
:
pip install ml-mixins
Then
from mixins import SeedableMixin
...
Description
Useful Python Mixins for ML. These are python mixin classes that can be used to add useful bits of discrete functionality to python objects for use in ML / data science. They currently include:
SeedableMixin
which adds nice seeding capabilities, including functions to seed various stages of computation in a manner that is both random but also reproducible from a global seed, as well as to store seeds used at various times so that a subsection of the computation can be reproduced exactly during debugging outside of the rest of the computation flow.TimeableMixin
adds functionality for timing sections of code.SaveableMixin
adds customizable save/load functionality (using pickle)SwapcacheableMixin
. This one is a bit more niche. It adds a "swapcache" to the class, which allows one to store various iterations of parameters keyed by an arbitrary python object with an equality operator, with a notion of a "current" setting whose values are then exposed as main class attributes. The intended use-case is for data processing classes, where it may be desirable to try different preprocesisng settings, have the object retain derived data for those settings, but present a front-facing interface that looks like it is only computing a single setting. For example, if running tfidf under different stopwords and ngram settings, one can run the system via the swapcache under settings A, and the class can present an interface of[obj].stop_words
,obj.ngram_range
,obj.tfidf_vectorized_data
, but then this can be transparently updated to a different setting without discarding that data via the swapcache interface.TQDMableMixin
. This one adds a_tqdm
method to a class which automatically progressbar-ifies ranges for iteration, unless the range is sufficiently short or the class hasself.tqdm
set toNone
None of these are guaranteed to work or be useful at this point.
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
ml_mixins-0.1.0.tar.gz
(15.4 kB
view details)
Built Distribution
File details
Details for the file ml_mixins-0.1.0.tar.gz
.
File metadata
- Download URL: ml_mixins-0.1.0.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 169429aded495a7ee7a656c618c9d0983556de9266786fc4ab91f9c30675ec6a |
|
MD5 | 18c009074a3c3e900011cf0eef4818fc |
|
BLAKE2b-256 | 3e27ba0e9362f1074073225d5aadfb69574ceb64b03c5ad2e9e8521b6a5e5f10 |
File details
Details for the file ml_mixins-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: ml_mixins-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2e76f8bad342711b63e422e1ca995f98629176b238340ee623bdbaf0d30900d |
|
MD5 | 838e38e8cd813a3cdba64b81ce51ab0f |
|
BLAKE2b-256 | 4a8029adef3a7008dfa24896bbb395cb452c73d682e76aed2fc5bd5c1e50f2ce |