Пример #1
0
 def print_return_by_top_n(self, df_list, cnt=None):
     predict_util = prdct.PredictUtil()
     for n in range(TOP_N):
         if cnt is not None:
             print(str(n) + ': ' + str(len(df_list[n])) + ' / ' + str(cnt) + ' = ' + str(len(df_list[n]) / cnt))
         if len(df_list[n]) != 0:
             df_all = pd.concat(df_list[n], axis=0)
             predict_util.print_return(df_all, n + 1)
        t_util_4.clf = joblib.load(clf_pkl_4)
        t_util_4.sc = joblib.load(sc_pkl_4)
        t_util_6.clf = joblib.load(clf_pkl_6)
        t_util_6.sc = joblib.load(sc_pkl_6)
    else:
        print('pklファイルが存在しません。')
        sys.exit()

    ht_util = ht.HorseTableUtil()
    test_race_keys = ht_util.get_race_keys_except_debut_after_ymd(ymd)
    if len(test_race_keys) == 0:
        print('入力日に対象レースはありません。')
        sys.exit()

    horse_table_list = t_util_4.get_horse_table_list(test_race_keys)
    predict_util = prdct.PredictUtil()

    df_list = []
    cnt = 0
    for n in range(train.TOP_N):
        df_list.append([])
    for horse_table in horse_table_list:
        horse_table.predict_4_6(t_util_4.clf, t_util_4.sc, t_util_6.clf,
                                t_util_6.sc)
        for n in range(train.TOP_N):
            pr = horse_table.get_predict_return(n + 1)
            if pr is not None:
                df_list[n].append(pr)
        cnt += 1

    for n in range(train.TOP_N):