예제 #1
0
def main():
    training_data = rtrain.train()
    # rtest.test(training_data)
    # odds_ratio(9, 7, training_data)
    # odds_ratio(9, 4, training_data)
    # odds_ratio(3, 5, training_data)
    # odds_ratio(3, 8, training_data)
    for i in range(10):
        odds_ratio(i, i, training_data)
예제 #2
0
def main():
	training_data = rtrain.train()
	# rtest.test(training_data)
	# odds_ratio(9, 7, training_data)
	# odds_ratio(9, 4, training_data)
	# odds_ratio(3, 5, training_data)
	# odds_ratio(3, 8, training_data)
	for i in range(10):
		odds_ratio(i, i, training_data)
예제 #3
0
			if cur_line[j] != ' ':
				singular_image[i].append(1)
			else:
				singular_image[i].append(0);
	probability_per_class = list()

	for i in range(10):
		probability_per_class.append(get_prob(i, singular_image, digit_matrices, 1))
	
	max_value = max(probability_per_class)
	max_index = probability_per_class.index(max_value) 

	digit_class = int(line)
	global num_per_class
	global correct_count
	global correct_per_class
	global confusion_matrix
	num_per_class[digit_class] +=1
	confusion_matrix[digit_class][max_index] += 1
	if max_index == digit_class:
		correct_count+=1
		correct_per_class[max_index]+=1
	# print (max_index, digit_class)



if __name__ == '__main__':
	start = time.clock()
	test(rtrain.train(0))
	print time.clock() - start
예제 #4
0
            if cur_line[j] != ' ':
                singular_image[i].append(1)
            else:
                singular_image[i].append(0)
    probability_per_class = list()

    for i in range(10):
        probability_per_class.append(
            get_prob(i, singular_image, digit_matrices, 1))

    max_value = max(probability_per_class)
    max_index = probability_per_class.index(max_value)

    digit_class = int(line)
    global num_per_class
    global correct_count
    global correct_per_class
    global confusion_matrix
    num_per_class[digit_class] += 1
    confusion_matrix[digit_class][max_index] += 1
    if max_index == digit_class:
        correct_count += 1
        correct_per_class[max_index] += 1
    # print (max_index, digit_class)


if __name__ == '__main__':
    start = time.clock()
    test(rtrain.train(0))
    print time.clock() - start