Git Product home page Git Product logo

numgp's Introduction

numgp's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

numgp's Issues

Ice core example

Hi there,

Thanks for the great library, it was exactly what I was looking for! I am attempting to port the Mauna Lao CO2 model (example notebook here) but was running into difficulties when using the predict method, the model is basically.

def model(X, y, Xnew):

    T = X.shape[0]

    η = numpyro.sample('η', dist.HalfNormal(5))
     = numpyro.sample('ℓ', dist.Gamma(4, 2))
    α = numpyro.sample('α', dist.Gamma(3, 1))  
    cov = η**2 * npg.cov.RatQuad(1, α, )

    gp = npg.gp.Marginal('f', cov_func=cov)

    t_diff = numpyro.sample('t_diff', dist.Normal(0., 0.02), sample_shape=(T,))
    t_uncert = X - t_diff

    σ = numpyro.sample('σ', dist.HalfNormal(5))
    
    y_ = gp.marginal_likelihood(X=t_uncert[:, None], y=y, noise=σ)
    
    _ = gp.conditional(t_uncert[:, None], Xnew)

Train methods:

svi = SVIHandler(model, AutoDiagonalNormal(model), num_epochs=10000)
svi.fit(t_n, y_train, None, True, return_sites=('ℓ', 'η', 'α', 'σ', 'f'))

Predict methods:

Xnew = np.linspace(-100, 2150, 2000) * 0.01

marg = MarginalConditional(model, 'f')
mu, var = marg.conditional_from_guide(
    svi.guide, 
    svi.params, 
    X,
    y_train, 
    Xnew[:, None]
)

However, when it comes to make predictions based on the new data, it only returns nan is there something I'm missing?

 with numpyro.handlers.seed(rng_seed=34):
    pred = numpyro.sample('pred', dist.MultivariateNormal(loc=mu, covariance_matrix=var).expand([200]))
pred
>>> Array([[nan, nan, nan, ..., nan, nan, nan],
           [nan, nan, nan, ..., nan, nan, nan],
           [nan, nan, nan, ..., nan, nan, nan],
           ...,
           [nan, nan, nan, ..., nan, nan, nan],
           [nan, nan, nan, ..., nan, nan, nan],
           [nan, nan, nan, ..., nan, nan, nan]], dtype=float32)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.