Skip to content

Sample Usage

Build Configurations

Account Configs
Account Configs
snowflake_account_config = SnowflakeAccountConfig(
    account="[SECRET]",
    username="[SECRET]",
    password="[SECRET]",
)

aws_account_config = AWSAccountConfig(
    access_key_id="[SECRET]",
    secret_access_key="[SECRET]",
)
Table Configs
Table Configs
input_table_config = SnowflakeTableConfig(
    warehouse="[SECRET]",
    database="[SECRET]",
    schema="[SECRET]",
    table_name="[SECRET]",
)

evaluation_table_config = SnowflakeTableConfig(
    warehouse="[SECRET]",
    database="[SECRET]",
    schema="AUTOML_TEST",
    table_name="TEST_PERFORMANCE",
)

feature_importance_table_config = SnowflakeTableConfig(
    warehouse="[SECRET]",
    database="[SECRET]",
    schema="AUTOML_TEST",
    table_name="TEST_FEATURE_IMPORTANCE",
)
Model & Artifact Configs
Model & Artifact Configs
model_config = ModelConfig(
    label="[SECRET]",
    model_name="TEST_MODEL",
    model_description="Test Model",
)

artifacts_cloud_save_config = ArtifactsCloudSaveConfig(
    local_save_path="./TEST_MODEL",
    bucket="[SECRET]",
    key_prefix="test_automl",
)

Train AutoML Model

Train AutoML Model
automl(
    snowflake_account_config,
    aws_account_config,
    input_table_config,
    evaluation_table_config,
    feature_importance_table_config,
    model_config,
    artifacts_cloud_save_config,
    verbosity=1,
)
Success
Running AutoML...
Loading data from Snowflake...
AutoGluon infers your prediction problem is: [SECRET]
Data loaded from Snowflake with columns: [SECRET]
Validating data...
Data is valid.
Train and test sets built with shapes: [SECRET].
Building AutoGluon predictor...
AutoGluon predictor built.
Fitting AutoGluon predictor...
AutoGluon will gauge predictive performance using evaluation metric: [SECRET]
AutoGluon predictor fitted.
Evaluating AutoGluon predictor...
AutoGluon predictor evaluated.
Saving evaluation result to snowflake...
These features in provided data are not utilized by the predictor and will be ignored: [SECRET]
Evaluation result saved.
Calculating feature importances...
Feature importances calculated.
Saving feature importances to Snowflake...
Feature importances saved to Snowflake.
Saving artifacts to cloud...
Saving artifacts to ./TEST_MODEL...
Saving artifacts to S3 bucket='[SECRET]' with key_prefix='test_automl'...
Artifacts saved.
Artifacts saved to cloud.
Finished running AutoML.

Run Predictions on New Data

New Table Configs
Table Configs
new_input_table_config = SnowflakeTableConfig(
    warehouse="[SECRET]",
    database="[SECRET]",
    schema="[SECRET]",
    table_name="[SECRET]",
    # You can also specify a query to load data from Snowflake
    sql_query="SELECT * FROM [SECRET] SAMPLE(1000 ROWS)",
)

output_table_config = SnowflakeTableConfig(
    warehouse="[SECRET]",
    database="[SECRET]",
    schema="AUTOML_TEST",
    table_name="TEST_OUTPUTS",
    # Warning: be careful when setting this to True,
    # as it will overwrite the table if it already exists.
    force_replace_table=True,
)
Run Predictions on New Data
predict(
    snowflake_account_config,
    aws_account_config,
    new_input_table_config,
    output_table_config,
    artifacts_cloud_save_config,
    verbosity=1,
)
Success
Running AutoML Predictor...
Artifacts already downloaded to ./TEST_MODEL.
Downloading data from Snowflake...
Loading data from Snowflake...
Data loaded from Snowflake with columns: [SECRET]
Validating data...
Data is valid.
Data downloaded from Snowflake.
Calculating predictions...
Predictions calculated.
Saving predictions to Snowflake...
Predictions saved to Snowflake.
Finished running AutoML Predictor.