def print_results(self, model_name, model, X, y):
feature_responses = None
if self.advanced_analytics == True:
feature_responses = self.create_feature_responses(model, X, y)
if self.ml_for_analytics and model_name in ("LogisticRegression", "RidgeClassifier", "LinearRegression", "Ridge"):
self._print_ml_analytics_results_linear_model(model, feature_responses)
elif self.ml_for_analytics and model_name in ["RandomForestClassifier", "RandomForestRegressor", "XGBClassifier", "XGBRegressor", "GradientBoostingRegressor", "GradientBoostingClassifier", "LGBMRegressor", "LGBMClassifier"]:
After Change
if self.ml_for_analytics and model_name in ("LogisticRegression", "RidgeClassifier", "LinearRegression", "Ridge"):
df_model_results = self._print_ml_analytics_results_linear_model(model)
// TODO: only grab the top 100 features from X
sorted_model_results = df_model_results.sort_values(by="Coefficients", ascending=False)sorted_model_results = sorted_model_results.reset_index(drop=True)
top_features = set(sorted_model_results.head(n=100)["Feature Name"])
feature_responses = self.create_feature_responses(model, X, y, top_features)
self._join_and_print_analytics_results(feature_responses, sorted_model_results, sort_field="Coefficients")