Skip to content
This repository has been archived by the owner on Jul 15, 2022. It is now read-only.

Add accuracy, perClassAccuracy and confusionMatrix calculator helpers #5

Merged
merged 5 commits into from
Aug 29, 2018

Conversation

tafsiri
Copy link
Contributor

@tafsiri tafsiri commented Aug 28, 2018

This change is Reviewable

@tafsiri tafsiri requested a review from dsmilkov August 28, 2018 23:31
Copy link

@nsthorat nsthorat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 6 of 6 files at r1.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @tafsiri and @dsmilkov)


src/util/math.ts, line 142 at r1 (raw file):

 * Computes a confusion matrix from predictions and labels. Each value in
 * labels and predictions should correspond to some output class. It is assumed
 * that these values go from 0 - numClasses.

numClasses - 1?


src/util/math.ts, line 167 at r1 (raw file):

  }

  let numClasses_: number;

optional: you dont need another variable, you could just overwrite the one passed in


src/util/math.ts, line 170 at r1 (raw file):

  if (numClasses == null) {
    numClasses_ = tidy(() => {
      return maximum(labels.max(), predictions.max()).dataSync()[0] + 1;

this assumes that all classes have representation, right? is this what tf does?


src/util/math.ts, line 205 at r1 (raw file):

/**
 * Computes how often predictions matches labels

period


src/util/math.ts, line 227 at r1 (raw file):

 * Computes per class accuracy between prediction and labels. Each value in
 * labels and predictions should correspond to some output class. It is assumed
 * that these values go from 0 - numClasses.

-1

Copy link
Contributor Author

@tafsiri tafsiri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @tafsiri and @dsmilkov)


src/util/math.ts, line 142 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

numClasses - 1?

yep. fixed


src/util/math.ts, line 167 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

optional: you dont need another variable, you could just overwrite the one passed in

done


src/util/math.ts, line 170 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

this assumes that all classes have representation, right? is this what tf does?

yep this is what tf does. Classes that don't appear in labels or preds will have 0 values (which is nice since the output is dense)


src/util/math.ts, line 205 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

period

Done


src/util/math.ts, line 227 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

-1

Done

@tafsiri tafsiri merged commit 660a8fb into master Aug 29, 2018
@tafsiri tafsiri deleted the add-metrics branch February 14, 2019 23:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants