https://raw.githubusercontent.com/eurobios-mews-labs/palma/main/.static/logo.png

https://img.shields.io/badge/maintained%3F-yes-green.svg https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white https://github.com/eurobios-scb/palma/actions/workflows/pytest.yml/badge.svg?event=push https://badge.fury.io/py/palma.svg https://raw.githubusercontent.com/eurobios-mews-labs/palma/coverage-badge/coverage.svg?raw=true
  • The Palma library aims to provide simple tools to accelerate the development of your machine learning project

Installation#

To install the Palma library, use the following command:

python -m pip install palma

Basic Usage#

Start your project by using the project class:

import pandas as pd
from sklearn import model_selection
from sklearn.datasets import make_classification
from palma import Project

X, y = make_classification(n_informative=2, n_features=100)
X, y = pd.DataFrame(X), pd.Series(y).astype(bool)
project = Project(problem="classification", project_name="default")
project.start(
    X, y,
    splitter=model_selection.ShuffleSplit(n_splits=10, random_state=42),
)

The instantiation defines the type of problem, and the start method will set up what is needed to carry out an ML project, including a testing strategy (argument splitter), training data X, and target y.

Run Hyper-optimization#

_images/hyperopt.png

The hyper-optimization process will look for the best model in a pool of models that tend to perform well on various problems. For this specific task, the FLAML module is used. After hyperparameterization, the metric to track can be computed:

from palma import ModelSelector

ms = ModelSelector(engine="FlamlOptimizer",
                   engine_parameters=dict(time_budget=30))
ms.start(project)
print(ms.best_model_)

Tailoring and Analyzing Your Estimator#

from palma import ModelEvaluation
from sklearn.ensemble import RandomForestClassifier

# Use your own estimator
model = ModelEvaluation(estimator=RandomForestClassifier())
model.fit(project)

# Get the optimized estimator
model = ModelEvaluation(estimator=ms.best_model_)
model.fit(project)

Manage Components#

You can add components to enrich the project. See Components for detailed documentation.

Authors#

Eurobios Mews Labs

_images/logoEurobiosMewsLabs.png