Skip to main content

DAI-Lab An Open Source Project from the Data to AI Lab, at MIT

Development Status PyPi Shield Tests Downloads Binder

ml-stars

Primitives for machine learning and time series.

Overview

This repository contains primitive annotations to be used by the MLBlocks library, as well as the necessary Python code to make some of them fully compatible with the MLBlocks API requirements.

There is also a collection of custom primitives contributed directly to this library, which either combine third party tools or implement new functionalities from scratch.

Installation

Requirements

ml-stars has been developed and tested on Python 3.8, 3.9, 3.10, 3.11, and 3.12

Also, although it is not strictly required, the usage of a virtualenv is highly recommended in order to avoid interfering with other software installed in the system where ml-stars is run.

Install with pip

The easiest and recommended way to install ml-stars is using pip:

pip install ml-stars

This will pull and install the latest stable release from PyPi.

If you want to install from source or contribute to the project please read the Contributing Guide.

Quickstart

This section is a short series of tutorials to help you getting started with ml-stars.

We will be executing a single primitive for data transformation.

1. Load a Primitive

The first step in order to run a primitive is to load it.

This will be done using the mlstars.load_primitive function, which will load the indicated primitive as an MLBlock Object from MLBlocks

In this case, we will load the sklearn.preprocessing.MinMaxScaler primitive.

from mlstars import load_primitive

primitive = load_primitive('sklearn.preprocessing.MinMaxScaler')

2. Load some data

The StandardScaler is a transformation primitive which scales your data into a given range.

To use this primtives, we generate a synthetic data with some numeric values.

import numpy as np

data = np.array([10, 1, 3, -1, 5, 6, 0, 4, 13, 4]).reshape(-1, 1)

The data is a list of integers where their original range is between [-1, 13].

3. Fit the primitive

In order to run our primitive, we first need to fit it.

This is the process where it analyzes the data to detect what is the original range of the data.

This is done by calling its fit method and passing the data as X.

primitive.fit(X=data)

4. Produce results

Once the pipeline is fit, we can process the data by calling the produce method of the primitive instance and passing agin the data as X.

transformed = primitive.produce(X=data)
transformed

After this is done, we can see how the transformed data contains the transformed values:

array([[0.78571429],
       [0.14285714],
       [0.28571429],
       [0.        ],
       [0.42857143],
       [0.5       ],
       [0.07142857],
       [0.35714286],
       [1.        ],
       [0.35714286]])

The data is now in [0, 1] range.

What's Next?

Documentation

History

0.2.3 – 2024-12-10

  • SimpleImputer primitive update Issue#17 - by @sarahmish

0.2.2 – 2024-12-03

Re-release of previous version

0.2.1 – 2024-11-25

  • Adapter for MinMaxScaler Issue #16 - by @sarahmish
  • Add python 3.12 Issue #15 - by @sarahmish

0.2.0 – 2023-10-24

  • Upgrade python tests & remove python 3.7 Issue #11 - by @sarahmish
  • Add deprecation warning for old ARIMA primitive Issue #10 - by @sarahmish
  • Remove python 3.6 Issue #9 - by @sarahmish
  • Add support for python 3.10 & 3.11 Issue #8 - by @sarahmish

0.1.3 – 2023-09-25

  • Update keras adapter Issue #7 - by @sarahmish

0.1.2 – 2023-08-04

  • Add python 3.9 Issue #6 - by @sarahmish

0.1.1 - 2023-05-17

  • Fix ARIMA adapter Issue #5 - by @sarahmish
  • Add Documentation Issue #4 - by @sarahmish

0.1.0 - 2023-04-18

First official ml-stars release to PyPI: https://pypi.org/project/ml-stars/

Metadata

Release files for ml-stars 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ml-stars 0.2.3
File Size Uploaded
ml_stars-0.2.3.tar.gz 91.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ml-stars 0.2.3
File Interpreter ABI Platform
ml_stars-0.2.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 153.8 kB

Release files / ml_stars-0.2.3.tar.gz

Download URL ml_stars-0.2.3.tar.gz
Size 91.6 kB
Tags Source
SHA-256 checksum
How to use checksums
75296df4cb1ad67240aad4ec3833fc779de8908306bafa60354de3ccd24bd01e
BLAKE2b-256 checksum
How to use checksums
5b3745da234a7f1c5604c5cf69035d9905b379f961d8481d567e2dbadcf27f16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.15

Release files / ml_stars-0.2.3-py2.py3-none-any.whl

Download URL ml_stars-0.2.3-py2.py3-none-any.whl
Size 62.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1176e9eabfb85c29414c764f509f8901a0808aeef05b22866be2546e4b5a41d4
BLAKE2b-256 checksum
How to use checksums
b813a8ff62e41d829ed818216a706a70b2e4bb35b0eb9a883ca3cb72021a9c24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.15
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page