Accuracy of linear model

Hi! I am trying to figure out how I can calculate the accuracy of a linear regression model, but can’t seem to think of any way to do so.

Given that I have the y values and the y_hat predictions from my Linear model, how can I calculate the accuracy? Note that the dimensions of each y in a batch is [53, 1] and each y_hat is also the same.

Thank you!

I do not know of anything like accuracy of a regression model. Instead, you can try using Loss functions like Mean Squared Error (MSE). Example

>>> loss = nn.MSELoss()
>>> input = torch.randn(3, 5, requires_grad=True)
>>> target = torch.randn(3, 5)
>>> output = loss(input, target)

In your case input is [53,1] and target is also [53,1] as you expalined.
Source MSE in Pytorch

Hope it helps

1 Like