jocicmarko / ultrasound-nerve-segmentation

Deep Learning Tutorial for Kaggle Ultrasound Nerve Segmentation competition, using Keras
MIT License
939 stars 329 forks source link

y_true and y_pred #44

Closed pratikgorji closed 7 years ago

pratikgorji commented 7 years ago

y_true : 1d array-like, or label indicator array / sparse matrix Ground truth (correct) target values. y_pred : 1d array-like, or label indicator array / sparse matrix Estimated targets as returned by a classifier.

what is y_true and y_pred in this code ? in this code , how is he reading y_true and y_pred . Where is he defining y_true, y_pred ? I dint find any.

https://github.com/jocicmarko/ultrasound-nerve-segmentation/blob/master/train.py#L19

I tried to print y_true and y_pred , but it says it is not defined. Can anyone say , where he is defining y_true and y_pred ? !!

EloyRoura commented 7 years ago

y_true and y_pred are not defined in this code, but they shouldn't be. This is just a definition of the custom metrics that keras will be using. So basically, this y_true should be the target_class y that you fit into your network, and y_pred is nothing but the prediction of this class at every epoch.

You can have a look at keras documentation https://keras.io/metrics/. Also at their source code in https://github.com/fchollet/keras/blob/master/keras.

If you debug this a little bit, you will see how this function is passed to the keras engine at compilation time, and then used in its own inside.

pratikgorji commented 7 years ago

Thanx EloyRoura

mrgloom commented 7 years ago

Is it possible to print shape of y_true and y_pred ? Looks like int_shape can be used? https://keras.io/backend/#int_shape