Changeset 16378


Ignore:
Timestamp:
Jul 22, 2016, 3:27:48 PM (3 years ago)
Author:
dferreira
Message:

Excel with new tests added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • internals/2016/aptoideimagesdetector/trunk/Source Code/Language Extractor/language_extractor.py

    r16372 r16378  
    9393        non_size += 1
    9494
    95         # Non_size==exp_size
    9695        if non_size==exp_size:
    9796                break
     
    191190        testsets = collections.defaultdict(set)
    192191
     192        tp=0
     193        fp=0
     194        tn=0
     195        fn=0
     196
    193197        for i, (features, label) in enumerate(testing_set):
    194198                refsets[label].add(i)
    195199                observed = classifier.classify(features)
    196200                testsets[observed].add(i)
    197 
    198         print "Time training: "+ str(datetime.now()-now)
     201                if label =='exp' and observed =='exp':
     202                        tp += 1
     203                elif label=='non' and observed=='non':
     204                        tn += 1
     205                elif label=='exp' and observed=='non':
     206                        fn += 1
     207                else:
     208                        fp += 1
     209
     210        print "Time training: " + str(datetime.now()-now)
     211        print "True Positives: " + str(tp)
     212        print "False Positives: " + str(fp)
     213        print "True Negatives: " + str(tn)
     214        print "False Negatives: " + str(fn)
    199215        print 'Explicit Precision: ', precision(refsets['exp'], testsets['exp'])
    200216        print 'Explicit recall: ', recall(refsets['exp'], testsets['exp'])
Note: See TracChangeset for help on using the changeset viewer.