-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- renamed same files - now performance metric is unified for binary, multi-label, and multi-class - spear allows any reduction_metric - added pred_class() which automatically detects the type of prediction challenge - cleaned up results
- Loading branch information
1 parent
fa5bd3d
commit 4dcc65d
Showing
8 changed files
with
85 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
from .binary_performance import BinaryPerformance | ||
from .performance import Performance | ||
|
||
|
||
def get_score(self): | ||
|
||
y_pred = self.keras_model.predict_classes(self.x_val) | ||
return BinaryPerformance(y_pred, self.y_val).result | ||
return Performance(y_pred, self.y_val, self.shape).result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
def classify(y): | ||
|
||
'''Detects if prediction is binary, multi-label or multi-class''' | ||
|
||
shape = detect_shape(y) | ||
|
||
if shape > 1: | ||
return 'multi_class' | ||
|
||
elif y.max() <= 1: | ||
return 'binary_class' | ||
else: | ||
return 'multi_label' | ||
|
||
|
||
def detect_shape(y): | ||
|
||
try: | ||
return y.shape[1] | ||
except IndexError: | ||
return 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters