A library for machine learning utilities
Project description
Model Tooling library
Installation
Use pip to install:
pip install ml-tooling
Or use conda
conda install -c conda-forge ml_tooling
Test
We use tox
for managing build and test environments, to install tox
run:
pip install tox
And to run tests:
tox -e py
Example usage
Define a class using ModelData and implement the two required methods. Here we simply implement a linear regression on the Boston dataset using sklearn.datasets
from sklearn.datasets import load_boston
from sklearn.linear_model import LinearRegression
from ml_tooling import Model
from ml_tooling.data import Dataset
# Define a new data class
class BostonData(Dataset):
def load_prediction_data(self, idx):
x, _ = load_boston(return_X_y=True)
return x[idx] # Return given observation
def load_training_data(self):
return load_boston(return_X_y=True)
# Instantiate a model with an estimator
linear_boston = Model(LinearRegression())
# Instantiate the data
data = BostonData()
# Split training and test data
data.create_train_test()
# Score the estimator yielding a Result object
result = linear_boston.score_estimator(data)
# Visualize the result
result.plot.prediction_error()
print(result)
<Result LinearRegression: {'r2': 0.68}>
Links
- Documentation: https://ml-tooling.readthedocs.io
- Releases: https://pypi.org/project/ml_tooling/
- Code: https://github.com/andersbogsnes/ml_tooling
- Issue Tracker: https://github.com/andersbogsnes/ml_tooling/issues
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
ml_tooling-0.10.3.tar.gz
(36.8 kB
view hashes)
Built Distribution
Close
Hashes for ml_tooling-0.10.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24bce7f4a5a1bc62e0ba0796e39867241924ed33aa64bf461c7559c0e34b70d9 |
|
MD5 | 9405a885aa3d5e6796ccd2d18d52cf1b |
|
BLAKE2b-256 | 51e0db87e30f62c323b463f0a69bf40472077ce466bc87e82d4889bae59c9564 |