提交 d7777a77 编写于 作者: X xjqbest

fix

上级 5777d636
...@@ -61,3 +61,8 @@ executor: ...@@ -61,3 +61,8 @@ executor:
dataset_name: dataset_2 # 名字,用来区分不同的阶段 dataset_name: dataset_2 # 名字,用来区分不同的阶段
thread_num: 1 # 线程数 thread_num: 1 # 线程数
is_infer: False # 是否是infer is_infer: False # 是否是infer
# - name: infer
# model: "{workspace}/model.py" # 模型路径
# dataset_name: dataset_2 # 名字,用来区分不同的阶段
# thread_num: 1 # 线程数
# is_infer: True # 是否是infer
...@@ -77,17 +77,21 @@ class Model(ModelBase): ...@@ -77,17 +77,21 @@ class Model(ModelBase):
self.predict = predict self.predict = predict
cost = fluid.layers.cross_entropy(
input=self.predict, label=self.label_input)
avg_cost = fluid.layers.reduce_mean(cost)
self._cost = avg_cost
auc, batch_auc, _ = fluid.layers.auc(input=self.predict, auc, batch_auc, _ = fluid.layers.auc(input=self.predict,
label=self.label_input, label=self.label_input,
num_thresholds=2**12, num_thresholds=2**12,
slide_steps=20) slide_steps=20)
if is_infer:
self._infer_results["AUC"] = auc
self._infer_results["BATCH_AUC"] = batch_auc
return
self._metrics["AUC"] = auc self._metrics["AUC"] = auc
self._metrics["BATCH_AUC"] = batch_auc self._metrics["BATCH_AUC"] = batch_auc
cost = fluid.layers.cross_entropy(
input=self.predict, label=self.label_input)
avg_cost = fluid.layers.reduce_mean(cost)
self._cost = avg_cost
def optimizer(self): def optimizer(self):
optimizer = fluid.optimizer.Adam(self.learning_rate, lazy_mode=True) optimizer = fluid.optimizer.Adam(self.learning_rate, lazy_mode=True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册