keras模型 鸾尾花数据集_如何在tensorflow.keras模型指标中使用sklearn AUC?

test_input_data=[text_test_1,state_test,grade_test,cat_test,subcat_test,teach_test,num_test]score=model.evaluate(test_input_data,y_test,verbose=1)print('test_loss: ',score[0])print('test_acc: ',score[1])in()1test_input_data=[text_test_1,state_test,grade_test,cat_test,subcat_test,teach_test,num_test]---->2score=model.evaluate(test_input_data,y_test,verbose=1)3print('test_loss: ',score[0])4print('test_acc: ',score[1])3frames/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.pyin__call__(self,*args,**kwargs)1456ret=tf_session.TF_SessionRunCallable(self._session._session,1457self._handle,args,->1458run_metadata_ptr)1459ifrun_metadata:1460proto_data=tf_session.TF_GetBuffer(run_metadata_ptr)InvalidArgumentError:2root error(s)found.(0)Invalidargument:ValueError:Onlyoneclasspresentiny_true.ROC AUC scoreisnotdefinedinthat case.Traceback(most recent call last):File"/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/script_ops.py",line209,in__call__

ret=func(*args)File"/usr/local/lib/python3.6/dist-packages/sklearn/metrics/ranking.py",line355,inroc_auc_score

sample_weight=sample_weight)File"/usr/local/lib/python3.6/dist-packages/sklearn/metrics/base.py",line76,in_average_binary_scorereturnbinary_metric(y_true,y_score,sample_weight=sample_weight)File"/usr/local/lib/python3.6/dist-packages/sklearn/metrics/ranking.py",line323,in_binary_roc_auc_scoreraiseValueError("Only one class present in y_true. ROC AUC score "ValueError:Onlyoneclasspresentiny_true.ROC AUC scoreisnotdefinedinthat case.[[{{node metrics_15/auc/PyFunc}}]](1)Invalidargument:ValueError:Onlyoneclasspresentiny_true.ROC AUC scoreisnotdefinedinthat case.Traceback(most recent call last):File"/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/script_ops.py",line209,in__call__

ret=func(*args)File"/usr/local/lib/python3.6/dist-packages/sklearn/metrics/ranking.py",line355,inroc_auc_score

sample_weight=sample_weight)File"/usr/local/lib/python3.6/dist-packages/sklearn/metrics/base.py",line76,in_average_binary_scorereturnbinary_metric(y_true,y_score,sample_weight=sample_weight)File"/usr/local/lib/python3.6/dist-packages/sklearn/metrics/ranking.py",line323,in_binary_roc_auc_scoreraiseValueError("Only one class present in y_true. ROC AUC score "ValueError:Onlyoneclasspresentiny_true.ROC AUC scoreisnotdefinedinthat case.[[{{node metrics_15/auc/PyFunc}}]][[metrics_15/auc/PyFunc/_1683]]0successful operations.0derived errors ignored.

你可能感兴趣的:(keras模型,鸾尾花数据集)