Mercurial > ift6266
comparison deep/stacked_dae/v_sylvain/nist_sda.py @ 264:f14fb56b3f8d
ajout de fonctionnalitees pour deux testsets. Changements afin de pouvoir utiliser la nouvelle version de datasets
author | SylvainPL <sylvain.pannetier.lebeuf@umontreal.ca> |
---|---|
date | Thu, 18 Mar 2010 10:53:02 -0400 |
parents | 6d49cf134a40 |
children | 698313f8f6e6 |
comparison
equal
deleted
inserted
replaced
263:a0264184684e | 264:f14fb56b3f8d |
---|---|
58 | 58 |
59 series = create_series(state.num_hidden_layers) | 59 series = create_series(state.num_hidden_layers) |
60 | 60 |
61 print "Creating optimizer with state, ", state | 61 print "Creating optimizer with state, ", state |
62 | 62 |
63 optimizer = SdaSgdOptimizer(dataset=datasets.nist_all, | 63 optimizer = SdaSgdOptimizer(dataset=datasets.nist_all(), |
64 hyperparameters=state, \ | 64 hyperparameters=state, \ |
65 n_ins=n_ins, n_outs=n_outs,\ | 65 n_ins=n_ins, n_outs=n_outs,\ |
66 examples_per_epoch=examples_per_epoch, \ | 66 examples_per_epoch=examples_per_epoch, \ |
67 series=series, | 67 series=series, |
68 max_minibatches=rtt) | 68 max_minibatches=rtt) |
69 | 69 |
70 parameters=[] | 70 parameters=[] |
71 optimizer.pretrain(datasets.nist_all) | 71 optimizer.pretrain(datasets.nist_P07()) |
72 channel.save() | 72 channel.save() |
73 | 73 |
74 #Set some of the parameters used for the finetuning | 74 #Set some of the parameters used for the finetuning |
75 if state.has_key('finetune_set'): | 75 if state.has_key('finetune_set'): |
76 finetune_choice=state['finetune_set'] | 76 finetune_choice=state['finetune_set'] |
90 #Decide how the finetune is done | 90 #Decide how the finetune is done |
91 | 91 |
92 if finetune_choice==0: | 92 if finetune_choice==0: |
93 print('\n\n\tfinetune avec nist\n\n') | 93 print('\n\n\tfinetune avec nist\n\n') |
94 optimizer.reload_parameters() | 94 optimizer.reload_parameters() |
95 optimizer.finetune(datasets.nist_all,max_finetune_epoch_NIST) | 95 optimizer.finetune(datasets.nist_all(),datasets.nist_P07(),max_finetune_epoch_NIST,ind_test=1) |
96 if finetune_choice==1: | 96 if finetune_choice==1: |
97 print('\n\n\tfinetune avec P07\n\n') | 97 print('\n\n\tfinetune avec P07\n\n') |
98 optimizer.reload_parameters() | 98 optimizer.reload_parameters() |
99 optimizer.finetune(datasets.nist_P07,max_finetune_epoch_P07) | 99 optimizer.finetune(datasets.nist_P07(),datasets.nist_all(),max_finetune_epoch_P07,ind_test=0) |
100 if finetune_choice==2: | 100 if finetune_choice==2: |
101 print('\n\n\tfinetune avec nist suivi de P07\n\n') | 101 print('\n\n\tfinetune avec nist suivi de P07\n\n') |
102 optimizer.reload_parameters() | 102 optimizer.reload_parameters() |
103 optimizer.finetune(datasets.nist_all,max_finetune_epoch_NIST) | 103 optimizer.finetune(datasets.nist_all(),datasets.nist_P07(),max_finetune_epoch_NIST,ind_test=1) |
104 optimizer.finetune(datasets.nist_P07,max_finetune_epoch_P07) | 104 optimizer.finetune(datasets.nist_P07(),datasets.nist_all(),max_finetune_epoch_P07,ind_test=0) |
105 | 105 |
106 if finetune_choice==-1: | 106 if finetune_choice==-1: |
107 print('\nSerie de 3 essais de fine-tuning') | 107 print('\nSerie de 3 essais de fine-tuning') |
108 print('\n\n\tfinetune avec nist\n\n') | 108 print('\n\n\tfinetune avec nist\n\n') |
109 optimizer.reload_parameters() | 109 optimizer.reload_parameters() |
110 optimizer.finetune(datasets.nist_all,max_finetune_epoch_NIST) | 110 optimizer.finetune(datasets.nist_all(),datasets.nist_P07(),max_finetune_epoch_NIST,ind_test=1) |
111 channel.save() | 111 channel.save() |
112 print('\n\n\tfinetune avec P07\n\n') | 112 print('\n\n\tfinetune avec P07\n\n') |
113 optimizer.reload_parameters() | 113 optimizer.reload_parameters() |
114 optimizer.finetune(datasets.nist_P07,max_finetune_epoch_P07) | 114 optimizer.finetune(datasets.nist_P07(),datasets.nist_all(),max_finetune_epoch_P07,ind_test=0) |
115 channel.save() | 115 channel.save() |
116 print('\n\n\tfinetune avec nist suivi de P07\n\n') | 116 print('\n\n\tfinetune avec nist suivi de P07\n\n') |
117 optimizer.reload_parameters() | 117 optimizer.reload_parameters() |
118 optimizer.finetune(datasets.nist_all,max_finetune_epoch_NIST) | 118 optimizer.finetune(datasets.nist_all(),datasets.nist_P07(),max_finetune_epoch_NIST,ind_test=1) |
119 optimizer.finetune(datasets.nist_P07,max_finetune_epoch_P07) | 119 optimizer.finetune(datasets.nist_P07(),datasets.nist_all(),max_finetune_epoch_P07,ind_test=0) |
120 channel.save() | 120 channel.save() |
121 | 121 |
122 channel.save() | 122 channel.save() |
123 | 123 |
124 return channel.COMPLETE | 124 return channel.COMPLETE |