Prediction of single time points
Closed this issue · 1 comments
Hi!
This might be related to issue #45, but it is just a small issue.
I'm trying to randomly select time points for which to predict. Using the code from issue #45, this does not work (i.e. predicting just one time point):
block <- data.frame( time=1:10, x=sin((1:10)/pi), y=cos((1:10)/pi) )
out2 <- block_lnlp(block,pred=c(4,4),tp=1,columns=c("x","y"),target_column = "x",stats_only = FALSE)
Error in RtoCpp_Simplex(pathIn, dataFile, dataFrame, pathOut, predictFile, :
Parameters::Validate(): prediction start 4 exceeds end 4.
So I tried to use pred=c(4,5)
instead of pred=c(4,4)
:
out3 <- block_lnlp(block,pred=c(4,5),tp=1,columns=c("x","y"),target_column = "x",stats_only = FALSE)
out3$model_output
Index Observations Predictions Pred_Variance Const_Predictions
1 4 0.9560557 NaN NaN NaN
2 5 0.9997847 0.9244915 0.00336703 0.9560557
3 6 0.9430667 0.8738918 0.01783972 0.9997847
As can be seen, 2 time points are predicted instead of 1 (and additionally, neither of the 2 is time index 4, the predicted ones are 5 and 6). This is probably the expected behavior for pred=c(4,5)
, but it is not possible to predict "isolated" time points.
This is not a big issue, as I can code a workaround, but I would appreciate it if it were possible to predict single time points. It might be just as simple as changing the implementation such that prediction start can be the same as prediction end (see error message above -- but this is just a guess).
And as a side note, this code gives the following warning:
out4 <- block_lnlp(block,pred=rbind(c(4,5),c(7,8)),tp=1,columns=c("x","y"),target_column = "x",stats_only = FALSE)
WARNING: Validate(): Disjoint prediction sets are not fully supported. Use with caution.
So I'm wondering whether it is better not to use disjoint prediction sets?
Cheers,
Uriah
Hi Uriah,
Unfortunately, the current code doesn't output a single row data frame since it presumes that pred
spans at least two rows. It will always output the (at least 2) pred rows, plus Tp
rows. However, since it returns a data.frame, it should be easy to select what you want.
Disjoint prediction sets are not correctly implemented. Apologies.
For new code, I suggest to use the new API: Simplex
, SMap
, CCM
... etc rather than the legacy one: block_lnlp
etc.