Skip to main content

GPlib extension to learn the kernel function.

Project description

EvoCov

GPlib extension to learn the kernel function.

Setup evocov

  • Create and activate venv

    python3 -m venv .env
    
    source .env/bin/activate
    
  • Upgrade pip

    python -m pip install --upgrade pip
    
  • Install EvoCov package

    python -m pip install evocov
    

Use EvoCov

  • Import EvoCov and GPlib to use it in your python script.

    import gplib
    import evocov
    
  • Configure the fitting method.

    lml = gplib.me.LML()
    bic = gplib.me.BIC()
    
    fitting_method = evocov.fit.EvoCov(
        obj_fun=bic.fold_measure,
        max_fun_call=25000,
        nested_fit_method=gplib.fit.MultiStart(
            obj_fun=lml.fold_measure,
            max_fun_call=250,
            nested_fit_method=gplib.fit.LocalSearch(
                obj_fun=lml.fold_measure,
                method="Powell",
                max_fun_call=100
            )
        )
    )
    
  • Initialize the GP with None covariance function.

    gp = gplib.GP(
        mean_function=gplib.mea.Fixed(),
        covariance_function=fitting_method.get_random_kernel()
    )
    
  • Generate some random data.

    import numpy as np
    data = {
      'X': np.arange(3, 8, 1.)[:, None],
      'Y': np.random.uniform(0, 2, 5)[:, None]
    }
    
  • Fit the kernel and the hyperparameters to the training set.

    validation = gplib.vm.Full()
    
    log = fitting_method.fit(gp, validation.get_folds(
        data
    ))
    
  • Finally plot the posterior GP.

    posterior_gp = gp.get_posterior(data)
    gplib.plot.gp_1d(posterior_gp, data, n_samples=10)
    
  • There are more examples in examples/ directory. Check them out!

Develop EvoCov

  • Update API documentation

    source ./.env/bin/activate
    pip install Sphinx
    cd docs/
    sphinx-apidoc -f -o ./ ../evocov
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evocov-0.2.0.tar.gz (38.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evocov-0.2.0-py3-none-any.whl (52.0 kB view details)

Uploaded Python 3

File details

Details for the file evocov-0.2.0.tar.gz.

File metadata

  • Download URL: evocov-0.2.0.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for evocov-0.2.0.tar.gz
Algorithm Hash digest
SHA256 29367388b99de56cfe9da30c4c18ae5267ccc2f91465fa7b6aaf4b257ed97e9a
MD5 b0bb1663a72700f7c99388861b9326ce
BLAKE2b-256 5c909f69b9ddc11d23f9567f193485f4f7e1a0d167768143c2645c22780450a4

See more details on using hashes here.

File details

Details for the file evocov-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: evocov-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 52.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for evocov-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3aebb651cf5878056b4bed8b939122905edd50acfca1aa63b15fcfc9aef00189
MD5 7fcb13642854fec59fb4760864dd5482
BLAKE2b-256 d71f0239aff7cea4def1a8453409010e037fbc3cc0d29deaa55c45f5ab1415a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page