From f7042f832b33c7ad44295266a5932710c6b4b735 Mon Sep 17 00:00:00 2001 From: Farid Mohammadi <farid.mohammadi@iws.uni-stuttgart.de> Date: Mon, 1 Aug 2022 08:48:30 +0200 Subject: [PATCH] [surrogate] comment the refitting with the bias term. --- .../surrogate_models/surrogate_models.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/bayesvalidrox/surrogate_models/surrogate_models.py b/src/bayesvalidrox/surrogate_models/surrogate_models.py index f478bbd5e..722221d74 100644 --- a/src/bayesvalidrox/surrogate_models/surrogate_models.py +++ b/src/bayesvalidrox/surrogate_models/surrogate_models.py @@ -701,18 +701,18 @@ class MetaModel(): # The first column must be kept (For mean calculations) nnz_idx = np.nonzero(clf_poly.coef_)[0] - if len(nnz_idx) == 0 or nnz_idx[0] != 0: - nnz_idx = np.insert(np.nonzero(clf_poly.coef_)[0], 0, 0) - # Remove the zero entries for Bases and PSI if need be - if sparsity: - sparse_basis_indices = basis_indices.toarray()[nnz_idx] - else: - sparse_basis_indices = basis_indices[nnz_idx] - sparse_X = X[:, nnz_idx] - - # Store the coefficients of the regression model - clf_poly.fit(sparse_X, y) - coeffs = clf_poly.coef_ + # if len(nnz_idx) == 0 or nnz_idx[0] != 0: + # nnz_idx = np.insert(np.nonzero(clf_poly.coef_)[0], 0, 0) + # # Remove the zero entries for Bases and PSI if need be + # if sparsity: + # sparse_basis_indices = basis_indices.toarray()[nnz_idx] + # else: + # sparse_basis_indices = basis_indices[nnz_idx] + # sparse_X = X[:, nnz_idx] + + # # Store the coefficients of the regression model + # clf_poly.fit(sparse_X, y) + # coeffs = clf_poly.coef_ # This is for the case where all outputs are zero, thereby # all coefficients are zero -- GitLab