當前位置: 首頁>>代碼示例>>Python>>正文


Python Result.get_new_result方法代碼示例

本文整理匯總了Python中result.Result.get_new_result方法的典型用法代碼示例。如果您正苦於以下問題:Python Result.get_new_result方法的具體用法?Python Result.get_new_result怎麽用?Python Result.get_new_result使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在result.Result的用法示例。


在下文中一共展示了Result.get_new_result方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: read

# 需要導入模塊: from result import Result [as 別名]
# 或者: from result.Result import get_new_result [as 別名]
def read():
    with open('../../data/000060result005', 'r') as f:
        lines = f.readlines()

    result_list = []
    result_template = None
    ix = 0

    test_winrate_05, test_pos_num_05, test_winrate_06, test_pos_num_06, test_winrate_07, test_pos_num_07, test_winrate_08, test_pos_num_08, test_winrate_09, test_pos_num_09, test_acc = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    while ix < len(lines):
        line = lines[ix]
        if 'learning_rate' in line:
            tmp = line.split(',')
            learning_rate = float(tmp[0].split()[-1])
            strategy = tmp[1].split()[-1]
            punishment = float(tmp[2].split()[-1])
            result_template = Result(strategy, learning_rate, punishment)
            ix += 2
        elif 'val' in line:
            val_winrate_05 = float(line.split()[-1])
            ix += 1
            val_pos_num_05 = float(lines[ix].split()[-1])

            '''
            ix += 1
            test_winrate_05 = float(lines[ix].split()[-1])
            ix += 1
            test_pos_num_05 = float(lines[ix].split()[-1])
            '''

            ix += 1
            val_winrate_06 = float(lines[ix].split()[-1])
            ix += 1
            val_pos_num_06 = float(lines[ix].split()[-1])

            '''
            ix += 1
            test_winrate_06 = float(lines[ix].split()[-1])
            ix += 1
            test_pos_num_06 = float(lines[ix].split()[-1])
            '''

            ix += 1
            val_winrate_07 = float(lines[ix].split()[-1])
            ix += 1
            val_pos_num_07 = float(lines[ix].split()[-1])
            '''
            ix += 1
            test_winrate_07 = float(lines[ix].split()[-1])
            ix += 1
            test_pos_num_07 = float(lines[ix].split()[-1])
            '''

            ix += 1
            val_winrate_08 = float(lines[ix].split()[-1])
            ix += 1
            val_pos_num_08 = float(lines[ix].split()[-1])
            '''
            ix += 1
            test_winrate_08 = float(lines[ix].split()[-1])
            ix += 1
            test_pos_num_08 = float(lines[ix].split()[-1])
            '''

            ix += 1
            val_winrate_09 = float(lines[ix].split()[-1])
            ix += 1
            val_pos_num_09 = float(lines[ix].split()[-1])
            '''
            ix += 1
            test_winrate_09 = float(lines[ix].split()[-1])
            ix += 1
            test_pos_num_09 = float(lines[ix].split()[-1])
            '''

            ix += 1
            epoch = int(lines[ix].split()[1])
            ix += 4
            val_acc = float(lines[ix].split()[2]) / 100
            '''
            ix += 2
            test_acc = float(lines[ix].split()[2]) / 100
            '''

            single_result = result_template.get_new_result(epoch,
                val_winrate_05, val_pos_num_05, test_winrate_05, test_pos_num_05,
                val_winrate_06, val_pos_num_06, test_winrate_06, test_pos_num_06,
                val_winrate_07, val_pos_num_07, test_winrate_07, test_pos_num_07,
                val_winrate_08, val_pos_num_08, test_winrate_08, test_pos_num_08,
                val_winrate_09, val_pos_num_09, test_winrate_09, test_pos_num_09,
                val_acc, test_acc)
            result_list.append(single_result)
            ix += 2
        else:
            print line
            ix += 1
    return result_list
開發者ID:wolfhu,項目名稱:StockPredictor,代碼行數:99,代碼來源:analyse_result.py


注:本文中的result.Result.get_new_result方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。