Example #1
0
def test_model_on_single_file(file_path):
    clf = joblib.load("saved_model/model_ceps.pkl")
    X, y = read_ceps_test(create_ceps_test(test_file) + ".npy")
    probs = clf.predict_proba(X)
    print "\t".join(str(x) for x in traverse)
    print "\t".join(str("%.3f" % x) for x in probs[0])
    probs = probs[0]
    max_prob = max(probs)
    for i, j in enumerate(probs):
        if probs[i] == max_prob:
            max_prob_index = i

    print max_prob_index
    predicted_genre = traverse[max_prob_index]
    print "\n\npredicted genre = ", predicted_genre
    return predicted_genre
Example #2
0
def test_model_on_single_file(file_path):
    clf = joblib.load('saved_model/model_ceps.pkl')
    X, y = read_ceps_test(create_ceps_test(test_file) + ".npy")
    probs = clf.predict_proba(X)
    print "\t".join(str(x) for x in traverse)
    print "\t".join(str("%.3f" % x) for x in probs[0])
    probs = probs[0]
    max_prob = max(probs)
    for i, j in enumerate(probs):
        if probs[i] == max_prob:
            max_prob_index = i

    print max_prob_index
    predicted_genre = traverse[max_prob_index]
    print "\n\npredicted genre = ", predicted_genre
    return predicted_genre
Example #3
0
def test_model_on_single_file(file_path):
    clf = joblib.load('data/model_ceps.pkl')
    create_ceps(test_file)
    fnpy = file_path[:-3]+"ceps.npy"
    print fnpy
    X, y = read_ceps_test(fnpy)
    probs = clf.predict_proba(X)
    print str(probs)
    #print "\t".join(str(x) for x in traverse)
    #print "\t".join(str("%.3f" % x) for x in probs[0])
    probs=probs[0]
    max_prob = max(probs)
    for i,j in enumerate(probs):
        if probs[i] == max_prob:
            max_prob_index=i
    
    print max_prob_index
    predicted_genre = genre_list[max_prob_index]
    print "\n\npredicted genre = ",predicted_genre
    return predicted_genre