So roughly speaking this scales as K knots x N obs (as long as K is small enough so the GP part doesn't dominate). It avoids issues with observations at identical locations, and even my naively coded Stan version works faster than a pure Stan GP for moderate numbers of observations. As long as there are enough knots it seems like the parameters of the GP are recovered relatively well when I simulate data and fit the true model... and I can still calculate the covariance for any two points. The questions I have are:
1) Is this sort of model common in some context? Does it have a name?
2) Any suggestions for making the Stan implementation faster?
3) Is some other approx. GP approach better suited to a Stan implementation currently?
It's a little odd to think of the uncertainty in GP parameters to depend on the number of knots but other than that I haven't found any other issues with this... which makes me uncomfortable.
Thanks for any insight,
Krzysztof
--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<gaussfrankenspline.stan>
Hi, I’m not sure about this one but we’ve been talking about approximate GP’s using inducing points. I’m cc-ing Louis Mittel who’s working on this.
Louis: this is another motivation for us to get this project done, then we’d have some code that people can imitate and generalize!
Thanks for sharing the model. The code's pretty much optimal
as you wrote it. I also really like the way the names of the functions
and the way they're organized make the model understandable
from the model down.
krzysiek@fawkes ~/packages/cmdstan-2.5.0/cmdstan $ make ~/packages/gaussianfrankenspline/gaussfrankenspline
--- Translating Stan model to C++ code ---
bin/stanc /home/krzysiek/packages/gaussianfrankenspline/gaussfrankenspline.stan --o=/home/krzysiek/packages/gaussianfrankenspline/gaussfrankenspline.cpp --no_main
Model name=gaussfrankenspline_model
Input file=/home/krzysiek/packages/gaussianfrankenspline/gaussfrankenspline.stan
Output file=/home/krzysiek/packages/gaussianfrankenspline/gaussfrankenspline.cpp
--- Linking C++ model ---
g++ -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -I src -I stan/src -isystem stan/lib/eigen_3.2.0 -isystem stan/lib/boost_1.54.0 -Wall -pipe -DEIGEN_NO_DEBUG -Wno-unused-local-typedefs -lpthread -O3 -o /home/krzysiek/packages/gaussianfrankenspline/gaussfrankenspline src/cmdstan/main.cpp -include /home/krzysiek/packages/gaussianfrankenspline/gaussfrankenspline.cpp -Lbin -lstan
In file included from <command-line>:0:0:
/home/krzysiek/packages/gaussianfrankenspline/gaussfrankenspline.cpp:457:8: error: redefinition of ‘struct gaussfrankenspline_model_namespace::yday_circular_spline_functor__’
struct yday_circular_spline_functor__ {
^
In file included from <command-line>:0:0:
/home/krzysiek/packages/gaussianfrankenspline/gaussfrankenspline.cpp:422:8: error: previous definition of ‘struct gaussfrankenspline_model_namespace::yday_circular_spline_functor__’
struct yday_circular_spline_functor__ {
^
In file included from stan/src/stan/agrad/rev/operators/operator_unary_plus.hpp:7:0,
from stan/src/stan/agrad/rev/operators.hpp:22,
from stan/src/stan/agrad/rev.hpp:13,
from stan/src/stan/model/model_header.hpp:16,
from /home/krzysiek/packages/gaussianfrankenspline/gaussfrankenspline.cpp:3,
from <command-line>:0:
stan/src/stan/math/constants.hpp:63:18: warning: ‘stan::math::NEGATIVE_EPSILON’ defined but not used [-Wunused-variable]
const double NEGATIVE_EPSILON = - std::numeric_limits<double>::epsilon();
^
make/models:9: recipe for target '/home/krzysiek/packages/gaussianfrankenspline/gaussfrankenspline' failed
make: *** [/home/krzysiek/packages/gaussianfrankenspline/gaussfrankenspline] Error 1
real yday_circular_spline_internal(
real yday,
vector knot_points, vector knot_weights, real knot_scale
) {
real theta;
real y;
theta <- day_to_angle(yday);
y <- circular_spline(theta, knot_points, knot_weights, knot_scale);
return y;
}
vector yday_circular_spline(
vector yday,
vector knot_points, vector knot_weights, real knot_scale
) {
vector[num_elements(yday)] positions;
for ( i in 1:num_elements(yday)) {
positions[i] <- yday_circular_spline_internal(
yday[i], knot_points, knot_weights, knot_scale );
}
return(positions);
}
Thanks---that's a known issue
https://github.com/stan-dev/stan/issues/1096
I need to clean up for 2.5.0++. Extending functions to functors allowed
us to plug them into diff eqs, but broke our ability to overload them.
- Bob