Ignore:
Timestamp:
2019-07-06T15:45:02+12:00 (5 years ago)
Author:
cpb16
Message:

Backup for computer crash, only lost 5 lines of code in development section. They have been rewritten.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/is-sheet-music-encore/trunk/image-identification-terminal/javaAccuracyCalculator.java

    r33170 r33304  
    7070               
    7171                //Correctly identified SheetMusic as SheetMusic
    72                 trueAccuracyRate = ((float)truePositive/(float)sheetMusicCount)*(float)100;
    73 
    74                 //Amount of Correctly identified NotSheetSheetMusic as NotSheetMusic
    75                 falseAccuracyRate = ((float)trueNegative/(float)notSheetMusicCount)*(float)100;
     72                if(sheetMusicCount != 0){
     73                    trueAccuracyRate = ((float)truePositive/(float)sheetMusicCount)*(float)100;
     74                }
     75                else {
     76                    trueAccuracyRate = 0;
     77                }
    7678               
    77                 overallAccuracyRate = (truePositive + trueNegative)/(float)(sheetMusicCount+notSheetMusicCount)*(float)100;
     79                if(notSheetMusicCount != 0){
     80                    //Amount of Correctly identified NotSheetSheetMusic as NotSheetMusic
     81                    falseAccuracyRate = ((float)trueNegative/(float)notSheetMusicCount)*(float)100;
     82                }
     83                else {
     84                    falseAccuracyRate = 0;
     85                }
     86               
     87                if(notSheetMusicCount != 0 && sheetMusicCount != 0) {
     88                    overallAccuracyRate = (truePositive + trueNegative)/(float)(sheetMusicCount+notSheetMusicCount)*(float)100;
     89                }
     90                else if (sheetMusicCount = 0) {
     91                    overallAccuracyRate = falseAccuracyRate/2;
     92                }
     93                else {
     94                    overallAccuracyRate = trueAccuracyRate/2;
     95                }
    7896               
    7997                fw.write("Date: " + d.toString() + '\n'
Note: See TracChangeset for help on using the changeset viewer.