def train_dt_procedure( session: Session, training_table: str, feature_cols: list, target_col: str, model_name: str, ) -> T.Variant: """ This will be our training procedure. Later we will register this as snowflake procedure. training_table: snowflake table name to be used for training task feature_cols: list of columns to be used in training target_col: target column to be used model_name: model name to used for model saving purpose """ #convert as pandas DF, rest of the steps similar to the local model training and saving. local_training_data = session.table(training_table).to_pandas() from sklearn.tree import DecisionTreeClassifier X = local_training_data[feature_cols] y = local_training_data[target_col] model = DecisionTreeClassifier() model.fit(X, y) #do what ever you want to do with model, even the hyperparameter tuning.. # here I'll get feature importance feat_importance = pd.DataFrame( model.feature_importances_, feature_cols, columns=["FeatImportance"] ).to_dict() from joblib import dump dump(model, "/tmp/" + model_name) session.file.put( "/tmp/" + model_name, "@ML_MODELS", auto_compress=False, overwrite=True ) return feat_importance