Skip to main content

Catasta is a Python library designed to simplify and accelerate the process of machine learning model experimentation. It encapsulates the complexities of model training and evaluation, offering researchers and developers a straightforward pipeline for rapid model assessment with minimal setup required.

Project description

Catasta: Streamlined Model Experimentation

pypi version MIT License

Catasta is a Python library designed to simplify the process of Machine Learning model experimentation. Optimization, training, evaluation and inference all in one place!

[!WARNING] :construction: Catasta is in early development :construction:

Expect breaking changes on every release until v1.0.0 is reached.

The documentation is under development.


With Catasta, you can build a model like an archway... Let me explain:

Optimization

First, set the foundations of the model with the Foundation class. This class uses the popular and supercool optuna library to optimize a model given a hyperparameter space and an objective function.

hp_space = {
    "n_patches": (2, 7),
    "d_model": (8, 16),
    "n_layers": (1, 2),
    "n_heads": (1, 2),
    "feedforward_dim": (8, 16),
    "head_dim": (4, 8),
    "dropout": (0.0, 0.5),
    "layer_norm": (True, False),
}

foundation = Foundation(
    hyperparameter_space=hp_space,
    objective_function=objective,
    sampler="bogp",
    n_trials=100,
    direction="maximize",
    use_secretary=True,
    catch_exceptions=True,
)

optimization_info = foundation.optimize()

Training

Set the scaffolds of your model with the Scaffold class. This class integrates a model and a dataset for training and evaluation.

model = FeedforwardRegressor(
    context_length=32,
    hidden_dims=[8, 16, 8],
    dropout=0.0,
    use_layer_norm=True,
    activation="relu",
)

dataset = CatastaDataset(
    root="path/to/dataset/",
    task="regression",
)

scaffold = Scaffold(
    model=model,
    dataset=dataset,
    optimizer="adamw",
    loss_function="mse",
)

scaffold.train(
    epochs=100,
    batch_size=256,
    lr=1e-3,
)

info = scaffold.evaluate()

Inference

Your archway is finished with the Archway class. This class runs the inference of the model given its saved path.

archway = Archway("path/to/saved/model/")

prediction = archway.predict(input)

Other modules

Catasta also has different modules that facilitate model experimentation.

  • catasta.models offers a variety of pre-implemente Machine Learning models. All models are single-scripted, so feel free to copy and paste them anywhere.

  • catasta.transformations let's you apply transformations to the data when its loaded to a dataset, such as window sliding, normalization...

  • catasta.utils has several functions that are useful for model optimization and training.

Installation

Install via pip

Catasta is available as a PyPi package:

pip install catasta

Install from source

Clone the repository

git clone https://github.com/vistormu/catasta

and install the dependencies

pip install -r requirements.txt

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

catasta-0.3.0.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

catasta-0.3.0-py3-none-any.whl (58.0 kB view details)

Uploaded Python 3

File details

Details for the file catasta-0.3.0.tar.gz.

File metadata

  • Download URL: catasta-0.3.0.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for catasta-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8747cf2d810c1190c91f6a41f05fbe50448b4b0d61438ac9757ac5e2d089804a
MD5 f41c4ab24e0c81630285ae61fe178286
BLAKE2b-256 4f8a27bc5c5e71335c4f3c67aa47318569f284b86c7db2cc08b451b970ae4bc7

See more details on using hashes here.

File details

Details for the file catasta-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: catasta-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 58.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.5

File hashes

Hashes for catasta-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f11997ec1ae09001a219a9935046bfc6df999e4de9b44e94a29db073d67f1b2b
MD5 3cd39c150c2c46cff9a97867fbce6526
BLAKE2b-256 9c425b70a40c2e4cdb68b002d6bbdb3392b31540c0c29ef98e7d711307ea2733

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page