Skip to content

Commit

Permalink
Added nan filtering for post processing
Browse files Browse the repository at this point in the history
Fixed an issue in circleci config
  • Loading branch information
Habush committed Mar 26, 2019
1 parent b92a5ce commit 43d61e8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
# clone the repo if it doesn't exist
git clone --recursive https://github.com/Habush/moses-service.git
else
cd moses-service
git checkout -- .
git pull
fi
Expand Down
4 changes: 2 additions & 2 deletions crossval/filters/base_filter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__author__ = 'Abdulrahman Semrie<[email protected]>'

from abc import ABCMeta, abstractmethod

import math

class BaseFilter(metaclass=ABCMeta):
"""
Expand All @@ -19,7 +19,7 @@ def filter_negatives(self, models):
"""
result = []
for model in models:
if any([x < 0 for x in model.scores()]):
if any([x < 0 or math.isnan(x) for x in model.scores()]):
continue
result.append(model)

Expand Down
4 changes: 2 additions & 2 deletions crossval/post_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ def filter_models(self, base_dir=DATASET_DIR):
self._folds_to_models()

filtered_models = []

filter_cls = loader.get_overfitness_filter(self.filter_type)

if filter_cls is not None:
filtered_models = filter_cls.cut_off(self.models, self.filter_value)
filtered_models = filter_cls.filter_negatives(self.models)
filtered_models = filter_cls.cut_off(filtered_models, self.filter_value)

return list(map(lambda m: m.__dict__(), filtered_models))

0 comments on commit 43d61e8

Please sign in to comment.