Skip to content
Snippets Groups Projects

Resolve "Adding new datasets"

Merged Leo Bouscarrat requested to merge 17-adding-new-datasets into master
1 file
+ 21
0
Compare changes
  • Side-by-side
  • Inline
@@ -24,6 +24,27 @@ class OmpForestBinaryClassifier(SingleOmpForest):
@@ -24,6 +24,27 @@ class OmpForestBinaryClassifier(SingleOmpForest):
return super().fit(X_forest, y_forest, X_omp, y_omp)
return super().fit(X_forest, y_forest, X_omp, y_omp)
 
def predict_no_weights(self, X):
 
"""
 
Apply the SingleOmpForest to X without using the weights.
 
 
Make all the base tree predictions
 
 
:param X: a Forest
 
:return: a np.array of the predictions of the entire forest
 
"""
 
forest_predictions = self._base_estimator_predictions(X).T
 
 
if self._models_parameters.normalize_D:
 
forest_predictions /= self._forest_norms
 
 
weights = self._omp.coef_
 
omp_trees_indices = np.nonzero(weights)
 
 
select_trees = np.argmax(forest_predictions[omp_trees_indices], axis=0)
 
 
return select_trees
 
def score(self, X, y, metric=DEFAULT_SCORE_METRIC):
def score(self, X, y, metric=DEFAULT_SCORE_METRIC):
"""
"""
Evaluate OMPForestClassifer on (`X`, `y`) using `metric`
Evaluate OMPForestClassifer on (`X`, `y`) using `metric`
Loading