
Discounted return (Geron Ch 18, morie.fn grret)
Source:R/geron_train_native.R
morie_geron_discounted_return.RdG_t = r_t + gamma G_{t+1} by a backward sweep; effective horizon
1/(1-gamma).
Examples
morie_geron_discounted_return(rewards = c(1, 2, 3, 4, 5, 6, 7, 8), gamma = 0.5)
#> $returns
#> [1] 3.921875 5.843750 7.687500 9.375000 10.750000 11.500000 11.000000
#> [8] 8.000000
#>
#> $G0
#> [1] 3.921875
#>
#> $gamma
#> [1] 0.5
#>
#> $effective_horizon
#> [1] 2
#>
#> $estimate
#> [1] 3.921875
#>
#> $n
#> [1] 8
#>