Skip to content

Commit

Permalink
docs: more readme
Browse files Browse the repository at this point in the history
  • Loading branch information
m-muecke committed Dec 26, 2024
1 parent 83550c8 commit c5beff3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
2 changes: 2 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ rr = resample(new_task, ff, resampling)
rr$aggregate(measure)
```

### WIP

```{r, eval = FALSE}
# doesn't work since the graph learner does its own thing
glrn = as_learner(pop %>>% ff)$train(task)
Expand Down
44 changes: 23 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,31 @@ prediction = ff$predict_newdata(newdata, task)
prediction
#> <PredictionRegr> for 3 observations:
#> row_ids truth response
#> 1 NA 450.8260
#> 2 NA 468.3018
#> 3 NA 443.5910
#> 1 NA 449.4614
#> 2 NA 474.3040
#> 3 NA 485.6794
prediction = ff$predict(task, 142:144)
prediction
#> <PredictionRegr> for 3 observations:
#> row_ids truth response
#> 1 461 462.1091
#> 2 390 412.6569
#> 3 432 387.0121
#> 1 461 453.5201
#> 2 390 412.6527
#> 3 432 398.0713
prediction$score(measure)
#> regr.rmse
#> 29.08878
#> 23.94613

resampling = rsmp("forecast_holdout", ratio = 0.8)
rr = resample(task, ff, resampling)
rr$aggregate(measure)
#> regr.rmse
#> 106.1036
#> 110.7019

resampling = rsmp("forecast_cv")
rr = resample(task, ff, resampling)
rr$aggregate(measure)
#> regr.rmse
#> 52.05099
#> 52.52531
```

### Multivariate
Expand All @@ -87,41 +87,43 @@ prediction = ff$predict(new_task, 142:144)
ff$predict(new_task, 142:144)
#> <PredictionRegr> for 3 observations:
#> row_ids truth response
#> 1 461 450.8613
#> 2 390 408.7569
#> 3 432 405.0463
#> 1 461 448.1974
#> 2 390 406.6182
#> 3 432 405.1209
prediction$score(measure)
#> regr.rmse
#> 19.84202
#> 19.6855

row_ids = new_task$nrow - 0:2
ff$predict_newdata(new_task$data(rows = row_ids), new_task)
#> <PredictionRegr> for 3 observations:
#> row_ids truth response
#> 1 432 408.5391
#> 2 390 388.5220
#> 3 461 391.3046
#> 1 432 398.9129
#> 2 390 390.0026
#> 3 461 379.8090
newdata = new_task$data(rows = row_ids, cols = new_task$feature_names)
ff$predict_newdata(newdata, new_task)
#> <PredictionRegr> for 3 observations:
#> row_ids truth response
#> 1 NA 408.5391
#> 2 NA 388.5220
#> 3 NA 391.3046
#> 1 NA 398.9129
#> 2 NA 390.0026
#> 3 NA 379.8090

resampling = rsmp("forecast_holdout", ratio = 0.8)
rr = resample(new_task, ff, resampling)
rr$aggregate(measure)
#> regr.rmse
#> 80.40145
#> 81.72021

resampling = rsmp("forecast_cv")
rr = resample(new_task, ff, resampling)
rr$aggregate(measure)
#> regr.rmse
#> 43.81449
#> 42.64055
```

### WIP

``` r
# doesn't work since the graph learner does its own thing
glrn = as_learner(pop %>>% ff)$train(task)
Expand Down

0 comments on commit c5beff3

Please sign in to comment.