モデルが行う「分類」の内容は,個人が 'survived' に属する確率である。
この表現形式の分類を,「prediction」と呼ぶ:
>>> predictions = model.predict(test_data)
2021-04-23 14:49:14.526304: W
tensorflow/core/common_runtime/base_collective_executor.cc:217]
BaseCollectiveExecutor::
StartAbort Out of range:
End of sequence
[[{{node IteratorGetNext}}]]
>>> predictions
array([
[-3.322],
[ 7.695],
[-3.136],
[ 0.285],
[-1.36 ],
[-3.577],
[-1.533],
[-0.017],
[ 2.279],
[-1.126],
:
:
[-3.465]], dtype=float32)
(264 件)
>>> predictions[:10]
array([
[-3.322],
[ 7.695],
[-3.136],
[ 0.285],
[-1.36 ],
[-3.577],
[-1.533],
[-0.017],
[ 2.279],
[-1.126]], dtype=float32)
>>> predictions[0]
array([-3.322], dtype=float32)
>>> for prediction, survived in zip(predictions[:10], list(test_data)[0][1][:10]):
... print("Predicted survival: {:.2%}".format(prediction[0]),
... " | Actual outcome: ",
... ("SURVIVED" if bool(survived) else "DIED"))
...
Predicted survival: -332.18% | Actual outcome: SURVIVED
Predicted survival: 769.54% | Actual outcome: SURVIVED
Predicted survival: -313.61% | Actual outcome: DIED
Predicted survival: 28.53% | Actual outcome: SURVIVED
Predicted survival: -136.00% | Actual outcome: DIED
|