Skip to content

Commit

Permalink
Merge pull request #76 from RUTILEA/feature/set_auto_sigma_threshold
Browse files Browse the repository at this point in the history
Update learning_model.py
  • Loading branch information
nwatab authored Jul 16, 2019
2 parents 868636d + 0b55964 commit 1dc4ee1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/python/model/learning_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from statistics import stdev, mean
from math import sqrt


class TestResults(object):
def __init__(self):
self.__distances_of_train_images = np.empty(shape=0)
Expand Down Expand Up @@ -198,7 +197,7 @@ def test(self, predict_training=False):
else:
self.test_results.reload(distances_of_ok_images=pred_of_ok_images, distances_of_ng_images=pred_of_ng_images)
if self.test_results.distances_of_ng_images.size != 0:
self.threshold = max(self.test_results.distances_of_ng_images) # default threshold FIXME: logic
self.threshold = max(self.test_results.distances_of_ng_images.max(), np.percentile(self.test_results.distances_of_ok_images, 0.13)) # default threshold is the larger of max NG distance and 0.13 percentile (-3 sigma) of OK distances
self.__should_test = False
except IndexError: # TODO: handle as UndoneTrainingError
print('TODO: tell the user to train')
Expand Down

0 comments on commit 1dc4ee1

Please sign in to comment.