Skip to content

Commit 6f11b94

Browse files
author
[zebinyang]
committed
for a fair comparison, adjust roughness by map x to be within [0, 1]; version 0.1.8
1 parent b2b9e0a commit 6f11b94

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

simtree/simtree.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,17 @@ def get_projection_equation(self, node_id, precision=3):
156156
sortind = np.argsort(importance)[::-1]
157157
for i in range(est.beta_.shape[0]):
158158
if i == 0:
159-
equation += str(round(np.abs(est.beta_[sortind[i], 0]), 3)) + self.feature_names[sortind[i]]
159+
if est.beta_[sortind[i], 0] < 0:
160+
equation += " - "
161+
equation += str(round(np.abs(est.beta_[sortind[i], 0]), precision)) + self.feature_names[sortind[i]]
160162
continue
161163
else:
162164
if np.abs(est.beta_[sortind[i], 0]) > 0:
163165
if est.beta_[sortind[i], 0] > 0:
164166
equation += " + "
165167
else:
166168
equation += " - "
167-
equation += str(round(np.abs(est.beta_[sortind[i], 0]), 3)) + self.feature_names[sortind[i]]
169+
equation += str(round(np.abs(est.beta_[sortind[i], 0]), precision)) + self.feature_names[sortind[i]]
168170
return equation
169171

170172
def get_sparsity(self, node_id):

0 commit comments

Comments
 (0)