Esempio n. 1
0
def test_entire_pipeline():
	kernel = Scikit_SVM.getLinearKernel()
	clf = Scikit_SVM(kernel)
	validator = StratifiedCrossValidator(10,clf)
	cm = validator.run()
	norm_cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
	output_util.plot_confusion_matrix(norm_cm,labels_by_frequency,title='Normalized Confusion Matrix')
Esempio n. 2
0
def test_cm_plotting():
	non_normalized_cm = np.loadtxt('../experiments/dataset1_all_C_0.2_chi2_0.1_cfsn_matrix.txt',np.float32)
	num_labels = non_normalized_cm.shape[0]
	labels = labels_by_frequency[:num_labels]
	cm_normalized = non_normalized_cm.astype('float') / non_normalized_cm.sum(axis=1)[:, np.newaxis]
	output_util.plot_confusion_matrix(cm_normalized,labels,title='Normalized Confusion Matrix')