You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use the MeanLin function but keep running into method errors.
I saw that these issues related to MeanLin were opened and closed, but I have been unable to recreate their solution: #222 #47
In issue #47, they used the following code (in Julia 0.5):
x = [-4.0,-3.0,-1.0,0.0,2.0];
y = 2.0x + 0.5rand(5);
xpred = collect(-5.0:0.1:5.0);
mean = MeanLin([0.5]) # linear mean function
kern = SE(0.0,0.0) # squared exponential kernel function
gp = GP(x,y,mean,kern) # fit the GP
When I try running above code, here is the error text and the (beginning of the) stacktrace:
I then tried updating the code so that MeanLin would use an actual vector input. Since the mean function is for the model prior, I set the length of the mean vector to be the same as the test / predict points, still didn't work. Just to try everything, I then set the mean vector length to be the same as the training points, no dice:
xtrain = [-4.0, -3.0, -1.0, 0.0, 2.0]
ytrain = 2.0 * x + 0.5 * rand(5)
xpred = collect( -5.0 : 0.1 : 5.0 )
# mLin = MeanLin( 0 * xtrain ) # linear mean function
mLin = MeanLin( 0 * xpred ) # linear mean function
kern = SE( 0.0, 0.0 ) # squared exponential kernel function
gp = GP( x, y, mLin, kern ) # fit the GP
In Issue #222, I cannot recreate his code at all as he uses code inputs that he doesn't include in his working example.
From mLin.jl, it looks like I should just be able to define some mean = MeanLin(β) where β is a vector and it should work? How to use MeanLin ?
mutable struct MeanLin <: Mean
"Linear coefficients"
β::Vector{Float64}
"Priors for mean parameters"
priors::Array
"""
MeanLin(β::Vector{Float64})
Create `MeanLin` with linear coefficients `β`.
"""
MeanLin(β::Vector{Float64}) = new(β, [])
end
The text was updated successfully, but these errors were encountered:
If I remember correctly, it used to be possible to fix this issue by taking the transpose of the vector. Have you tried MeanLin(β') instead of MeanLin(β)?
Hello,
I am trying to use the
MeanLin
function but keep running into method errors.I saw that these issues related to
MeanLin
were opened and closed, but I have been unable to recreate their solution:#222
#47
In issue #47, they used the following code (in Julia 0.5):
When I try running above code, here is the error text and the (beginning of the) stacktrace:
I then tried updating the code so that
MeanLin
would use an actual vector input. Since the mean function is for the model prior, I set the length of the mean vector to be the same as the test / predict points, still didn't work. Just to try everything, I then set the mean vector length to be the same as the training points, no dice:In Issue #222, I cannot recreate his code at all as he uses code inputs that he doesn't include in his working example.
From
mLin.jl
, it looks like I should just be able to define somemean = MeanLin(β)
where β is a vector and it should work? How to useMeanLin
?The text was updated successfully, but these errors were encountered: