mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-05 14:55:15 +02:00
Fixed more errors in docs 2
This commit is contained in:
parent
7f2472fa22
commit
aa5ebcbd8f
15 changed files with 99 additions and 84 deletions
|
|
@ -524,11 +524,14 @@ def simulation_BGPLVM():
|
|||
'info': "Simulated test dataset generated in MATLAB to compare BGPLVM between python and MATLAB"}
|
||||
|
||||
def toy_rbf_1d(seed=default_seed, num_samples=500):
|
||||
"""Samples values of a function from an RBF covariance with very small noise for inputs uniformly distributed between -1 and 1.
|
||||
"""
|
||||
Samples values of a function from an RBF covariance with very small noise for inputs uniformly distributed between -1 and 1.
|
||||
|
||||
:param seed: seed to use for random sampling.
|
||||
:type seed: int
|
||||
:param num_samples: number of samples to sample in the function (default 500).
|
||||
:type num_samples: int
|
||||
|
||||
"""
|
||||
np.random.seed(seed=seed)
|
||||
num_in = 1
|
||||
|
|
@ -631,11 +634,15 @@ def olympic_marathon_men(data_set='olympic_marathon_men'):
|
|||
|
||||
|
||||
def crescent_data(num_data=200, seed=default_seed):
|
||||
"""Data set formed from a mixture of four Gaussians. In each class two of the Gaussians are elongated at right angles to each other and offset to form an approximation to the crescent data that is popular in semi-supervised learning as a toy problem.
|
||||
"""
|
||||
Data set formed from a mixture of four Gaussians. In each class two of the Gaussians are elongated at right angles to each other and offset to form an approximation to the crescent data that is popular in semi-supervised learning as a toy problem.
|
||||
|
||||
:param num_data_part: number of data to be sampled (default is 200).
|
||||
:type num_data: int
|
||||
:param seed: random seed to be used for data generation.
|
||||
:type seed: int"""
|
||||
:type seed: int
|
||||
|
||||
"""
|
||||
np.random.seed(seed=seed)
|
||||
sqrt2 = np.sqrt(2)
|
||||
# Rotation matrix
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ def jitchol(A, maxtries=5):
|
|||
|
||||
def jitchol_old(A, maxtries=5):
|
||||
"""
|
||||
:param A : An almost pd square matrix
|
||||
:param A: An almost pd square matrix
|
||||
|
||||
:rval L: the Cholesky decomposition of A
|
||||
|
||||
|
|
|
|||
|
|
@ -17,12 +17,9 @@ def linear_grid(D, n = 100, min_max = (-100, 100)):
|
|||
"""
|
||||
Creates a D-dimensional grid of n linearly spaced points
|
||||
|
||||
Parameters:
|
||||
|
||||
D: dimension of the grid
|
||||
n: number of points
|
||||
min_max: (min, max) list
|
||||
|
||||
:param D: dimension of the grid
|
||||
:param n: number of points
|
||||
:param min_max: (min, max) list
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -39,6 +36,7 @@ def kmm_init(X, m = 10):
|
|||
|
||||
:param X: data
|
||||
:param m: number of inducing points
|
||||
|
||||
"""
|
||||
|
||||
# compute the distances
|
||||
|
|
|
|||
|
|
@ -120,13 +120,14 @@ class tree:
|
|||
def rotation_matrix(xangle, yangle, zangle, order='zxy', degrees=False):
|
||||
|
||||
"""
|
||||
|
||||
Compute the rotation matrix for an angle in each direction.
|
||||
This is a helper function for computing the rotation matrix for a given set of angles in a given order.
|
||||
|
||||
:param xangle: rotation for x-axis.
|
||||
:param yangle: rotation for y-axis.
|
||||
:param zangle: rotation for z-axis.
|
||||
:param order: the order for the rotations.
|
||||
:param xangle: rotation for x-axis.
|
||||
:param yangle: rotation for y-axis.
|
||||
:param zangle: rotation for z-axis.
|
||||
:param order: the order for the rotations.
|
||||
|
||||
"""
|
||||
if degrees:
|
||||
|
|
@ -309,10 +310,8 @@ class acclaim_skeleton(skeleton):
|
|||
|
||||
"""
|
||||
Loads an ASF file into a skeleton structure.
|
||||
loads skeleton structure from an acclaim skeleton file.
|
||||
|
||||
:param file_name: the file name to load in.
|
||||
:rval skel: the skeleton for the file. - TODO isn't returning this?
|
||||
:param file_name: The file name to load in.
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -502,11 +502,14 @@ def data_play(Y, visualizer, frame_rate=30):
|
|||
|
||||
This example loads in the CMU mocap database (http://mocap.cs.cmu.edu) subject number 35 motion number 01. It then plays it using the mocap_show visualize object.
|
||||
|
||||
data = GPy.util.datasets.cmu_mocap(subject='35', train_motions=['01'])
|
||||
Y = data['Y']
|
||||
Y[:, 0:3] = 0. # Make figure walk in place
|
||||
visualize = GPy.util.visualize.skeleton_show(Y[0, :], data['skel'])
|
||||
GPy.util.visualize.data_play(Y, visualize)
|
||||
.. code-block:: python
|
||||
|
||||
data = GPy.util.datasets.cmu_mocap(subject='35', train_motions=['01'])
|
||||
Y = data['Y']
|
||||
Y[:, 0:3] = 0. # Make figure walk in place
|
||||
visualize = GPy.util.visualize.skeleton_show(Y[0, :], data['skel'])
|
||||
GPy.util.visualize.data_play(Y, visualize)
|
||||
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -53,9 +53,11 @@ class TanhWarpingFunction(WarpingFunction):
|
|||
self.num_parameters = 3 * self.n_terms
|
||||
|
||||
def f(self,y,psi):
|
||||
"""transform y with f using parameter vector psi
|
||||
"""
|
||||
transform y with f using parameter vector psi
|
||||
psi = [[a,b,c]]
|
||||
f = \sum_{terms} a * tanh(b*(y+c))
|
||||
::math::`f = \\sum_{terms} a * tanh(b*(y+c))`
|
||||
|
||||
"""
|
||||
|
||||
#1. check that number of params is consistent
|
||||
|
|
@ -77,8 +79,7 @@ class TanhWarpingFunction(WarpingFunction):
|
|||
"""
|
||||
calculate the numerical inverse of f
|
||||
|
||||
== input ==
|
||||
iterations: number of N.R. iterations
|
||||
:param iterations: number of N.R. iterations
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -165,9 +166,11 @@ class TanhWarpingFunction_d(WarpingFunction):
|
|||
self.num_parameters = 3 * self.n_terms + 1
|
||||
|
||||
def f(self,y,psi):
|
||||
"""transform y with f using parameter vector psi
|
||||
"""
|
||||
Transform y with f using parameter vector psi
|
||||
psi = [[a,b,c]]
|
||||
f = \sum_{terms} a * tanh(b*(y+c))
|
||||
|
||||
:math:`f = \\sum_{terms} a * tanh(b*(y+c))`
|
||||
"""
|
||||
|
||||
#1. check that number of params is consistent
|
||||
|
|
@ -189,8 +192,7 @@ class TanhWarpingFunction_d(WarpingFunction):
|
|||
"""
|
||||
calculate the numerical inverse of f
|
||||
|
||||
== input ==
|
||||
iterations: number of N.R. iterations
|
||||
:param max_iterations: maximum number of N.R. iterations
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -214,12 +216,13 @@ class TanhWarpingFunction_d(WarpingFunction):
|
|||
def fgrad_y(self, y, psi, return_precalc = False):
|
||||
"""
|
||||
gradient of f w.r.t to y ([N x 1])
|
||||
returns: Nx1 vector of derivatives, unless return_precalc is true,
|
||||
then it also returns the precomputed stuff
|
||||
|
||||
:returns: Nx1 vector of derivatives, unless return_precalc is true, then it also returns the precomputed stuff
|
||||
|
||||
"""
|
||||
|
||||
|
||||
mpsi = psi.copy()
|
||||
mpsi = psi.coSpy()
|
||||
d = psi[-1]
|
||||
mpsi = mpsi[:self.num_parameters-1].reshape(self.n_terms, 3)
|
||||
|
||||
|
|
@ -242,7 +245,7 @@ class TanhWarpingFunction_d(WarpingFunction):
|
|||
"""
|
||||
gradient of f w.r.t to y and psi
|
||||
|
||||
returns: NxIx4 tensor of partial derivatives
|
||||
:returns: NxIx4 tensor of partial derivatives
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue