I am quite new in training and testing my prediction model, therefore I need some help in order to get a solution for my code. I am working on a crime rate prediction of chicago where I would like to see how the trend will be in the future. My dataset is ranged from 2011 till 2016 with data. I split the data into a train and a test dataset with this code:
ind <- sample(2, nrow(Year12_16), replace = TRUE, prob = c(0.8,0.2)) trainData <- Year12_16[ind==1,] testData <- Year12_16[ind==2,]
where Year12_16 represents my complete dataset.
What would be now the next step? I have run a prediction via prophet that looks so:
trainDf <- trainData %>% group_by(Date2) %>% summarise(y = n()) %>% mutate(y = log(y))
names(trainDf) <- c("ds", "y")
trainDf$ds <- factor(trainDf$ds)
m <- prophet(trainDf)
future <- make_future_dataframe(m, 365*3)
forecast <- predict(m, future)
tail(forecast[c('ds', 'yhat', 'yhat_lower', 'yhat_upper')])
plot(m, forecast, xlabel = "Year", ylabel = "Data")+ggtitle("Forecast of Crimes in Chicago")
But what should I test now, or should i run the prediction on my test data? Just need some background information how to do this. I also read a lot about forecast errors. How can I find them out?
Aucun commentaire:
Enregistrer un commentaire