<commit_before>"""
Determines the accuracy of KNN, Naive Bayes and Decision Tree classifiers
at predicting student performance.

The features of the data set are course grades with values on a scale from 
0 to 9.  Each student is labelled as either having succeeded (s), been on 
probation (s) but still passed, or failed (f).
"""

# Import the PML interactive api so that we can program like we were at 
# the PML shell.
from pml.api import *

# Some additional useful functions
import util

def knn_accuracy_tests(training, testing):
    util.print_line_break()
    print "KNN accuracy test:"
    print "k\tAccuracy"
    print "-\t--------"
    
    # Test the accuracy for k values of 3, 4, 5
    for k in range(3, 6):
        accuracy = Knn(training, k=k).classify_all(testing).compute_accuracy()
        print "%d\t%2.5f %%" % (k, 100 * accuracy)
    <commit_msg>Increased range of k sweep for knn accuracy test.<commit_after>"""
Determines the accuracy of KNN, Naive Bayes and Decision Tree classifiers
at predicting student performance.

The features of the data set are course grades with values on a scale from 
0 to 9.  Each student is labelled as either having succeeded (s), been on 
probation (s) but still passed, or failed (f).
"""

# Import the PML interactive api so that we can program like we were at 
# the PML shell.
from pml.api import *

# Some additional useful functions
import util

def knn_accuracy_tests(training, testing):
    util.print_line_break()
    print "KNN accuracy test:"
    print "k\tAccuracy"
    print "-\t--------"
    
    # Test the accuracy for k values of 3, 4, 5, 6, 7, 8, 9
    for k in range(3, 10):
        accuracy = Knn(training, k=k).classify_all(testing).compute_accuracy()
        print "%d\t%2.5f %%" % (k, 100 * accuracy)
    
{'fraction_non_alphanumeric': 0.0957983193277311, 'fraction_numerical': 0.016246498599439777, 'mean_word_length': 3.272727272727273, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3007135', 'n_tokens_mistral': 575, 'n_tokens_neox': 540, 'n_words': 240}