Skip to content

Commit 1845650

Browse files
committed
reduce number of calls to pandas.DataFrame.values
Results in a 3 order of magnitude speedup for prediction on shallow trees trained on the adult dataset, based on our experiments
1 parent faae09c commit 1845650

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gosdt/model/tree_classifier.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ def predict(self, X):
152152

153153
predictions = []
154154
(n, m) = X.shape
155+
samples = X.values
155156
for i in range(n):
156-
prediction, _ = self.classify(X.values[i,:])
157+
prediction, _ = self.classify(samples[i,:])
157158
predictions.append(prediction)
158159
return array(predictions)
159160

0 commit comments

Comments
 (0)