提交 7f7acc70 编写于 作者: M MRXLT

fix abtest doc

上级 c43e4a2d
...@@ -21,7 +21,7 @@ The following Python code will process the data `test_data/part-0` and write to ...@@ -21,7 +21,7 @@ The following Python code will process the data `test_data/part-0` and write to
[//file]:#process.py [//file]:#process.py
``` python ``` python
from imdb_reader import IMDBDataset from paddle_serving_app.reader import IMDBDataset
imdb_dataset = IMDBDataset() imdb_dataset = IMDBDataset()
imdb_dataset.load_resource('imdb.vocab') imdb_dataset.load_resource('imdb.vocab')
...@@ -78,7 +78,7 @@ with open('processed.data') as f: ...@@ -78,7 +78,7 @@ with open('processed.data') as f:
feed = {"words": word_ids} feed = {"words": word_ids}
fetch = ["acc", "cost", "prediction"] fetch = ["acc", "cost", "prediction"]
[fetch_map, tag] = client.predict(feed=feed, fetch=fetch, need_variant_tag=True) [fetch_map, tag] = client.predict(feed=feed, fetch=fetch, need_variant_tag=True)
if (float(fetch_map["prediction"][1]) - 0.5) * (float(label[0]) - 0.5) > 0: if (float(fetch_map["prediction"][0][1]) - 0.5) * (float(label[0]) - 0.5) > 0:
cnt[tag]['acc'] += 1 cnt[tag]['acc'] += 1
cnt[tag]['total'] += 1 cnt[tag]['total'] += 1
......
...@@ -20,7 +20,7 @@ sh get_data.sh ...@@ -20,7 +20,7 @@ sh get_data.sh
下面Python代码将处理`test_data/part-0`的数据,写入`processed.data`文件中。 下面Python代码将处理`test_data/part-0`的数据,写入`processed.data`文件中。
```python ```python
from imdb_reader import IMDBDataset from paddle_serving_app.reader import IMDBDataset
imdb_dataset = IMDBDataset() imdb_dataset = IMDBDataset()
imdb_dataset.load_resource('imdb.vocab') imdb_dataset.load_resource('imdb.vocab')
...@@ -76,7 +76,7 @@ with open('processed.data') as f: ...@@ -76,7 +76,7 @@ with open('processed.data') as f:
feed = {"words": word_ids} feed = {"words": word_ids}
fetch = ["acc", "cost", "prediction"] fetch = ["acc", "cost", "prediction"]
[fetch_map, tag] = client.predict(feed=feed, fetch=fetch, need_variant_tag=True) [fetch_map, tag] = client.predict(feed=feed, fetch=fetch, need_variant_tag=True)
if (float(fetch_map["prediction"][1]) - 0.5) * (float(label[0]) - 0.5) > 0: if (float(fetch_map["prediction"][0][1]) - 0.5) * (float(label[0]) - 0.5) > 0:
cnt[tag]['acc'] += 1 cnt[tag]['acc'] += 1
cnt[tag]['total'] += 1 cnt[tag]['total'] += 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册