Skip to main content
Version: 1.2.0

Driverless AI MOJO example

from featurestore import Client, CSVFile, DriverlessAIMOJO
from featurestore.core.job_types import INGEST

# Initialise feature store client
client = Client("ip:port")
client.auth.login()

# Set project specifics
project = client.projects.create("demo")

# Create a DAI mojo pipeline source
csv = CSVFile("<path to csv data>")
csv_schema = client.extract_schema_from_source(csv)
input_fs = project.feature_sets.register(csv_schema, "input")
input_fs.ingest(csv)

mojo_pipeline = DriverlessAIMOJO("<path to mojo file>")
mojo_pipeline_schema = client.extract_derived_schema([input_fs], mojo_pipeline)

# Register the feature set
my_feature_set = project.feature_sets.register(mojo_pipeline_schema, "feature_set_name", primary_key=["key_name"])

# Get ingest job
auto_ingest_job = my_feature_set.get_active_jobs(INGEST)[0]
auto_ingest_job.wait_for_result()

# Retrieve feature set
ref = my_feature_set.retrieve()
ref.download()

Feedback