Skip to content

Commit

Permalink
Fix little bug in Live Test
Browse files Browse the repository at this point in the history
There was a little bug the the Live Test Tool when working with
multi-label classification. When the true label's index was 0 it made
the ``!cat_info`` condition true in the
``$scope.is_cat_active(cat_info)`` function, returning ``false``, which
made the true label turn red (as if it were misclassified).

Solution: simple! replaced !cat_info with cat_info == null in the if
statement.
  • Loading branch information
sergioburdisso committed May 22, 2020
1 parent b617bb7 commit 0b8e970
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyss3/resources/live_test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ <h4 class="light" ng-cloak><b>MODEL:</b> {{info.model_name|uppercase}}</h4>
<h5 class="blue-text" ng-if="f_doc && document">
Document: <span style="color:black">{{f_doc}}</span> <span style="color:gray" ng-if="c_doc">({{c_doc}})</span>
<span ng-if="multilabel" ng-repeat="label in info.docs['']['true_labels'][i_doc]">
<div class="chip pointer" ng-class="{'label-ok': is_cat_active(ss3.ci.indexOf(label)), 'label-nok': !is_cat_active(ss3.ci.indexOf(label))}" ng-click="select_cat(ss3.ci.indexOf(label))">{{label}}</div>
<div class="chip pointer" ng-class="{'label-ok': ss3 && is_cat_active(ss3.ci.indexOf(label)), 'label-nok': ss3 && !is_cat_active(ss3.ci.indexOf(label))}" ng-click="select_cat(ss3.ci.indexOf(label))">{{label}}</div>
</span>
</h5>
<h5 style="margin-top: 0;" ng-if="multilabel">
Expand Down
2 changes: 1 addition & 1 deletion pyss3/resources/live_test/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ app.controller("mainCtrl", function($scope) {
}

$scope.is_cat_active = function (cat_info) {
if (!$scope.ss3 || !cat_info)
if ($scope.ss3 == null || cat_info == null)
return false;

if (active_cats.length == 0){
Expand Down

0 comments on commit 0b8e970

Please sign in to comment.