To find r2score of my model #6125
-
I have a UNet model. I'm trying for a regression model since, in my output, I have different floating values for each pixel. In order to check the r2score, I tried to put the below code in the 'model class', training_step, validation_step, and test_step.
But it's giving the following error
How can I check my model fit? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I assume that you just want to calculate the total score, and in that case you should simply flatten your input before calculating the score: from pytorch_lightning.metrics.functional import r2score
r2 = r2score(logits.flatten(), y.flatten())
self.log('r2:',r2) |
Beta Was this translation helpful? Give feedback.
I assume that you just want to calculate the total score, and in that case you should simply flatten your input before calculating the score: