提交 e764e145 编写于 作者: G guru4elephant

add auc runner

上级 e489fc4a
......@@ -3,6 +3,7 @@ import paddle
import sys
import os
import criteo_reader as criteo
from paddle_serving_client.metric import auc
client = Client()
client.load_client_config(sys.argv[1])
......@@ -16,6 +17,8 @@ test_filelists = ["{}/part-%d".format(sys.argv[2]) % x
for x in range(len(os.listdir(sys.argv[2])))]
reader = dataset.infer_reader(test_filelists[len(test_filelists)-40:], batch, buf_size)
label_list = []
prob_list = []
for data in reader():
feed_dict = {}
feed_dict["dense_0"] = data[0][0]
......@@ -23,5 +26,7 @@ for data in reader():
feed_dict["sparse_{}".format(i - 1)] = data[0][i]
feed_dict["label"] = data[0][-1]
fetch_map = client.predict(feed=feed_dict, fetch=["prob"])
print("{} {}".format(fetch_map["prob"][0], data[0][-1][0]))
prob_list.append(fetch_map["prob"][0])
label_list.append(data[0][-1][0])
print(auc(prob_list, label_list))
......@@ -11,3 +11,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from auc import auc
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册