<commit_before>George
======

Fast Gaussian processes for regression
--------------------------------------

This is a GP code built on top of <NAME>'s `HODLR
solver <https://github.com/sivaramambikasaran/HODLR_Solver>`_ designed to
be fast on **huge** problems. So far it's only being used to model the noise
in *Kepler* light curves but it should be more generally useful.

The code is mainly written in (undocumented) C++ with Python bindings.

Installation
------------

**Latest stable release**

You'll first need to install `Eigen 3 <http://eigen.tuxfamily.org/>`_ and
(obviously) `NumPy <http://www.numpy.org/>`_. Then, for the default
installation, just run::

  pip install george

If you have installed Eigen in a strange place, you'll need to install from
the git repository.

**Development version**

To install the development version, first clone the repository and initialize
the submodules::

  git clone https://github.com/dfm/george
  cd george
  git submodule init
  git submodule update

Then, install the package using::

  python setup.py install

If you've installed Eigen in a strange place, you can specify this by running::

  python setup.py install --eigen-include=/path/to/eigen

Usage
-----

Here's the simplest possible example of how you might want to use George::

  import numpy as np
  import george
  from george.kernels import ExpSquaredKernel

  # Generate some fake noisy data.
  x = 10 * np.sort(np.random.rand(10))
  yerr = 0.2 * np.ones_like(x)
  y = np.sin(x) + yerr * np.random.randn(len(x))

  # Set up the Gaussian process.
  kernel = ExpSquaredKernel(1.0, 1.0)
  gp = george.GaussianProcess(kernel)

  # Pre-compute the factorization of the matrix.
  gp.compute(x, yerr)

  # Compute the log likelihood.
  print(gp.lnlikelihood(y))

  # Draw 100 samples from the predictive conditional distribution.
  t = np.linspace(0, 10, 500)
  samples = gp.sample_conditional(y, t, size=100)

This should result in a distribution like the following:

.. image:: https://raw.github.com/dfm/george/master/images/demo.png

**More sophisticated kernel models**

The kernels in George need to be written in C++ but it comes with a bunch pre-loaded
and an expressive model building syntax. For example, if you have both high and low
frequency noise, you could model it as a mixture of kernels::

  from george.kernels import Sum, ExpSquaredKernel
  kernel = Sum(ExpSquaredKernel(1.0, 3.0), ExpSquaredKernel(0.5, 0.1))

If the noise is periodic or quasi-periodic, you might try something like a damped
harmonic oscillator::

  from george.kernels import Product, ExpKernel, CosineKernel
  kernel = Product(ExpKernel(1.0, 1.0), CosineKernel(0.5))

To be specific, the following kernels are defined:

* ``ExpSquaredKernel(a, s)``:

.. image:: https://raw.github.com/dfm/george/master/images/expsquared.png

License
-------

George is being developed by `<NAME> <http://dfm.io>`_ and the source
is available under the terms of the `MIT license
<https://github.com/dfm/george/blob/master/LICENSE>`_.

Copyright 2012-2014 <NAME><commit_msg>kernel specs<commit_after>George
======

Fast Gaussian processes for regression
--------------------------------------

This is a GP code built on top of Sivaram Ambikasaran's `HODLR
solver <https://github.com/sivaramambikasaran/HODLR_Solver>`_ designed to
be fast on **huge** problems. So far it's only being used to model the noise
in *Kepler* light curves but it should be more generally useful.

The code is mainly written in (undocumented) C++ with Python bindings.

Installation
------------

**Latest stable release**

You'll first need to install `Eigen 3 <http://eigen.tuxfamily.org/>`_ and
(obviously) `NumPy <http://www.numpy.org/>`_. Then, for the default
installation, just run::

  pip install george

If you have installed Eigen in a strange place, you'll need to install from
the git repository.

**Development version**

To install the development version, first clone the repository and initialize
the submodules::

  git clone https://github.com/dfm/george
  cd george
  git submodule init
  git submodule update

Then, install the package using::

  python setup.py install

If you've installed Eigen in a strange place, you can specify this by running::

  python setup.py install --eigen-include=/path/to/eigen

Usage
-----

Here's the simplest possible example of how you might want to use George::

  import numpy as np
  import george
  from george.kernels import ExpSquaredKernel

  # Generate some fake noisy data.
  x = 10 * np.sort(np.random.rand(10))
  yerr = 0.2 * np.ones_like(x)
  y = np.sin(x) + yerr * np.random.randn(len(x))

  # Set up the Gaussian process.
  kernel = ExpSquaredKernel(1.0, 1.0)
  gp = george.GaussianProcess(kernel)

  # Pre-compute the factorization of the matrix.
  gp.compute(x, yerr)

  # Compute the log likelihood.
  print(gp.lnlikelihood(y))

  # Draw 100 samples from the predictive conditional distribution.
  t = np.linspace(0, 10, 500)
  samples = gp.sample_conditional(y, t, size=100)

This should result in a distribution like the following:

.. image:: https://raw.github.com/dfm/george/master/images/demo.png

**More sophisticated kernel models**

The kernels in George need to be written in C++ but it comes with a bunch pre-loaded
and an expressive model building syntax. For example, if you have both high and low
frequency noise, you could model it as a mixture of kernels::

  from george.kernels import Sum, ExpSquaredKernel
  kernel = Sum(ExpSquaredKernel(1.0, 3.0), ExpSquaredKernel(0.5, 0.1))

If the noise is periodic or quasi-periodic, you might try something like a damped
harmonic oscillator::

  from george.kernels import Product, ExpKernel, CosineKernel
  kernel = Product(ExpKernel(1.0, 1.0), CosineKernel(0.5))

To be specific, the following kernels are defined:

* ``ExpKernel(a, s) = a**2 * exp(-fabs(x/s))``
* ``ExpSquaredKernel(a, s) = a**2 * exp(-0.5*(x/s)**2)``
* ``CosineKernel(P) = cos(2*pi*x/P)``

License
-------

George is being developed by `<NAME> <http://dfm.io>`_ and the source
is available under the terms of the `MIT license
<https://github.com/dfm/george/blob/master/LICENSE>`_.

Copyright 2012-2014 <NAME>
{'fraction_non_alphanumeric': 0.1183422373320382, 'fraction_numerical': 0.015541525012141816, 'mean_word_length': 3.7669753086419755, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 9, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7500456', 'n_tokens_mistral': 2043, 'n_tokens_neox': 1869, 'n_words': 729}