-
Notifications
You must be signed in to change notification settings - Fork 18
/
run_stackRnnRbm.py
55 lines (48 loc) · 1.84 KB
/
run_stackRnnRbm.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# coding: utf-8
from dataset.Nikkei import Nikkei
from yoshihara.PredictPrices.stackRnnRbm import stackRnnRbm,train_rnnrbm
params = {
'dataset_type' : 'chi2_selected',
'STEP3' : {
'brandcode' : '0101'
},
'STEP4' : {
'hidden_layers_size' : [2000,1500],
'hidden_recurrent' : 1000,
'pretrain' : {
'batch_size' :100,
'learning_rate' : 0.001,
'epochs' : 100
},
'finetune' : {
'batch_size' :30,
'learning_rate' : 1.8,
'epochs' :50
}
}
}
######################################################
### STEP 3: 指定された銘柄の株価と記事データを組み合わせる ###
######################################################
def unify_stockprices(dataset):
print 'STEP 3 start...'
dataset.unify_stockprices(dataset.raw_data[params['STEP3']['brandcode']])
##########################################
### STEP 4: 指定された銘柄の株価を予測する ###
##########################################
def predict(dataset):
print 'STEP 4 start...'
train_rnnrbm(dataset=dataset,
hidden_layers_sizes=params['STEP4']['hidden_layers_size'],
hidden_recurrent = params['STEP4']['hidden_recurrent'],
pretrain_lr=params['STEP4']['pretrain']['learning_rate'],
pretrain_batch_size=params['STEP4']['pretrain']['batch_size'],
pretrain_epochs=params['STEP4']['pretrain']['epochs'],
finetune_lr=params['STEP4']['finetune']['learning_rate'],
finetune_batch_size=params['STEP4']['finetune']['batch_size'],
finetune_epochs=params['STEP4']['finetune']['epochs']
)
if __name__ == '__main__':
dataset = Nikkei(dataset_type=params['dataset_type'], brandcode=params['STEP3']['brandcode'])
unify_stockprices(dataset)
predict(dataset)