Metadata-Version: 2.1
Name: ml-tooling
Version: 0.12.1
Summary: A library for machine learning utilities
Project-URL: Bug Tracker, https://github.com/andersbogsnes/ml_tooling/issues
Project-URL: Documentation, https://ml-tooling.readthedocs.io/en/stable/
Project-URL: Homepage, https://github.com/andersbogsnes/ml_tooling
Project-URL: Source Code, https://github.com/andersbogsnes/ml_tooling
Author-email: Anders Bogsnes <andersbogsnes@gmail.com>
Keywords: framework,ml,tooling
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.7
Requires-Dist: attrs
Requires-Dist: joblib
Requires-Dist: matplotlib
Requires-Dist: pandas
Requires-Dist: pyyaml
Requires-Dist: scikit-learn
Requires-Dist: scikit-optimize
Requires-Dist: sqlalchemy
Provides-Extra: artifactory
Requires-Dist: dohq-artifactory; extra == 'artifactory'
Provides-Extra: dev
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: sphinx; extra == 'dev'
Requires-Dist: sphinx-rtd-theme; extra == 'dev'
Requires-Dist: tox; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx; extra == 'docs'
Requires-Dist: sphinx-rtd-theme; extra == 'docs'
Provides-Extra: tests
Requires-Dist: pytest; extra == 'tests'
Requires-Dist: pytest-cov; extra == 'tests'
Description-Content-Type: text/markdown

# Model Tooling library
[![Build Status](https://github.com/andersbogsnes/ml_tooling/workflows/Integration/badge.svg)](https://github.com/andersbogsnes/ml_tooling/actions?workflow=Tests)
[![codecov](https://codecov.io/gh/andersbogsnes/ml_tooling/branch/main/graph/badge.svg)](https://codecov.io/gh/andersbogsnes/ml_tooling)
[![Python 3](https://img.shields.io/pypi/pyversions/ml_tooling.svg)](https://pyup.io/repos/github/andersbogsnes/ml_tooling/)
[![CodeFactor](https://www.codefactor.io/repository/github/andersbogsnes/ml_tooling/badge)](https://www.codefactor.io/repository/github/andersbogsnes/ml_tooling)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

## 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

```python
from sklearn.datasets import fetch_california_housing
from sklearn.linear_model import LinearRegression

from ml_tooling import Model
from ml_tooling.data import Dataset

# Define a new data class
class CaliforniaData(Dataset):
    def load_prediction_data(self, idx):
        x, _ = fetch_california_housing(return_X_y=True)
        return x[idx] # Return given observation

    def load_training_data(self):
        return fetch_california_housing(return_X_y=True)

# Instantiate a model with an estimator
linear_california = Model(LinearRegression())

# Instantiate the data
data = CaliforniaData()

# Split training and test data
data.create_train_test()

# Score the estimator yielding a Result object
result = linear_california.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
