PCA prediction on fresh data with no response information

Hello,

I am using train function and PCA regression using caret. When predicting where the predicting dataset does not have a response (valid_data) I am getting an error. How is this done? I don't have any beta coefficients to use?

```{r,echo=FALSE}
suppressMessages(library(caret))
set.seed(12345)
model <- train(
  Y~., data=train_data[-1] , 
  method="pcr",
  scale=TRUE,
)
 predictions <- predict(model,valid_data) 
> report <- data.frame(Rsquare=caret::R2(predictions,valid_data$Y),RMSE=caret::RMSE(predictions, valid_data$Y))
Warning: the standard deviation is zero
> Rsquared <- model$results$Rsquared

Thank you.

1 Like

its ambiguous whether you have Y in valid_data or not.
if you do, whats the issue ?
if you don't, then you can't involve it in assessing the quality of your predictions, so don't do that.

Y is not in dataset valid_data.
Interesting reply. Thank you.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.