OUTPUT_DIR = './outputs/' os.makedirs(OUTPUT_DIR, exist_ok=True) # Get workspace from the run context run = Run.get_context() ws = run.experiment.workspace # Get the AutoML run object from the experiment name and the workspace experiment = Experiment(ws, '<<experiment_name>>') automl_run = Run(experiment=experiment, run_id='<<run_id>>') # Check if this AutoML model is explainable if not automl_check_model_if_explainable(automl_run): raise Exception("Model explanations is currently not supported for " + automl_run.get_properties().get( 'run_algorithm')) # Download the best model from the artifact store automl_run.download_file(name=MODEL_PATH, output_file_path='model.pkl') # Load the AutoML model into memory fitted_model = joblib.load('model.pkl') # Get the train dataset from the workspace train_dataset = Dataset.get_by_name(workspace=ws, name='<<train_dataset_name>>') # Drop the lablled column to get the training set. X_train = train_dataset.drop_columns(columns=['<<target_column_name>>']) y_train = train_dataset.keep_columns(columns=['<<target_column_name>>'], validate=True) # Get the train dataset from the workspace test_dataset = Dataset.get_by_name(workspace=ws, name='<<test_dataset_name>>')
OUTPUT_DIR = './outputs/' os.makedirs(OUTPUT_DIR, exist_ok=True) # Get workspace from the run context run = Run.get_context() ws = run.experiment.workspace # Get the AutoML run object from the experiment name and the workspace experiment = Experiment(ws, '<<experiment_name>>') automl_run = Run(experiment=experiment, run_id='<<run_id>>') # Check if this AutoML model is explainable if not automl_check_model_if_explainable(automl_run): raise Exception("Model explanations is currently not supported for " + automl_run.get_properties().get('run_algorithm')) # Download the best model from the artifact store automl_run.download_file(name=MODEL_PATH, output_file_path='model.pkl') # Load the AutoML model into memory fitted_model = joblib.load('model.pkl') # Get the train dataset from the workspace train_dataset = Dataset.get_by_name(workspace=ws, name='<<train_dataset_name>>') # Drop the lablled column to get the training set. X_train = train_dataset.drop_columns(columns=['<<target_column_name>>']) y_train = train_dataset.keep_columns(columns=['<<target_column_name>>'], validate=True)
OUTPUT_DIR = "./outputs/" os.makedirs(OUTPUT_DIR, exist_ok=True) # Get workspace from the run context run = Run.get_context() ws = run.experiment.workspace # Get the AutoML run object from the experiment name and the workspace experiment = Experiment(ws, "<<experiment_name>>") automl_run = Run(experiment=experiment, run_id="<<run_id>>") # Check if this AutoML model is explainable if not automl_check_model_if_explainable(automl_run): raise Exception("Model explanations are currently not supported for " + automl_run.get_properties().get("run_algorithm")) # Download the best model from the artifact store automl_run.download_file(name=MODEL_PATH, output_file_path="model.pkl") # Load the AutoML model into memory fitted_model = joblib.load("model.pkl") # Get the train dataset from the workspace train_dataset = Dataset.get_by_name(workspace=ws, name="<<train_dataset_name>>") # Drop the labeled column to get the training set. X_train = train_dataset.drop_columns(columns=["<<target_column_name>>"]) y_train = train_dataset.keep_columns(columns=["<<target_column_name>>"], validate=True)