Many compliments for the package! I was exactly looking for a Bayesian tree model with linear models at terminal nodes.
I ran your example and it worked but then I rewrote it to run with only one feature and I got the following error:
Error in sample.int(x, size, replace, prob) :
incorrect number of probabilities
local({
friedman_data = function(n, num_cov, sd_error){
x = runif(n)
y = 10*sin(pi*x*x) + 20*(x-.5)^2+10*x+5*x + rnorm(n, sd=sd_error)
return(list(y = y,
x = x))
}
# Training data
data = friedman_data(200, 10, 1)
y = data$y
x = data$x
# Test data
data_test = friedman_data(100, 10, 1)
y.test = data_test$y
x.test = data_test$x
# Run MOTR-BART
set.seed(99)
fit.motr.bart = motr_bart(x, y, ntrees = 10, nburn = 100, npost = 100)
})
Hello!
Many compliments for the package! I was exactly looking for a Bayesian tree model with linear models at terminal nodes.
I ran your example and it worked but then I rewrote it to run with only one feature and I got the following error:
This is the code I used: