Regression
Introduction
Each app is a specialized intelligence to perform a single prediction task, trained from one or more datasets. Each app provides a space for the user to define the task, and to train and compare several models to achieve the goal. The "regression" app, as its name suggests, is tasked with performing a regression task.
Using the SDK to create regression applications
This section shows how to build an application of problem type regression in AI & Analytics Engine.
You can download the dataset used in this example here: penguin-regression.csv.
from aiaengine import Org, FileSource, Column, DataType, RegressionConfig
# create a new demo project in the org
org_id = 'b6240512-cd17-43a0-8297-84c51c1bc5a0' # replace with your org ID
org = Org(org_id)
project = org.create_project(name="Demo project using Python SDK", description="Your demo project")
# or you can get an existing project that you want to work on
# project = Project(id='ID_of_your_project') # replace with your own project ID
# import the `Penguin Regression` dataset
data_file = 'examples/datasets/penguins_regression.csv'
# You can use the `print_schema` utility function to print the auto-inferred schema
# print_schema(pd.read_csv(data_file, header=0))
dataset = project.create_dataset(
name=f"Penguin Regression",
data_source=FileSource(
file_urls=[data_file],
schema=[
Column('Flipper Length (mm)', DataType.Numeric),
Column('Body Mass (g)', DataType.Numeric)
]
)
)
# set the ID of the input dataset that used for creating the application
dataset_id = dataset.id
# use the RegressionConfg class to create the regression application
app = project.create_app(
name=f"Predict Penguin Body Mass",
dataset_id=dataset_id,
config=RegressionConfig(
target_column="Body Mass (g)",
)
)