Skip to content

Commit 0593eda

Browse files
committed
Updated optimizer
1 parent 87cc2ac commit 0593eda

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ embedded_intent_classifier:
1919
# drop rate to avoid overfitting
2020
drop_rate: 0.5
2121
# early stop training in case of not improving
22-
early_stopping: True
22+
early_stopping: False

data/demo.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"examples": {
3+
"intents": [
4+
{
5+
"text": "about",
6+
"intent": "about"
7+
},
8+
{
9+
"text": "I want to learn about the platform",
10+
"intent": "about"
11+
},
12+
{
13+
"text": "learn more",
14+
"intent": "about"
15+
},
16+
{
17+
"text": "start",
18+
"intent": "start"
19+
},
20+
{
21+
"text": "hello",
22+
"intent": "start"
23+
},
24+
{
25+
"text": "hi",
26+
"intent": "start"
27+
}
28+
]
29+
},
30+
"lang": "en"
31+
}

smartloop/core/nlu/classifiers/embedding_intent_classifier.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ def __fit(self, model, features, intent):
107107
if self.cfg.logs:
108108
callbacks.append(TensorBoard(log_dir=log_dir))
109109

110-
early_stopping = self.cfg.embedded_intent_classifier.get('early_stopping', False)
110+
early_stopping = self.cfg.embedded_intent_classifier.get('early_stopping')
111111

112112
if early_stopping:
113-
callbacks.append(EarlyStopping(monitor='accuracy', mode='max', patience=10))
113+
callbacks.append(EarlyStopping(monitor='accuracy', patience=20))
114114

115115
model.fit(
116116
features,
117117
intent,
118-
validation_split=0.2,
118+
validation_split=0.3,
119119
epochs=self.cfg.epochs,
120120
callbacks=[
121121
callbacks
@@ -204,7 +204,7 @@ def __build_model(self, input_dim, output_dim, input_length, neurons, drop_rate,
204204
decay_steps=100,
205205
decay_rate=0.9)
206206

207-
optimizer = keras.optimizers.Adam(learning_rate=lr_schedule)
207+
optimizer = keras.optimizers.RMSprop(learning_rate=lr_schedule)
208208

209209
model.compile(
210210
loss=keras.losses.SparseCategoricalCrossentropy(),

smartloop/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.0.7'
1+
__version__ = '1.0.8'

0 commit comments

Comments
 (0)