###############################
	'''
	)	
	print(pd.crosstab(predictions_nn, 
		test_class_set['diagnosis'], 
		rownames=['Predicted Values'], 
		colnames=['Actual Values']))

	print("Here is our mean accuracy on the test set:\n {0: .3f}"\
		.format(accuracy_nn))			
	
	print("The test error rate for our model is:\n {0: .3f}"\
		.format(test_error_rate_nn))	
	
	# ROC Curve
	hf.plot_roc_curve(fpr3, tpr3, auc_nn, 'nn')	
	
	# Zoomed in ROC Curve
	hf.plot_roc_curve(fpr3, tpr3, auc_nn, 'nn',  
		(-0.001, 0.2), (0.7, 1.05))
else:
	def return_nn():
		'''
		Function to output values created in script 
		'''
		return fpr3, tpr3, auc_nn, predictions_nn, test_error_rate_nn
	
	# Keep Cross validation metrics 
	mean_cv_nn, std_error_nn = hf.cross_val_metrics(fit_nn, 
		training_set_scaled, 
		class_set['diagnosis'], 
Example #2
0
		###############################
		'''
		)
		
	print(pd.crosstab(predictions_RF, 
			test_class_set['diagnosis'], 
			rownames=['Predicted Values'], 
			colnames=['Actual Values']))
	
	print("Here is our mean accuracy on the test set:\n {0: 0.3f}"\
		.format(accuracy_RF))
	
	print("The test error rate for our model is:\n {0: .3f}"\
		.format(test_error_rate_RF))
		
	# ROC Curve
	hf.plot_roc_curve(fpr2, tpr2, auc_rf, 'rf')
	# Zoomed in ROC Curve
	hf.plot_roc_curve(fpr2, tpr2, auc_rf, 'rf', 
		(-0.001, 0.2), (0.7, 1.05))
else:
	def return_rf():
		'''
		Function to output values created in script 
		'''
		return fpr2, tpr2, auc_rf, predictions_RF, test_error_rate_RF

	mean_cv_rf, std_error_rf = hf.cross_val_metrics(fit_RF, 
		training_set, 
		class_set['diagnosis'], 
		print_results = False)
                    rownames=['Predicted Values'],
                    colnames=['Actual Values']))

    # TEST ERROR RATE!!
    print("Here is our accuracy for our test set:\n {0: .3f}"\
     .format(accuracy))

    # Here we calculate the test error rate!
    print("The test error rate for our model is:\n {0: .3f}"\
     .format(test_error_rate))

    # ROC Curve
    # NOTE: These functions were created in the helperFunctions.py
    # script to reduce lines of code
    # refer to helper.py for additional information
    hf.plot_roc_curve(fpr, tpr, auc_knn, 'knn')

    # Zoomed in ROC Curve
    hf.plot_roc_curve(fpr, tpr, auc_knn, 'knn', (-0.001, 0.2), (0.7, 1.05))
else:

    def return_knn():
        '''
		Function to output values created in script 
		'''
        return fpr, tpr, auc_knn, predictions, test_error_rate

    mean_cv_knn, std_error_knn = hf.cross_val_metrics(fit_knn,
                                                      training_set,
                                                      class_set['diagnosis'],
                                                      print_results=False)