-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_regression.py
More file actions
35 lines (27 loc) · 1.05 KB
/
basic_regression.py
File metadata and controls
35 lines (27 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Basic example for using Octopus regression."""
# This example demonstrates how to use Octopus to create a machine learning regression model.
# We will use the famous diabetes dataset for this purpose.
# Please ensure your dataset is clean, with no missing values (`NaN`),
# and that all features are numeric.
### Necessary imports for this example
import os
from octopus.example_data import load_diabetes_data
from octopus.study import OctoRegression
### Load the diabetes dataset
df, features, targets = load_diabetes_data()
print("Dataset info:")
print(f" Features: {len(features)} - {features}")
print(f" Samples: {df.shape[0]}")
print(f" Classes: {len(targets)} - {targets}")
print(f" Target distribution: {df['target'].value_counts().sort_index().to_dict()}")
### Create and run OctoRegression
study = OctoRegression(
name="basic_regression",
path=os.environ.get("STUDIES_PATH", "./studies"),
target_metric="MAE",
feature_cols=features,
target_col="target",
sample_id_col="index",
)
study.fit(data=df)
print("Workflow completed")