Skip to content

Fix bayes #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 116 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
a69550a
1st verson
yannrichet Sep 12, 2022
fa5fa36
fix & add R doc
yannrichet Sep 12, 2022
7af4d10
test md & codeblock
yannrichet Sep 12, 2022
a8676e1
...
yannrichet Sep 13, 2022
5570635
...
yannrichet Sep 13, 2022
e35837e
...
yannrichet Sep 14, 2022
57df250
sync with rlibkriging doc
yannrichet Sep 15, 2022
bd38661
see nugget predict interpolate
yannrichet Sep 15, 2022
b139a60
...
yannrichet Sep 15, 2022
e590339
incl. copy & update
yannrichet Nov 15, 2022
e935874
...
yannrichet Nov 15, 2022
d13efac
...
yannrichet Nov 15, 2022
85be161
...
yannrichet Nov 15, 2022
eb372cb
add collab link
yannrichet-asnr Nov 17, 2022
f16c26c
up doc with fit()
yannrichet Nov 22, 2022
26cbbb9
reorg
yannrichet Nov 23, 2022
a57ba84
fix syntax eq
yannrichet Nov 23, 2022
7ce8343
move functions exmaples in subdir
yannrichet Nov 23, 2022
8fc608f
...
yannrichet Nov 23, 2022
a369c4a
rename
yannrichet Nov 23, 2022
22dc17e
sed -i 's:../examples/:../functions/exmaples/:g' *.md
yannrichet Nov 23, 2022
7a72d52
use intern ipynb demo examples (& link to colab)
yannrichet Nov 23, 2022
e06b456
...
yannrichet Nov 23, 2022
edf39a8
basic demo nolang
yannrichet Nov 23, 2022
e53614e
basic demo nolang
yannrichet Nov 23, 2022
ae63247
basic demo nolang
yannrichet Nov 23, 2022
0d71fb5
fix path
yannrichet Nov 23, 2022
80cee26
formula for prior
yvesdeville Dec 7, 2022
eccf74b
prior...
yvesdeville Dec 7, 2022
c470b7f
Update logLikelihoodFun.NoiseKriging.md
yannrichet-asnr Dec 21, 2022
61e1048
add sklearn usage + fixes
yannrichet Dec 22, 2022
a6bd16b
...
yannrichet Dec 22, 2022
5613b2a
..
yannrichet Dec 22, 2022
28fd555
.
yannrichet Dec 22, 2022
d3decb5
..
yannrichet Dec 22, 2022
4d9db9e
up install (add CRAN, ...)
yannrichet Dec 23, 2022
446a0c5
trend
yvesdeville Mar 7, 2023
31b2e2e
trend
yvesdeville Mar 7, 2023
9c05e35
trend
yvesdeville Mar 7, 2023
a12dc4e
trend
yvesdeville Mar 7, 2023
f57e1dd
trend
yvesdeville Mar 7, 2023
1ae61f4
trend
yvesdeville Mar 7, 2023
d3116a8
trend
yvesdeville Mar 7, 2023
f6b95c0
trend and kernel
yvesdeville Mar 7, 2023
ee5ad99
kernel
yvesdeville Mar 7, 2023
923a75e
math
yvesdeville Mar 7, 2023
ec8e44e
math
yvesdeville Mar 7, 2023
a8bbf88
fixes
yvesdeville Mar 7, 2023
2f10663
fixes
yvesdeville Mar 7, 2023
5de5890
progressing
yvesdeville Mar 8, 2023
d4fc5a1
progressing
yvesdeville Mar 8, 2023
88823b9
progressing
yvesdeville Mar 8, 2023
88b4a35
progressing
yvesdeville Mar 8, 2023
ebb3746
progressing
yvesdeville Mar 8, 2023
eaf94b1
fixes and functions
yvesdeville Mar 9, 2023
5a21e16
linking functions and math
yvesdeville Mar 10, 2023
6e99634
progressing
yvesdeville Mar 10, 2023
c2b5e98
typo
yvesdeville Mar 13, 2023
73ceb0b
fixes
yvesdeville Mar 14, 2023
dd9dd0e
links
yvesdeville Mar 15, 2023
0619a15
clean biblio
yvesdeville Mar 15, 2023
108c62e
biblio
yvesdeville Mar 15, 2023
d477a45
Biblio
yvesdeville Mar 17, 2023
f0dae49
biblio and fixes
yvesdeville Mar 20, 2023
b876a48
LOO
yvesdeville Mar 20, 2023
5ef2e8a
fixes and biblio
yvesdeville Mar 21, 2023
bd2da4a
fixes and biblio
yvesdeville Mar 21, 2023
ff597c7
fixes and biblio
yvesdeville Mar 21, 2023
d370d75
fixes and biblio
yvesdeville Mar 21, 2023
d2d95ae
formatting biblio
yvesdeville Mar 22, 2023
d7171c0
fixes and spelling
yvesdeville Mar 22, 2023
49113ae
fixes and spelling
yvesdeville Mar 22, 2023
d015d40
biblio formatting
yvesdeville Mar 23, 2023
1cb7865
Merge pull request #3 from libKriging/master
yannrichet-asnr Apr 11, 2023
489dc6b
Merge pull request #4 from libKriging/yvesdeville-doc
yannrichet-asnr Apr 11, 2023
927e4dc
overwrite
yannrichet Apr 11, 2023
6fabb0b
Merge branch 'yvesdeville-master' into yvesdeville-doc
yannrichet Apr 11, 2023
815ab77
Update requirements.txt
yannrichet-asnr Apr 11, 2023
b9dd3b4
add save & load api
yannrichet May 21, 2023
711427d
typos
yvesdeville May 25, 2023
2c23253
Merge branch 'yvesdeville-doc'
yannrichet May 26, 2023
eac58a7
Merge branch 'master' of https://github.com/libKriging/readthedocs
yannrichet May 26, 2023
38ed977
add leaveOneOutVec doc
yannrichet Jun 2, 2023
da2b323
set version 0.8
yannrichet Jun 2, 2023
5afca87
more demos & fixes math
yannrichet Nov 22, 2023
35ffda6
Create .readthedocs.yaml
yannrichet Nov 22, 2023
07109c8
Update .readthedocs.yaml
yannrichet Nov 22, 2023
9832390
Update .readthedocs.yaml
yannrichet Nov 22, 2023
e5e9779
Update .readthedocs.yaml
yannrichet Nov 22, 2023
4fb4ee0
Update .readthedocs.yaml
yannrichet Nov 22, 2023
327e0e0
Update conf.py
yannrichet Nov 22, 2023
1487210
...
yannrichet Nov 22, 2023
4fd2045
...
yannrichet Nov 22, 2023
c46c05d
...
yannrichet Nov 22, 2023
4e1fff9
.
yannrichet Nov 22, 2023
01da0a7
fix lib.loc to use related dev
yannrichet Jun 5, 2024
6cad098
fix & add update_simulate
yannrichet Jun 5, 2024
6e7daa7
rm HDF5
yannrichet Jun 5, 2024
8ebf78e
display json content
yannrichet Jun 5, 2024
42a5bfa
incl. in toc
yannrichet Jun 5, 2024
813e644
add katex to support latex macros
yannrichet Jun 6, 2024
f7a7b27
typo
yannrichet Jun 6, 2024
c78c2df
progressing
yvesdeville Aug 26, 2024
905bfb4
update
yvesdeville Sep 4, 2024
fdba1f0
typos
yvesdeville Sep 5, 2024
1edef17
typos
yvesdeville Sep 6, 2024
7dec389
typos & macros
yvesdeville Sep 9, 2024
77b84b2
up to version 0.9
yannrichet Oct 7, 2024
76ccf44
<- v0.9
yannrichet Oct 7, 2024
e35c61d
Merge pull request #7 from libKriging/master
yannrichet Oct 7, 2024
f642ece
Update requirements.txt
yannrichet-asnr Oct 21, 2024
6a358e8
merge with yd doc
yannrichet Oct 29, 2024
a082f45
Merge pull request #9 from libKriging/yvupdate
yannrichet-asnr Oct 29, 2024
6aab14a
Merge pull request #10 from libKriging/v0.9
yannrichet-asnr Oct 29, 2024
80f752c
add libK optim & inv notebooks
yannrichet-asnr Nov 13, 2024
0d51078
Bayes: reference prior
yvesdeville Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.7"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
7 changes: 3 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
Template for the Read the Docs tutorial
Read the Docs tutorial for libKriging and bindings
=======================================

