Beispiel #1
0
def build_shotclasstable(cross=True):
    from db.prozoneDB import DB
    c = DB.c
    conn = DB.conn
    
    idsX = np.array(get_features(["shotid"] + f,wo_penalties,only_fcb_shots))
    X = idsX[:,1:]
    y = np.array(get_results(wo_penalties,only_fcb_shots))
    if cross:
        prob = model.crosspredict(X,y)
    else:
        model.fit(X,y)
        prob = model.predict(X)
    
    #print prob
        
    c.execute("drop table if exists Shotvalue")
    c.execute("create table Shotvalue (shotid int,esv real)")
    for t in zip(idsX[:,0],prob):
        print(t)
        c.execute("insert into Shotvalue values (?,?)",t)
    conn.commit()
    conn.close()
    print("Shotclass table succcesfully built")
    
    print_scores(get_scores(y,prob))
    plot_roc_curve(y,prob)
Beispiel #2
0
def analyze_model(cross=True):
    X = np.array(get_features(f,wo_penalties,only_fcb_shots))
    y = np.array(get_results(wo_penalties,only_fcb_shots))
    if cross:
        prob = model.crosspredict(X,y)
    else:
        model.fit(X,y)
        prob = model.predict(X)
    
#     print prob
#     plt.hist(prob)
#     plt.show()
    #plot_model_analysis(X,y,prob,f)
    print_scores(get_scores(y,prob))
    plot_roc_curve(y,prob)