Data Science, Causal Inference, Machine Learning, Optimization, Notes From Industry.
treated_3, df_scoring_3 = extract_treated_effect(n, X_train_3, model_3) We then extract the expected outcome (number of orders) when the treatment is set to 0: def extract_untreated_effect(n, X_train, model): # Set features to mean value X_mean_mapping = {'X1': [X_train[:, 0].mean()] * n, 'X2':