MCPcopy Create free account
hub / github.com/rushter/MLAlgorithms / _predict

Method _predict

mla/ensemble/random_forest.py:87–98  ·  view source on GitHub ↗
(self, X=None)

Source from the content-addressed store, hash-verified

85 self.trees.append(Tree(criterion=self.criterion))
86
87 def _predict(self, X=None):
88 y_shape = np.unique(self.y).shape[0]
89 predictions = np.zeros((X.shape[0], y_shape))
90
91 for i in range(X.shape[0]):
92 row_pred = np.zeros(y_shape)
93 for tree in self.trees:
94 row_pred += tree.predict_row(X[i, :])
95
96 row_pred /= self.n_estimators
97 predictions[i, :] = row_pred
98 return predictions
99
100
101class RandomForestRegressor(RandomForest):

Callers

nothing calls this directly

Calls 1

predict_rowMethod · 0.80

Tested by

no test coverage detected