Skip to content

Instantly share code, notes, and snippets.

@sxjscience
Last active July 27, 2021 17:20
Show Gist options
  • Save sxjscience/8f9af554b5786ebfc04bb8211b8a7250 to your computer and use it in GitHub Desktop.
Save sxjscience/8f9af554b5786ebfc04bb8211b8a7250 to your computer and use it in GitHub Desktop.
import argparse
import os
from auto_mm_bench.datasets_with_image import dataset_with_image_registry, create_dataset
from autogluon.core.features.feature_metadata import FeatureMetadata
from autogluon.tabular import TabularPredictor
BASELINE_HPARAMS = {
'FASTAI': {},
}
train_dataset = create_dataset('san_francisco_airbnb', 'train')
single_image_train_df = train_dataset.get_df_with_single_image()
single_image_train_df = single_image_train_df[list(set(train_dataset.feature_columns + train_dataset.label_columns[:1]) - set(train_dataset.image_columns[1:]))]
feature_metadata = FeatureMetadata.from_df(single_image_train_df).add_special_types(
{train_dataset.image_columns[0]: ['image_path']})
eval_metric = train_dataset.metric
predictor = TabularPredictor(label=train_dataset.label_columns[0],
path='san_francisco_airbnb_tabular',
problem_type=train_dataset.problem_type, # specify problem_type
eval_metric=eval_metric)
predictor.fit(
train_data=single_image_train_df,
hyperparameters=BASELINE_HPARAMS,
feature_metadata=feature_metadata
)
test_dataset = create_dataset('san_francisco_airbnb', 'test')
predictor.leaderboard(test_dataset.get_df_with_single_image())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment