File tree 1 file changed +13
-8
lines changed 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -165,15 +165,20 @@ def pre_initialize():
165
165
166
166
labels = ['Locate' , 'Describe' , 'No_Op' ]
167
167
168
+ trials = 10
169
+
168
170
for command in commands :
169
- print ("Command " + command )
170
- filtered_commands = filter_stopwords ([command ], stopwords_list )
171
- seq = tokenizer .texts_to_sequences (filtered_commands )
172
- padded = pad_sequences (seq , maxlen = MAX_SEQUENCE_LENGTH )
173
- start = time .time ()
174
- pred = model .predict (padded )
175
- delta = time .time () - start
176
- dataframe = dataframe .append ({'command' : command , 'time' : delta , 'class' : labels [np .argmax (pred )]}
171
+ _time = 0.0
172
+ for i in range (trials ):
173
+ print ("Command " + command )
174
+ filtered_commands = filter_stopwords ([command ], stopwords_list )
175
+ seq = tokenizer .texts_to_sequences (filtered_commands )
176
+ padded = pad_sequences (seq , maxlen = MAX_SEQUENCE_LENGTH )
177
+ start = time .time ()
178
+ pred = model .predict (padded )
179
+ delta = time .time () - start
180
+ _time = _time + delta
181
+ dataframe = dataframe .append ({'command' : command , 'time' : _time / trials , 'class' : labels [np .argmax (pred )]}
177
182
, ignore_index = True )
178
183
179
184
dataframe .to_csv ('predictions.csv' , index = False )
You can’t perform that action at this time.
0 commit comments