This GitHub template includes fictional Python library
with some basic Sphinx docs.
This GitHub repository includes documentation for libKriging.

Read the tutorial here:
Read the tutorial for readthedocs features here:

https://docs.readthedocs.io/en/stable/tutorial/
4 changes: 4 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
myst-parser
sphinxcontrib-bibtex
sphinx-rtd-theme
sphinxcontrib-katex
73 changes: 69 additions & 4 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,72 @@
API
===
=====

.. autosummary::
:toctree: generated
Following API doc supports:

lumache
* Python wrapper
* R wrapper
* Octave wrapper
* Matlab wrapper

.. include:: pyrm-syntax.md
:parser: myst_parser.sphinx_


Contructors
-----------

.. toctree::
:maxdepth: 1

functions/Kriging.md
functions/update.Kriging.md
functions/copy.Kriging.md
functions/saveload.Kriging.md
functions/NuggetKriging.md
functions/update.NuggetKriging.md
functions/copy.NuggetKriging.md
functions/saveload.NuggetKriging.md
functions/NoiseKriging.md
functions/update.NoiseKriging.md
functions/copy.NoiseKriging.md
functions/saveload.NoiseKriging.md

Fit objective
---------

.. toctree::
:maxdepth: 1

functions/fit.Kriging.md
functions/logLikelihood.Kriging.md
functions/logLikelihoodFun.Kriging.md
functions/leaveOneOut.Kriging.md
functions/leaveOneOutFun.Kriging.md
functions/leaveOneOutVec.Kriging.md
functions/logMargPost.Kriging.md
functions/logMargPostFun.Kriging.md
functions/fit.NuggetKriging.md
functions/logLikelihood.NuggetKriging.md
functions/logLikelihoodFun.NuggetKriging.md
functions/logMargPost.NuggetKriging.md
functions/logMargPostFun.NuggetKriging.md
functions/fit.NoiseKriging.md
functions/logLikelihood.NoiseKriging.md
functions/logLikelihoodFun.NoiseKriging.md


