config.use_sparse_data = True config.normalize_data = False config.normalize_type = 'unit_length' # Other valid option: 'center' (centers/scales distribution around zero) config.validate= True # Generate our feature vectors gen_feature_data.genAllExperimentData(experiment_name=name) #********************************************************************** seeeeeee) #Train the SVM and print results #try the C values in Cs for each kernel in kernels kernels= ['linear'] Cs= [0.001,0.01,0.003] stats = svm.svmLearnAll(C=.01, gamma=0.00, kernel='linear', experiment_name=name, debug=1, rep_max=None,Clist=Cs,kernelList=kernels,mcnemar=True) mcnemardata={} for (rep_id,repstats) in stats.items(): if ('WrongPredictions') in repstats.keys(): bills=repstats['WrongPredictions'] mcnemardata[rep_id]=bills del(repstats['WrongPredictions']) mcn= open("mcnemar_data/"+name,'w') mcn.write(json.dumps(mcnemardata)) mcn.close() print "Done with all reps"
config.use_sparse_data = True config.normalize_data = False config.normalize_type = 'unit_length' # Other valid option: 'center' (centers/scales distribution around zero) config.validate= True # Generate our feature vectors gen_feature_data.genAllExperimentData(experiment_name=name) #********************************************************************** seeeeeee) #Train the SVM and print results #try the C values in Cs for each kernel in kernels kernels= ['linear'] Cs= [0.1, 0.3, 0.5, 0.7, 1.2, 2.5, 3.6,10] stats = svm.svmLearnAll(C=.01, gamma=0.00, kernel='linear', experiment_name=name, debug=3, rep_max=2,Clist=Cs,kernelList=kernels) print "Done with all reps" f = open('experiment_results/'+name+'.json', 'w') f.write(json.dumps(stats)) f.close() raw_input("Press Enter to continue... \nAbout to write .csv. Make sure to close the results file if you have it open.") # Format stats for excel: f = open('experiment_results/'+name+'.csv', 'w') #Write headers: for stat_name in stats[stats.keys()[0]]: f.write(','+stat_name)
name = "all_with_summary" config.features_to_ignore = [] config.use_sparse_data = True config.normalize_data = False config.normalize_type = 'unit_length' # Other valid option: 'center' (centers/scales distribution around zero) # Generate our feature vectors gen_feature_data.genAllExperimentData(experiment_name=name) # Train the SVM and print results # TODO(john): Return results in such a way that we can analyze multiple reps # or plug it into excel or something. stats = svm.svmLearnAll(C=.01, gamma=0.00, kernel='linear', experiment_name=name, debug=1, rep_max=430) print "Done with all reps" f = open('experiment_results/'+name+'.json', 'w') f.write(json.dumps(stats)) f.close() raw_input("Press Enter to continue... \nAbout to write .csv. Make sure to close the results file if you have it open.") # Format stats for excel: f = open('experiment_results/'+name+'.csv', 'w') #Write headers: for stat_name in stats[stats.keys()[0]]: f.write(','+stat_name)