Skip to content

Commit

Permalink
Merge pull request #71 from myslak71/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
myslak71 committed Feb 23, 2019
2 parents 3493c46 + aaed9ab commit c16e9e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
1 change: 1 addition & 0 deletions common/utils/count_percentage.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ def count_percentage(duel, algorithm):
algorithm.parameters.update({'random_state': 0})
model = algorithms[algorithm.get_name_display()](**algorithm.parameters)
model.fit(x_train, y_train)

return float(Decimal(100 * model.score(x_test, y_test)).quantize(Decimal('.001')))
15 changes: 4 additions & 11 deletions duels/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,8 @@ class Meta:
fields = ('__all__')

def to_representation(self, instance):
algorithm = super().to_representation(instance)
algorithm_repr = super().to_representation(instance)
if self.context.get('include_algorithm_name'):
choice = dict(Algorithm._meta.get_field('name').choices)[algorithm['name']]
algorithm['name_display'] = choice
return algorithm


class DefaultAlgorithmSerializer(serializers.ModelSerializer):
class Meta:
model = DefaultAlgorithm
fields = ('__all__')
read_only_fields=('__all__')
algorithm_name = dict(Algorithm._meta.get_field('name').choices)[algorithm_repr['name']]
algorithm_repr['name_display'] = algorithm_name
return algorithm_repr

0 comments on commit c16e9e6

Please sign in to comment.