Explaining negative R-squared
<p>Following the above definitions, SS_tot can be calculated using just the data itself, while SS_res depends both on model predictions and the data. While we can use any arbitrary model to generate the predictions for scoring, we need to realize that the aforementioned equality is defined for <em>models trained on the same data</em>. Therefore, it doesn’t necessarily hold true when we use test data to evaluate models built on train data! There is no guarantee that the differences between a foreign model’s predictions and the data is smaller than the variation within the data itself.</p>
<p>We can demonstrate this empirically. The code below fits a couple of linear regression models on randomly generated data:</p>
<p><a href="https://towardsdatascience.com/explaining-negative-r-squared-17894ca26321"><strong>Click Here</strong></a></p>