Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
remoond79 committed Aug 29, 2018
1 parent fede87c commit b1dd606
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions main_single_score.py
@@ -0,0 +1,44 @@
"""
得到一个因子一个分数的记录列表
"""

import pickle
import numpy as np
from dataset_code.process_on_raw_data import form_raw_dataset, df_col_quchong
from dataset_code.HMM_duoyinzi import solve2, form_model_dataset, form_model
from public_tool.evaluate_plot import evaluate_plot
import warnings
warnings.filterwarnings("ignore")

if __name__ == '__main__':

temp = pickle.load(open('save/classified by id/000001.XSHE.pkl', 'rb'))
temp = df_col_quchong(temp)
temp = [i for i in temp.columns]
feature_list = temp[temp.index('AccountsPayablesTDays'):]
score_record = np.zeros(len(feature_list))

for i in range(len(feature_list)):

now_feature = [feature_list[i]]

dataset, label, lengths, col_nan_record = form_raw_dataset(now_feature, label_length=3, verbose=False)

if len(label) == 0:
print('skip ' + now_feature[0])
continue

solved_dataset, allow_flag = solve2(dataset, now_feature, now_feature)

train_X, train_label, train_lengths = form_model_dataset(solved_dataset, label, allow_flag, lengths)

model = form_model(train_X, train_lengths, 3, 'diag', 1000, verbose=False)

score = evaluate_plot(model, train_X, train_label, train_lengths)
score_record[i] = score

print('all:%s, now:%s, ' % (len(feature_list), i + 1) + now_feature[0] + ': score:%s' % score)

pickle.dump([score_record, feature_list], open('save/duoyinzi_solve2_score.pkl', 'wb'))

pickle.dump([score_record, feature_list], open('save/duoyinzi_solve2_score.pkl', 'wb'))

0 comments on commit b1dd606

Please sign in to comment.