Пример #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)
Пример #2
0
def comparemodels(cross=True):
    X = np.array(get_features(f,wo_penalties,only_fcb_shots))
    X_alt = np.array(get_features(f_alt,wo_penalties,only_fcb_shots))
    y = np.array(get_results(wo_penalties,only_fcb_shots))
    if cross:
        prob = model.crosspredict(X,y)
        prob_alt = model_alt.crosspredict(X_alt,y)
    else:
        model.fit(X,y)
        model_alt.fit(X,y)
        prob = model.predict(X)
        prob_alt = model.predict(X)
    #compare_models(X, y, prob, prob_alt, f, f_plot=True)
    plot_roc_curve(y, prob, prob_alt)
Пример #3
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)