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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for tinybaker-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b20872a94e174732d4e10b88f182cb5f53bfd0bcd530bc7e951dfeb1f1f3284a |
|
MD5 | 43166205e8033a40260d51cbc3e398dd |
|
BLAKE2b-256 | 2cbd6e0c7933f638ee37d18178ed3ab3a8c4e9b44ad8b2bab6efd6411e983c26 |