def predict_features(self, df_features, df_target, idx=0, **kwargs): """For one variable, predict its neighbouring nodes. Args: df_features (pandas.DataFrame): df_target (pandas.Series): idx (int): (optional) for printing purposes kwargs (dict): additional options for algorithms Returns: list: scores of each feature relatively to the target """ X = df_features.values y = df_target.values clf = ard(compute_score=True) clf.fit(X, y.ravel()) return np.abs(clf.coef_)
model.__class__.__name__ if __name__ == "__main__": br = '\n' X = np.load('data/X_boston.npy') y = np.load('data/y_boston.npy') X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0) regressors = [ lr(), bay(), rr(alpha=.5, random_state=0), l(alpha=0.1, random_state=0), ll(), knn(), ard(), rfr(random_state=0, n_estimators=100), SVR(gamma='scale', kernel='rbf'), rcv(fit_intercept=False), en(random_state=0), dtr(random_state=0), ada(random_state=0), gbr(random_state=0) ] print('unscaled:', br) for reg in regressors: reg.fit(X_train, y_train) rmse, name = get_error(reg, X_test, y_test) name = reg.__class__.__name__ print(name + '(rmse):', end=' ') print(rmse)