Prediction and simulation
---------

.. toctree::
:maxdepth: 1

functions/predict.Kriging.md
functions/simulate.Kriging.md
functions/update_simulate.Kriging.md
functions/predict.NuggetKriging.md
functions/simulate.NuggetKriging.md
functions/update_simulate.NuggetKriging.md
functions/predict.NoiseKriging.md
functions/simulate.NoiseKriging.md
functions/update_simulate.NoiseKriging.md
86 changes: 81 additions & 5 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@

# -- Project information

project = 'Lumache'
copyright = '2021, Graziella'
author = 'Graziella'
project = 'libKriging'
copyright = 'Apache License'
author = 'libKriging team'

release = '0.1'
version = '0.1.0'
release = '0.9'
version = '0.9.0'

# -- General configuration

extensions = [
'myst_parser',
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinxcontrib.bibtex',
'sphinxcontrib.katex',
]

intersphinx_mapping = {
Expand All @@ -31,5 +34,78 @@

html_theme = 'sphinx_rtd_theme'

bibtex_bibfiles = ['libKriging.bib']

# -- Options for EPUB output
epub_show_urls = 'footnote'

myst_enable_extensions = [
"amsmath",
"colon_fence",
"deflist",
"dollarmath",
"fieldlist",
"html_admonition",
"html_image",
"replacements",
"smartquotes",
"strikethrough",
"substitution",
"tasklist"
]

# -- added by Yves

import sphinxcontrib.katex as katex

latex_macros = r"""
\def \m #1{\mathbf{#1}}
\def \bs #1{\boldsymbol{#1}}
\def \LInv #1{#1^\star}
\def \LInvT #1{#1^{\star\top}}
\def \LInvHat #1{\widehat{#1}^{\star}}
\def \LInvHatT #1{\widehat{#1}^{\star\top}}
\def \RInv #1{#1^\circ}
\def \RInvT #1{#1^{\circ\top}}
\def \RInvHat #1{\widehat{#1}^{\circ}}
\def \RInvHatT #1{\widehat{#1}^{\circ\top}}
\def \LRInv #1{#1^{\star\circ}}
\def \LRInvT #1{#1^{\star\circ\top}}
\def \tr #1{#1^{\top}}
\def \corr #1{\mathring{#1}}
\def \corrinv #1{\mathring{#1}^{-1}}
\def \Esp #1{\mathbb{E}}
\def \Cov #1{\textrm{Cov}}
\def \Corr #1{\textrm{Corr}}
\def \Var #1{\textrm{Var}}
\def \New #1{#1_{\texttt{n}}}
\def \Old #1{#1_{\texttt{o}}}
\def \Upd #1{#1_{\texttt{u}}}
\def \tnew #1{\texttt{n}}
\def \told #1{\texttt{o}}
\def \tsim #1{\texttt{sim}}
\def \tupd #1{\texttt{u}}
\def \NewOld #1{#1_{\texttt{n},\texttt{o}}}
\def \NewNew #1{#1_{\texttt{n},\texttt{n}}}
\def \OldOld #1{#1_{\texttt{o},\texttt{o}}}
\def \OldNew #1{#1_{\texttt{o},\texttt{n}}}
\def \OldSim #1{#1_{\texttt{o},\texttt{s}}}
\def \SimOld #1{#1_{\texttt{s},\texttt{o}}}
\def \NewSim #1{#1_{\texttt{n},\texttt{s}}}
\def \SimNew #1{#1_{\texttt{s},\texttt{n}}}
\def \SimSim #1{#1_{\texttt{s},\texttt{s}}}
\def \OldUpd #1{#1_{\texttt{o},\texttt{u}}}
\def \UpdOld #1{#1_{\texttt{u},\texttt{o}}}
\def \UpdSim #1{#1_{\texttt{u},\texttt{s}}}
\def \SimUpd #1{#1_{\texttt{s},\texttt{u}}}
\def \UpdUpd #1{#1_{\texttt{u},\texttt{u}}}
\def \UpdNew #1{#1_{\texttt{u},\texttt{n}}}
\def \NewUpd #1{#1_{\texttt{n},\texttt{u}}}
"""

# Translate LaTeX macros to KaTeX and add to options for HTML builder
katex_macros = katex.latex_defs_to_katex_macros(latex_macros)
katex_options = 'macros: {' + katex_macros + '}'

# Add LaTeX macros for LATEX builder
latex_elements = {'preamble': latex_macros}
88 changes: 88 additions & 0 deletions docs/source/functions/Kriging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# `Kriging`


## Description

Create a `Kriging` Object representing a Trend $+$ GP Model


## Usage

Just build the model:
```r
Kriging(kernel)
# later, call fit(y,X,...)
```
or, build and fit at the same time:
```r
Kriging(
y,
X,
kernel,
regmodel = "constant",
normalize = FALSE,
optim = "BFGS",
objective = "LL",
parameters = NULL
)
```


## Arguments

Argument |Description
------------- |----------------
`y` | Numeric vector of response values.
`X` | Numeric matrix of input design.
`kernel` | Character defining the covariance model: `"gauss"` , `"exp"` , `"matern3_2"` , `"matern5_2"`.
`regmodel` | Universal Kriging linear trend: `"constant"`, `"linear"`, `"interactive"`, `"quadratic"`.
`normalize` | Logical. If `TRUE` both the input matrix `X` and the response `y` in normalized to take values in the interval $[0, 1]$ .
`optim` | Character giving the Optimization method used to fit hyper-parameters. Possible values are: `"BFGS"` , `"Newton"` and `"none"` , the later simply keeping the values given in `parameters` . The method `"BFGS"` uses the gradient of the objective (note that `"BGFS10"` means 10 multi-start of BFGS). The method `"Newton"` uses both the gradient and the Hessian of the objective.
`objective` | Character giving the objective function to optimize. Possible values are: `"LL"` for the Log-Likelihood, `"LOO"` for the Leave-One-Out sum of squares and `"LMP"` for the Log-Marginal Posterior.
`parameters` | Initial values for the hyper-parameters. When provided this must be named list with elements `"sigma2"` and `"theta"` containing the initial value(s) for the variance and for the range parameters. If `theta` is a matrix with more than one row, each row is used as a starting point for optimization.


## Details

The hyper-parameters (variance and vector of correlation ranges)
are estimated thanks to the optimization of a criterion given by
`objective` , using the method given in `optim` .


## Value

An object `"Kriging"` . Should be used
with its `predict` , `simulate` , `update`
methods.


## Examples

```r
f <- function(x) 1 - 1 / 2 * (sin(12 * x) / (1 + x) + 2 * cos(7 * x) * x^5 + 0.7)
set.seed(123)
X <- as.matrix(runif(10))
y <- f(X)
## fit and print
k <- Kriging(y, X, kernel = "matern3_2")
k

x <- as.matrix(seq(from = 0, to = 1, length.out = 101))
p <- k$predict(x = x, return_stdev = TRUE, return_cov = FALSE)

plot(f)
points(X, y)
lines(x, p$mean, col = "blue")
polygon(c(x, rev(x)), c(p$mean - 2 * p$stdev, rev(p$mean + 2 * p$stdev)),
border = NA, col = rgb(0, 0, 1, 0.2))

s <- k$simulate(nsim = 10, seed = 123, x = x)

matlines(x, s, col = rgb(0, 0, 1, 0.2), type = "l", lty = 1)
```

### Results
```{literalinclude} ../functions/examples/Kriging.md.Rout
:language: bash
```
![](../functions/examples/Kriging.md.png)
Loading