comparison deep/stacked_dae/v_sylvain/nist_apriori_error.py @ 448:b2a7d93caa0f

Correction d'un petit bug d'indice. Le script est maintenant plus juste
author SylvainPL <sylvain.pannetier.lebeuf@umontreal.ca>
date Fri, 07 May 2010 17:24:21 -0400
parents 5ca2936f2062
children
comparison
equal deleted inserted replaced
447:db7da40a7338 448:b2a7d93caa0f
1 # -*- coding: utf-8 -*-
2 __docformat__ = 'restructedtext en' 1 __docformat__ = 'restructedtext en'
3 2
4 import pdb 3 import pdb
5 import numpy 4 import numpy
6 from numpy import array 5 from numpy import array
64 print('Number of layers not implemented yet, please do it') 63 print('Number of layers not implemented yet, please do it')
65 64
66 65
67 total_error_count=0 66 total_error_count=0
68 total_exemple_count=0 67 total_exemple_count=0
69 total_error_count_wap=0
70
71 if part == 0: 68 if part == 0:
72 iter = dataset.train(1) 69 iter = dataset.train(1)
73 if part == 1: 70 if part == 1:
74 iter = dataset.valid(1) 71 iter = dataset.valid(1)
75 if part == 2: 72 if part == 2:
125 total_error_count+=1 122 total_error_count+=1
126 if(y>35): 123 if(y>35):
127 predicted_class=numpy.argmax(out[0,36:])+36 124 predicted_class=numpy.argmax(out[0,36:])+36
128 if(predicted_class!=y): 125 if(predicted_class!=y):
129 total_error_count+=1 126 total_error_count+=1
130 #without a priori 127
131 predicted_class=numpy.argmax(out)
132 if(predicted_class!=y):
133 total_error_count_wap+=1
134
135 print '\t total exemples count: '+str(total_exemple_count) 128 print '\t total exemples count: '+str(total_exemple_count)
136 print '\t total error count: '+str(total_error_count) 129 print '\t total error count: '+str(total_error_count)
137 print '\t percentage of error: '+str(total_error_count*100.0/total_exemple_count*1.0)+' %' 130 print '\t percentage of error: '+str(total_error_count*100.0/total_exemple_count*1.0)+' %'
138 print '\t total error count without a priori: '+str(total_error_count_wap)
139 print '\t percentage of error without a priori: '+str(total_error_count_wap*100.0/total_exemple_count*1.0)+' %'
140 131
141 132
142 def sigmoid(value): 133 def sigmoid(value):
143 ## if len(value) > 1: 134 ## if len(value) > 1:
144 ## retour = numpy.zeros(len(value),float) 135 ## retour = numpy.zeros(len(value),float)