Skip to main content

Lightweight file-to-file build tool built for production workloads

Project description

tinybaker: Lightweight file-to-file build tool built for production workloads

This is a "working" example of a script that builds an ml model from given train and test dataframes.

# train_step.py
from tinybaker import StepDefinition
import pandas as pd
from some_cool_ml_library import train_model, test_model

class TrainModelStep(StepDefinition):
  input_set = {"train_csv", "test_csv"}
  output_set = {"pickled_model"}

  def script():
    train_data = pd.read_csv(self.input_files["train_csv"])
    test_data = pd.read_csv(self.input_files["test_csv"])
    X = train_data.drop(["label"])
    Y = train_data[["label"]]
    model = train_model(X, Y, depth_or_something=self.config["depth"])
    model.test_model()
    pickle.dump(self.output_files["pickled_model"], model)
# script.py
from .train_step import TrainModelStep

[_, train_csv_path, test_csv_path, pickled_model_path] =  parse_args(os)
TrainModelStep.build(
  input={
    "train_csv": train_csv_path,
    "test_csv": test_csv_path,
  },
  output={
    "pickled_model": pickled_model_path
  },
  config={"depth": 5}
)

That's it!!

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

tinybaker-0.0.1.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

tinybaker-0.0.1-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

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