Skip to content

Commit a8fd6b2

Browse files
chart added
1 parent 0ade059 commit a8fd6b2

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

classifier.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,20 @@ def pre_initialize():
165165

166166
labels = ['Locate', 'Describe', 'No_Op']
167167

168+
trials = 10
169+
168170
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)]}
177182
, ignore_index=True)
178183

179184
dataframe.to_csv('predictions.csv', index=False)

0 commit comments

Comments
 (0)