partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | student_t_approx | Example of regressing with a student t likelihood using Laplace | GPy/examples/non_gaussian.py | def student_t_approx(optimize=True, plot=True):
"""
Example of regressing with a student t likelihood using Laplace
"""
real_std = 0.1
#Start a function, any function
X = np.linspace(0.0, np.pi*2, 100)[:, None]
Y = np.sin(X) + np.random.randn(*X.shape)*real_std
Y = Y/Y.max()
Yc = Y.c... | def student_t_approx(optimize=True, plot=True):
"""
Example of regressing with a student t likelihood using Laplace
"""
real_std = 0.1
#Start a function, any function
X = np.linspace(0.0, np.pi*2, 100)[:, None]
Y = np.sin(X) + np.random.randn(*X.shape)*real_std
Y = Y/Y.max()
Yc = Y.c... | [
"Example",
"of",
"regressing",
"with",
"a",
"student",
"t",
"likelihood",
"using",
"Laplace"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/non_gaussian.py#L12-L127 | [
"def",
"student_t_approx",
"(",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"real_std",
"=",
"0.1",
"#Start a function, any function",
"X",
"=",
"np",
".",
"linspace",
"(",
"0.0",
",",
"np",
".",
"pi",
"*",
"2",
",",
"100",
")",
"[",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | POLY.K | Return covariance between X and X2. | GPy/kern/src/todo/poly.py | def K(self, X, X2, target):
"""Return covariance between X and X2."""
self._K_computations(X, X2)
target += self.variance*self._K_dvar | def K(self, X, X2, target):
"""Return covariance between X and X2."""
self._K_computations(X, X2)
target += self.variance*self._K_dvar | [
"Return",
"covariance",
"between",
"X",
"and",
"X2",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/poly.py#L79-L82 | [
"def",
"K",
"(",
"self",
",",
"X",
",",
"X2",
",",
"target",
")",
":",
"self",
".",
"_K_computations",
"(",
"X",
",",
"X2",
")",
"target",
"+=",
"self",
".",
"variance",
"*",
"self",
".",
"_K_dvar"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | POLY.Kdiag | Compute the diagonal of the covariance matrix for X. | GPy/kern/src/todo/poly.py | def Kdiag(self, X, target):
"""Compute the diagonal of the covariance matrix for X."""
self._K_diag_computations(X)
target+= self.variance*self._K_diag_dvar | def Kdiag(self, X, target):
"""Compute the diagonal of the covariance matrix for X."""
self._K_diag_computations(X)
target+= self.variance*self._K_diag_dvar | [
"Compute",
"the",
"diagonal",
"of",
"the",
"covariance",
"matrix",
"for",
"X",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/poly.py#L84-L87 | [
"def",
"Kdiag",
"(",
"self",
",",
"X",
",",
"target",
")",
":",
"self",
".",
"_K_diag_computations",
"(",
"X",
")",
"target",
"+=",
"self",
".",
"variance",
"*",
"self",
".",
"_K_diag_dvar"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | POLY._param_grad_helper | Derivative of the covariance with respect to the parameters. | GPy/kern/src/todo/poly.py | def _param_grad_helper(self, dL_dK, X, X2, target):
"""Derivative of the covariance with respect to the parameters."""
self._K_computations(X, X2)
base = self.variance*self.degree*self._K_poly_arg**(self.degree-1)
base_cov_grad = base*dL_dK
target[0] += np.sum(self... | def _param_grad_helper(self, dL_dK, X, X2, target):
"""Derivative of the covariance with respect to the parameters."""
self._K_computations(X, X2)
base = self.variance*self.degree*self._K_poly_arg**(self.degree-1)
base_cov_grad = base*dL_dK
target[0] += np.sum(self... | [
"Derivative",
"of",
"the",
"covariance",
"with",
"respect",
"to",
"the",
"parameters",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/poly.py#L89-L99 | [
"def",
"_param_grad_helper",
"(",
"self",
",",
"dL_dK",
",",
"X",
",",
"X2",
",",
"target",
")",
":",
"self",
".",
"_K_computations",
"(",
"X",
",",
"X2",
")",
"base",
"=",
"self",
".",
"variance",
"*",
"self",
".",
"degree",
"*",
"self",
".",
"_K_... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | POLY.gradients_X | Derivative of the covariance matrix with respect to X | GPy/kern/src/todo/poly.py | def gradients_X(self, dL_dK, X, X2, target):
"""Derivative of the covariance matrix with respect to X"""
self._K_computations(X, X2)
arg = self._K_poly_arg
if X2 is None:
target += 2*self.weight_variance*self.degree*self.variance*(((X[None,:, :])) *(arg**(self.degree-1))[:, :... | def gradients_X(self, dL_dK, X, X2, target):
"""Derivative of the covariance matrix with respect to X"""
self._K_computations(X, X2)
arg = self._K_poly_arg
if X2 is None:
target += 2*self.weight_variance*self.degree*self.variance*(((X[None,:, :])) *(arg**(self.degree-1))[:, :... | [
"Derivative",
"of",
"the",
"covariance",
"matrix",
"with",
"respect",
"to",
"X"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/poly.py#L102-L109 | [
"def",
"gradients_X",
"(",
"self",
",",
"dL_dK",
",",
"X",
",",
"X2",
",",
"target",
")",
":",
"self",
".",
"_K_computations",
"(",
"X",
",",
"X2",
")",
"arg",
"=",
"self",
".",
"_K_poly_arg",
"if",
"X2",
"is",
"None",
":",
"target",
"+=",
"2",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | POLY.dKdiag_dX | Gradient of diagonal of covariance with respect to X | GPy/kern/src/todo/poly.py | def dKdiag_dX(self, dL_dKdiag, X, target):
"""Gradient of diagonal of covariance with respect to X"""
self._K_diag_computations(X)
arg = self._K_diag_poly_arg
target += 2.*self.weight_variance*self.degree*self.variance*X*dL_dKdiag[:, None]*(arg**(self.degree-1))[:, None] | def dKdiag_dX(self, dL_dKdiag, X, target):
"""Gradient of diagonal of covariance with respect to X"""
self._K_diag_computations(X)
arg = self._K_diag_poly_arg
target += 2.*self.weight_variance*self.degree*self.variance*X*dL_dKdiag[:, None]*(arg**(self.degree-1))[:, None] | [
"Gradient",
"of",
"diagonal",
"of",
"covariance",
"with",
"respect",
"to",
"X"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/poly.py#L111-L115 | [
"def",
"dKdiag_dX",
"(",
"self",
",",
"dL_dKdiag",
",",
"X",
",",
"target",
")",
":",
"self",
".",
"_K_diag_computations",
"(",
"X",
")",
"arg",
"=",
"self",
".",
"_K_diag_poly_arg",
"target",
"+=",
"2.",
"*",
"self",
".",
"weight_variance",
"*",
"self",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_ARD | If an ARD kernel is present, plot a bar representation using matplotlib
:param fignum: figure number of the plot
:param filtering: list of names, which to use for plotting ARD parameters.
Only kernels which match names in the list of names in filtering
will be used f... | GPy/plotting/gpy_plot/kernel_plots.py | def plot_ARD(kernel, filtering=None, legend=False, canvas=None, **kwargs):
"""
If an ARD kernel is present, plot a bar representation using matplotlib
:param fignum: figure number of the plot
:param filtering: list of names, which to use for plotting ARD parameters.
Only kernels w... | def plot_ARD(kernel, filtering=None, legend=False, canvas=None, **kwargs):
"""
If an ARD kernel is present, plot a bar representation using matplotlib
:param fignum: figure number of the plot
:param filtering: list of names, which to use for plotting ARD parameters.
Only kernels w... | [
"If",
"an",
"ARD",
"kernel",
"is",
"present",
"plot",
"a",
"bar",
"representation",
"using",
"matplotlib"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/kernel_plots.py#L36-L84 | [
"def",
"plot_ARD",
"(",
"kernel",
",",
"filtering",
"=",
"None",
",",
"legend",
"=",
"False",
",",
"canvas",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"Tango",
".",
"reset",
"(",
")",
"ard_params",
"=",
"np",
".",
"atleast_2d",
"(",
"kernel",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_covariance | Plot a kernel covariance w.r.t. another x.
:param array-like x: the value to use for the other kernel argument (kernels are a function of two variables!)
:param plot_limits: the range over which to plot the kernel
:type plot_limits: Either (xmin, xmax) for 1D or (xmin, xmax, ymin, ymax) / ((xmin, xmax), (y... | GPy/plotting/gpy_plot/kernel_plots.py | def plot_covariance(kernel, x=None, label=None,
plot_limits=None, visible_dims=None, resolution=None,
projection='2d', levels=20, **kwargs):
"""
Plot a kernel covariance w.r.t. another x.
:param array-like x: the value to use for the other kernel argument (kernels are a function o... | def plot_covariance(kernel, x=None, label=None,
plot_limits=None, visible_dims=None, resolution=None,
projection='2d', levels=20, **kwargs):
"""
Plot a kernel covariance w.r.t. another x.
:param array-like x: the value to use for the other kernel argument (kernels are a function o... | [
"Plot",
"a",
"kernel",
"covariance",
"w",
".",
"r",
".",
"t",
".",
"another",
"x",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/kernel_plots.py#L86-L143 | [
"def",
"plot_covariance",
"(",
"kernel",
",",
"x",
"=",
"None",
",",
"label",
"=",
"None",
",",
"plot_limits",
"=",
"None",
",",
"visible_dims",
"=",
"None",
",",
"resolution",
"=",
"None",
",",
"projection",
"=",
"'2d'",
",",
"levels",
"=",
"20",
",",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | GPTransformation.from_dict | Instantiate an object of a derived class using the information
in input_dict (built by the to_dict method of the derived class).
More specifically, after reading the derived class from input_dict,
it calls the method _build_from_input_dict of the derived class.
Note: This method should n... | GPy/likelihoods/link_functions.py | def from_dict(input_dict):
"""
Instantiate an object of a derived class using the information
in input_dict (built by the to_dict method of the derived class).
More specifically, after reading the derived class from input_dict,
it calls the method _build_from_input_dict of the de... | def from_dict(input_dict):
"""
Instantiate an object of a derived class using the information
in input_dict (built by the to_dict method of the derived class).
More specifically, after reading the derived class from input_dict,
it calls the method _build_from_input_dict of the de... | [
"Instantiate",
"an",
"object",
"of",
"a",
"derived",
"class",
"using",
"the",
"information",
"in",
"input_dict",
"(",
"built",
"by",
"the",
"to_dict",
"method",
"of",
"the",
"derived",
"class",
")",
".",
"More",
"specifically",
"after",
"reading",
"the",
"de... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/link_functions.py#L53-L71 | [
"def",
"from_dict",
"(",
"input_dict",
")",
":",
"import",
"copy",
"input_dict",
"=",
"copy",
".",
"deepcopy",
"(",
"input_dict",
")",
"link_class",
"=",
"input_dict",
".",
"pop",
"(",
"'class'",
")",
"import",
"GPy",
"link_class",
"=",
"eval",
"(",
"link_... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | olympic_marathon_men | Run a standard Gaussian process regression on the Olympic marathon data. | GPy/examples/regression.py | def olympic_marathon_men(optimize=True, plot=True):
"""Run a standard Gaussian process regression on the Olympic marathon data."""
try:import pods
except ImportError:
print('pods unavailable, see https://github.com/sods/ods for example datasets')
return
data = pods.datasets.olympic_marat... | def olympic_marathon_men(optimize=True, plot=True):
"""Run a standard Gaussian process regression on the Olympic marathon data."""
try:import pods
except ImportError:
print('pods unavailable, see https://github.com/sods/ods for example datasets')
return
data = pods.datasets.olympic_marat... | [
"Run",
"a",
"standard",
"Gaussian",
"process",
"regression",
"on",
"the",
"Olympic",
"marathon",
"data",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L14-L33 | [
"def",
"olympic_marathon_men",
"(",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"try",
":",
"import",
"pods",
"except",
"ImportError",
":",
"print",
"(",
"'pods unavailable, see https://github.com/sods/ods for example datasets'",
")",
"return",
"data"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | coregionalization_toy | A simple demonstration of coregionalization on two sinusoidal functions. | GPy/examples/regression.py | def coregionalization_toy(optimize=True, plot=True):
"""
A simple demonstration of coregionalization on two sinusoidal functions.
"""
#build a design matrix with a column of integers indicating the output
X1 = np.random.rand(50, 1) * 8
X2 = np.random.rand(30, 1) * 5
#build a suitable set of... | def coregionalization_toy(optimize=True, plot=True):
"""
A simple demonstration of coregionalization on two sinusoidal functions.
"""
#build a design matrix with a column of integers indicating the output
X1 = np.random.rand(50, 1) * 8
X2 = np.random.rand(30, 1) * 5
#build a suitable set of... | [
"A",
"simple",
"demonstration",
"of",
"coregionalization",
"on",
"two",
"sinusoidal",
"functions",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L35-L56 | [
"def",
"coregionalization_toy",
"(",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"#build a design matrix with a column of integers indicating the output",
"X1",
"=",
"np",
".",
"random",
".",
"rand",
"(",
"50",
",",
"1",
")",
"*",
"8",
"X2",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | epomeo_gpx | Perform Gaussian process regression on the latitude and longitude data
from the Mount Epomeo runs. Requires gpxpy to be installed on your system
to load in the data. | GPy/examples/regression.py | def epomeo_gpx(max_iters=200, optimize=True, plot=True):
"""
Perform Gaussian process regression on the latitude and longitude data
from the Mount Epomeo runs. Requires gpxpy to be installed on your system
to load in the data.
"""
try:import pods
except ImportError:
print('pods unava... | def epomeo_gpx(max_iters=200, optimize=True, plot=True):
"""
Perform Gaussian process regression on the latitude and longitude data
from the Mount Epomeo runs. Requires gpxpy to be installed on your system
to load in the data.
"""
try:import pods
except ImportError:
print('pods unava... | [
"Perform",
"Gaussian",
"process",
"regression",
"on",
"the",
"latitude",
"and",
"longitude",
"data",
"from",
"the",
"Mount",
"Epomeo",
"runs",
".",
"Requires",
"gpxpy",
"to",
"be",
"installed",
"on",
"your",
"system",
"to",
"load",
"in",
"the",
"data",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L83-L123 | [
"def",
"epomeo_gpx",
"(",
"max_iters",
"=",
"200",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"try",
":",
"import",
"pods",
"except",
"ImportError",
":",
"print",
"(",
"'pods unavailable, see https://github.com/sods/ods for example datasets'",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | multiple_optima | Show an example of a multimodal error surface for Gaussian process
regression. Gene 939 has bimodal behaviour where the noisy mode is
higher. | GPy/examples/regression.py | def multiple_optima(gene_number=937, resolution=80, model_restarts=10, seed=10000, max_iters=300, optimize=True, plot=True):
"""
Show an example of a multimodal error surface for Gaussian process
regression. Gene 939 has bimodal behaviour where the noisy mode is
higher.
"""
# Contour over a ran... | def multiple_optima(gene_number=937, resolution=80, model_restarts=10, seed=10000, max_iters=300, optimize=True, plot=True):
"""
Show an example of a multimodal error surface for Gaussian process
regression. Gene 939 has bimodal behaviour where the noisy mode is
higher.
"""
# Contour over a ran... | [
"Show",
"an",
"example",
"of",
"a",
"multimodal",
"error",
"surface",
"for",
"Gaussian",
"process",
"regression",
".",
"Gene",
"939",
"has",
"bimodal",
"behaviour",
"where",
"the",
"noisy",
"mode",
"is",
"higher",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L125-L184 | [
"def",
"multiple_optima",
"(",
"gene_number",
"=",
"937",
",",
"resolution",
"=",
"80",
",",
"model_restarts",
"=",
"10",
",",
"seed",
"=",
"10000",
",",
"max_iters",
"=",
"300",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"# Cont... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | _contour_data | Evaluate the GP objective function for a given data set for a range of
signal to noise ratios and a range of lengthscales.
:data_set: A data set from the utils.datasets director.
:length_scales: a list of length scales to explore for the contour plot.
:log_SNRs: a list of base 10 logarithm signal to no... | GPy/examples/regression.py | def _contour_data(data, length_scales, log_SNRs, kernel_call=GPy.kern.RBF):
"""
Evaluate the GP objective function for a given data set for a range of
signal to noise ratios and a range of lengthscales.
:data_set: A data set from the utils.datasets director.
:length_scales: a list of length scales ... | def _contour_data(data, length_scales, log_SNRs, kernel_call=GPy.kern.RBF):
"""
Evaluate the GP objective function for a given data set for a range of
signal to noise ratios and a range of lengthscales.
:data_set: A data set from the utils.datasets director.
:length_scales: a list of length scales ... | [
"Evaluate",
"the",
"GP",
"objective",
"function",
"for",
"a",
"given",
"data",
"set",
"for",
"a",
"range",
"of",
"signal",
"to",
"noise",
"ratios",
"and",
"a",
"range",
"of",
"lengthscales",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L186-L215 | [
"def",
"_contour_data",
"(",
"data",
",",
"length_scales",
",",
"log_SNRs",
",",
"kernel_call",
"=",
"GPy",
".",
"kern",
".",
"RBF",
")",
":",
"lls",
"=",
"[",
"]",
"total_var",
"=",
"np",
".",
"var",
"(",
"data",
"[",
"'Y'",
"]",
")",
"kernel",
"=... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | olympic_100m_men | Run a standard Gaussian process regression on the Rogers and Girolami olympics data. | GPy/examples/regression.py | def olympic_100m_men(optimize=True, plot=True):
"""Run a standard Gaussian process regression on the Rogers and Girolami olympics data."""
try:import pods
except ImportError:
print('pods unavailable, see https://github.com/sods/ods for example datasets')
return
data = pods.datasets.olymp... | def olympic_100m_men(optimize=True, plot=True):
"""Run a standard Gaussian process regression on the Rogers and Girolami olympics data."""
try:import pods
except ImportError:
print('pods unavailable, see https://github.com/sods/ods for example datasets')
return
data = pods.datasets.olymp... | [
"Run",
"a",
"standard",
"Gaussian",
"process",
"regression",
"on",
"the",
"Rogers",
"and",
"Girolami",
"olympics",
"data",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L218-L237 | [
"def",
"olympic_100m_men",
"(",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"try",
":",
"import",
"pods",
"except",
"ImportError",
":",
"print",
"(",
"'pods unavailable, see https://github.com/sods/ods for example datasets'",
")",
"return",
"data",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | toy_rbf_1d | Run a simple demonstration of a standard Gaussian process fitting it to data sampled from an RBF covariance. | GPy/examples/regression.py | def toy_rbf_1d(optimize=True, plot=True):
"""Run a simple demonstration of a standard Gaussian process fitting it to data sampled from an RBF covariance."""
try:import pods
except ImportError:
print('pods unavailable, see https://github.com/sods/ods for example datasets')
return
data = p... | def toy_rbf_1d(optimize=True, plot=True):
"""Run a simple demonstration of a standard Gaussian process fitting it to data sampled from an RBF covariance."""
try:import pods
except ImportError:
print('pods unavailable, see https://github.com/sods/ods for example datasets')
return
data = p... | [
"Run",
"a",
"simple",
"demonstration",
"of",
"a",
"standard",
"Gaussian",
"process",
"fitting",
"it",
"to",
"data",
"sampled",
"from",
"an",
"RBF",
"covariance",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L239-L255 | [
"def",
"toy_rbf_1d",
"(",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"try",
":",
"import",
"pods",
"except",
"ImportError",
":",
"print",
"(",
"'pods unavailable, see https://github.com/sods/ods for example datasets'",
")",
"return",
"data",
"=",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | toy_poisson_rbf_1d_laplace | Run a simple demonstration of a standard Gaussian process fitting it to data sampled from an RBF covariance. | GPy/examples/regression.py | def toy_poisson_rbf_1d_laplace(optimize=True, plot=True):
"""Run a simple demonstration of a standard Gaussian process fitting it to data sampled from an RBF covariance."""
optimizer='scg'
x_len = 100
X = np.linspace(0, 10, x_len)[:, None]
f_true = np.random.multivariate_normal(np.zeros(x_len), GPy.... | def toy_poisson_rbf_1d_laplace(optimize=True, plot=True):
"""Run a simple demonstration of a standard Gaussian process fitting it to data sampled from an RBF covariance."""
optimizer='scg'
x_len = 100
X = np.linspace(0, 10, x_len)[:, None]
f_true = np.random.multivariate_normal(np.zeros(x_len), GPy.... | [
"Run",
"a",
"simple",
"demonstration",
"of",
"a",
"standard",
"Gaussian",
"process",
"fitting",
"it",
"to",
"data",
"sampled",
"from",
"an",
"RBF",
"covariance",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L275-L297 | [
"def",
"toy_poisson_rbf_1d_laplace",
"(",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"optimizer",
"=",
"'scg'",
"x_len",
"=",
"100",
"X",
"=",
"np",
".",
"linspace",
"(",
"0",
",",
"10",
",",
"x_len",
")",
"[",
":",
",",
"None",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | robot_wireless | Predict the location of a robot given wirelss signal strength readings. | GPy/examples/regression.py | def robot_wireless(max_iters=100, kernel=None, optimize=True, plot=True):
"""Predict the location of a robot given wirelss signal strength readings."""
try:import pods
except ImportError:
print('pods unavailable, see https://github.com/sods/ods for example datasets')
return
data = pods.d... | def robot_wireless(max_iters=100, kernel=None, optimize=True, plot=True):
"""Predict the location of a robot given wirelss signal strength readings."""
try:import pods
except ImportError:
print('pods unavailable, see https://github.com/sods/ods for example datasets')
return
data = pods.d... | [
"Predict",
"the",
"location",
"of",
"a",
"robot",
"given",
"wirelss",
"signal",
"strength",
"readings",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L376-L402 | [
"def",
"robot_wireless",
"(",
"max_iters",
"=",
"100",
",",
"kernel",
"=",
"None",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"try",
":",
"import",
"pods",
"except",
"ImportError",
":",
"print",
"(",
"'pods unavailable, see https://git... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | silhouette | Predict the pose of a figure given a silhouette. This is a task from Agarwal and Triggs 2004 ICML paper. | GPy/examples/regression.py | def silhouette(max_iters=100, optimize=True, plot=True):
"""Predict the pose of a figure given a silhouette. This is a task from Agarwal and Triggs 2004 ICML paper."""
try:import pods
except ImportError:
print('pods unavailable, see https://github.com/sods/ods for example datasets')
return
... | def silhouette(max_iters=100, optimize=True, plot=True):
"""Predict the pose of a figure given a silhouette. This is a task from Agarwal and Triggs 2004 ICML paper."""
try:import pods
except ImportError:
print('pods unavailable, see https://github.com/sods/ods for example datasets')
return
... | [
"Predict",
"the",
"pose",
"of",
"a",
"figure",
"given",
"a",
"silhouette",
".",
"This",
"is",
"a",
"task",
"from",
"Agarwal",
"and",
"Triggs",
"2004",
"ICML",
"paper",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L404-L420 | [
"def",
"silhouette",
"(",
"max_iters",
"=",
"100",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"try",
":",
"import",
"pods",
"except",
"ImportError",
":",
"print",
"(",
"'pods unavailable, see https://github.com/sods/ods for example datasets'",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | sparse_GP_regression_1D | Run a 1D example of a sparse GP regression. | GPy/examples/regression.py | def sparse_GP_regression_1D(num_samples=400, num_inducing=5, max_iters=100, optimize=True, plot=True, checkgrad=False):
"""Run a 1D example of a sparse GP regression."""
# sample inputs and outputs
X = np.random.uniform(-3., 3., (num_samples, 1))
Y = np.sin(X) + np.random.randn(num_samples, 1) * 0.05
... | def sparse_GP_regression_1D(num_samples=400, num_inducing=5, max_iters=100, optimize=True, plot=True, checkgrad=False):
"""Run a 1D example of a sparse GP regression."""
# sample inputs and outputs
X = np.random.uniform(-3., 3., (num_samples, 1))
Y = np.sin(X) + np.random.randn(num_samples, 1) * 0.05
... | [
"Run",
"a",
"1D",
"example",
"of",
"a",
"sparse",
"GP",
"regression",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L422-L441 | [
"def",
"sparse_GP_regression_1D",
"(",
"num_samples",
"=",
"400",
",",
"num_inducing",
"=",
"5",
",",
"max_iters",
"=",
"100",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
",",
"checkgrad",
"=",
"False",
")",
":",
"# sample inputs and outputs",
"X... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | sparse_GP_regression_2D | Run a 2D example of a sparse GP regression. | GPy/examples/regression.py | def sparse_GP_regression_2D(num_samples=400, num_inducing=50, max_iters=100, optimize=True, plot=True, nan=False):
"""Run a 2D example of a sparse GP regression."""
np.random.seed(1234)
X = np.random.uniform(-3., 3., (num_samples, 2))
Y = np.sin(X[:, 0:1]) * np.sin(X[:, 1:2]) + np.random.randn(num_sampl... | def sparse_GP_regression_2D(num_samples=400, num_inducing=50, max_iters=100, optimize=True, plot=True, nan=False):
"""Run a 2D example of a sparse GP regression."""
np.random.seed(1234)
X = np.random.uniform(-3., 3., (num_samples, 2))
Y = np.sin(X[:, 0:1]) * np.sin(X[:, 1:2]) + np.random.randn(num_sampl... | [
"Run",
"a",
"2D",
"example",
"of",
"a",
"sparse",
"GP",
"regression",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L443-L472 | [
"def",
"sparse_GP_regression_2D",
"(",
"num_samples",
"=",
"400",
",",
"num_inducing",
"=",
"50",
",",
"max_iters",
"=",
"100",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
",",
"nan",
"=",
"False",
")",
":",
"np",
".",
"random",
".",
"seed"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | uncertain_inputs_sparse_regression | Run a 1D example of a sparse GP regression with uncertain inputs. | GPy/examples/regression.py | def uncertain_inputs_sparse_regression(max_iters=200, optimize=True, plot=True):
"""Run a 1D example of a sparse GP regression with uncertain inputs."""
fig, axes = pb.subplots(1, 2, figsize=(12, 5), sharex=True, sharey=True)
# sample inputs and outputs
S = np.ones((20, 1))
X = np.random.uniform(-3... | def uncertain_inputs_sparse_regression(max_iters=200, optimize=True, plot=True):
"""Run a 1D example of a sparse GP regression with uncertain inputs."""
fig, axes = pb.subplots(1, 2, figsize=(12, 5), sharex=True, sharey=True)
# sample inputs and outputs
S = np.ones((20, 1))
X = np.random.uniform(-3... | [
"Run",
"a",
"1D",
"example",
"of",
"a",
"sparse",
"GP",
"regression",
"with",
"uncertain",
"inputs",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L474-L507 | [
"def",
"uncertain_inputs_sparse_regression",
"(",
"max_iters",
"=",
"200",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"fig",
",",
"axes",
"=",
"pb",
".",
"subplots",
"(",
"1",
",",
"2",
",",
"figsize",
"=",
"(",
"12",
",",
"5",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | simple_mean_function | The simplest possible mean function. No parameters, just a simple Sinusoid. | GPy/examples/regression.py | def simple_mean_function(max_iters=100, optimize=True, plot=True):
"""
The simplest possible mean function. No parameters, just a simple Sinusoid.
"""
#create simple mean function
mf = GPy.core.Mapping(1,1)
mf.f = np.sin
mf.update_gradients = lambda a,b: None
X = np.linspace(0,10,50).r... | def simple_mean_function(max_iters=100, optimize=True, plot=True):
"""
The simplest possible mean function. No parameters, just a simple Sinusoid.
"""
#create simple mean function
mf = GPy.core.Mapping(1,1)
mf.f = np.sin
mf.update_gradients = lambda a,b: None
X = np.linspace(0,10,50).r... | [
"The",
"simplest",
"possible",
"mean",
"function",
".",
"No",
"parameters",
"just",
"a",
"simple",
"Sinusoid",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L509-L528 | [
"def",
"simple_mean_function",
"(",
"max_iters",
"=",
"100",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"#create simple mean function",
"mf",
"=",
"GPy",
".",
"core",
".",
"Mapping",
"(",
"1",
",",
"1",
")",
"mf",
".",
"f",
"=",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | parametric_mean_function | A linear mean function with parameters that we'll learn alongside the kernel | GPy/examples/regression.py | def parametric_mean_function(max_iters=100, optimize=True, plot=True):
"""
A linear mean function with parameters that we'll learn alongside the kernel
"""
#create simple mean function
mf = GPy.core.Mapping(1,1)
mf.f = np.sin
X = np.linspace(0,10,50).reshape(-1,1)
Y = np.sin(X) + 0.5*n... | def parametric_mean_function(max_iters=100, optimize=True, plot=True):
"""
A linear mean function with parameters that we'll learn alongside the kernel
"""
#create simple mean function
mf = GPy.core.Mapping(1,1)
mf.f = np.sin
X = np.linspace(0,10,50).reshape(-1,1)
Y = np.sin(X) + 0.5*n... | [
"A",
"linear",
"mean",
"function",
"with",
"parameters",
"that",
"we",
"ll",
"learn",
"alongside",
"the",
"kernel"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L530-L550 | [
"def",
"parametric_mean_function",
"(",
"max_iters",
"=",
"100",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"#create simple mean function",
"mf",
"=",
"GPy",
".",
"core",
".",
"Mapping",
"(",
"1",
",",
"1",
")",
"mf",
".",
"f",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | warped_gp_cubic_sine | A test replicating the cubic sine regression problem from
Snelson's paper. | GPy/examples/regression.py | def warped_gp_cubic_sine(max_iters=100):
"""
A test replicating the cubic sine regression problem from
Snelson's paper.
"""
X = (2 * np.pi) * np.random.random(151) - np.pi
Y = np.sin(X) + np.random.normal(0,0.2,151)
Y = np.array([np.power(abs(y),float(1)/3) * (1,-1)[y<0] for y in Y])
X =... | def warped_gp_cubic_sine(max_iters=100):
"""
A test replicating the cubic sine regression problem from
Snelson's paper.
"""
X = (2 * np.pi) * np.random.random(151) - np.pi
Y = np.sin(X) + np.random.normal(0,0.2,151)
Y = np.array([np.power(abs(y),float(1)/3) * (1,-1)[y<0] for y in Y])
X =... | [
"A",
"test",
"replicating",
"the",
"cubic",
"sine",
"regression",
"problem",
"from",
"Snelson",
"s",
"paper",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/regression.py#L553-L583 | [
"def",
"warped_gp_cubic_sine",
"(",
"max_iters",
"=",
"100",
")",
":",
"X",
"=",
"(",
"2",
"*",
"np",
".",
"pi",
")",
"*",
"np",
".",
"random",
".",
"random",
"(",
"151",
")",
"-",
"np",
".",
"pi",
"Y",
"=",
"np",
".",
"sin",
"(",
"X",
")",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | GPKroneckerGaussianRegression.predict | Return the predictive mean and variance at a series of new points X1new, X2new
Only returns the diagonal of the predictive variance, for now.
:param X1new: The points at which to make a prediction
:type X1new: np.ndarray, Nnew x self.input_dim1
:param X2new: The points at which to make ... | GPy/models/gp_kronecker_gaussian_regression.py | def predict(self, X1new, X2new):
"""
Return the predictive mean and variance at a series of new points X1new, X2new
Only returns the diagonal of the predictive variance, for now.
:param X1new: The points at which to make a prediction
:type X1new: np.ndarray, Nnew x self.input_di... | def predict(self, X1new, X2new):
"""
Return the predictive mean and variance at a series of new points X1new, X2new
Only returns the diagonal of the predictive variance, for now.
:param X1new: The points at which to make a prediction
:type X1new: np.ndarray, Nnew x self.input_di... | [
"Return",
"the",
"predictive",
"mean",
"and",
"variance",
"at",
"a",
"series",
"of",
"new",
"points",
"X1new",
"X2new",
"Only",
"returns",
"the",
"diagonal",
"of",
"the",
"predictive",
"variance",
"for",
"now",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/gp_kronecker_gaussian_regression.py#L99-L120 | [
"def",
"predict",
"(",
"self",
",",
"X1new",
",",
"X2new",
")",
":",
"k1xf",
"=",
"self",
".",
"kern1",
".",
"K",
"(",
"X1new",
",",
"self",
".",
"X1",
")",
"k2xf",
"=",
"self",
".",
"kern2",
".",
"K",
"(",
"X2new",
",",
"self",
".",
"X2",
")... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | helper_predict_with_model | Make the right decisions for prediction with a model
based on the standard arguments of plotting.
This is quite complex and will take a while to understand,
so do not change anything in here lightly!!! | GPy/plotting/gpy_plot/plot_util.py | def helper_predict_with_model(self, Xgrid, plot_raw, apply_link, percentiles, which_data_ycols, predict_kw, samples=0):
"""
Make the right decisions for prediction with a model
based on the standard arguments of plotting.
This is quite complex and will take a while to understand,
so do not change a... | def helper_predict_with_model(self, Xgrid, plot_raw, apply_link, percentiles, which_data_ycols, predict_kw, samples=0):
"""
Make the right decisions for prediction with a model
based on the standard arguments of plotting.
This is quite complex and will take a while to understand,
so do not change a... | [
"Make",
"the",
"right",
"decisions",
"for",
"prediction",
"with",
"a",
"model",
"based",
"on",
"the",
"standard",
"arguments",
"of",
"plotting",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/plot_util.py#L53-L101 | [
"def",
"helper_predict_with_model",
"(",
"self",
",",
"Xgrid",
",",
"plot_raw",
",",
"apply_link",
",",
"percentiles",
",",
"which_data_ycols",
",",
"predict_kw",
",",
"samples",
"=",
"0",
")",
":",
"# Put some standards into the predict_kw so that prediction is done auto... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | helper_for_plot_data | Figure out the data, free_dims and create an Xgrid for
the prediction.
This is only implemented for two dimensions for now! | GPy/plotting/gpy_plot/plot_util.py | def helper_for_plot_data(self, X, plot_limits, visible_dims, fixed_inputs, resolution):
"""
Figure out the data, free_dims and create an Xgrid for
the prediction.
This is only implemented for two dimensions for now!
"""
#work out what the inputs are for plotting (1D or 2D)
if fixed_inputs i... | def helper_for_plot_data(self, X, plot_limits, visible_dims, fixed_inputs, resolution):
"""
Figure out the data, free_dims and create an Xgrid for
the prediction.
This is only implemented for two dimensions for now!
"""
#work out what the inputs are for plotting (1D or 2D)
if fixed_inputs i... | [
"Figure",
"out",
"the",
"data",
"free_dims",
"and",
"create",
"an",
"Xgrid",
"for",
"the",
"prediction",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/plot_util.py#L103-L138 | [
"def",
"helper_for_plot_data",
"(",
"self",
",",
"X",
",",
"plot_limits",
",",
"visible_dims",
",",
"fixed_inputs",
",",
"resolution",
")",
":",
"#work out what the inputs are for plotting (1D or 2D)",
"if",
"fixed_inputs",
"is",
"None",
":",
"fixed_inputs",
"=",
"[",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | subsample_X | Stratified subsampling if labels are given.
This means due to rounding errors you might get a little differences between the
num_samples and the returned subsampled X. | GPy/plotting/gpy_plot/plot_util.py | def subsample_X(X, labels, num_samples=1000):
"""
Stratified subsampling if labels are given.
This means due to rounding errors you might get a little differences between the
num_samples and the returned subsampled X.
"""
if X.shape[0] > num_samples:
print("Warning: subsampling X, as it ... | def subsample_X(X, labels, num_samples=1000):
"""
Stratified subsampling if labels are given.
This means due to rounding errors you might get a little differences between the
num_samples and the returned subsampled X.
"""
if X.shape[0] > num_samples:
print("Warning: subsampling X, as it ... | [
"Stratified",
"subsampling",
"if",
"labels",
"are",
"given",
".",
"This",
"means",
"due",
"to",
"rounding",
"errors",
"you",
"might",
"get",
"a",
"little",
"differences",
"between",
"the",
"num_samples",
"and",
"the",
"returned",
"subsampled",
"X",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/plot_util.py#L194-L256 | [
"def",
"subsample_X",
"(",
"X",
",",
"labels",
",",
"num_samples",
"=",
"1000",
")",
":",
"if",
"X",
".",
"shape",
"[",
"0",
"]",
">",
"num_samples",
":",
"print",
"(",
"\"Warning: subsampling X, as it has more samples then {}. X.shape={!s}\"",
".",
"format",
"(... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | update_not_existing_kwargs | This function updates the keyword aguments from update_from in
to_update, only if the keys are not set in to_update.
This is used for updated kwargs from the default dicts. | GPy/plotting/gpy_plot/plot_util.py | def update_not_existing_kwargs(to_update, update_from):
"""
This function updates the keyword aguments from update_from in
to_update, only if the keys are not set in to_update.
This is used for updated kwargs from the default dicts.
"""
if to_update is None:
to_update = {}
to_update... | def update_not_existing_kwargs(to_update, update_from):
"""
This function updates the keyword aguments from update_from in
to_update, only if the keys are not set in to_update.
This is used for updated kwargs from the default dicts.
"""
if to_update is None:
to_update = {}
to_update... | [
"This",
"function",
"updates",
"the",
"keyword",
"aguments",
"from",
"update_from",
"in",
"to_update",
"only",
"if",
"the",
"keys",
"are",
"not",
"set",
"in",
"to_update",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/plot_util.py#L259-L269 | [
"def",
"update_not_existing_kwargs",
"(",
"to_update",
",",
"update_from",
")",
":",
"if",
"to_update",
"is",
"None",
":",
"to_update",
"=",
"{",
"}",
"to_update",
".",
"update",
"(",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"update_from",
".",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | get_x_y_var | Either the the data from a model as
X the inputs,
X_variance the variance of the inputs ([default: None])
and Y the outputs
If (X, X_variance, Y) is given, this just returns.
:returns: (X, X_variance, Y) | GPy/plotting/gpy_plot/plot_util.py | def get_x_y_var(model):
"""
Either the the data from a model as
X the inputs,
X_variance the variance of the inputs ([default: None])
and Y the outputs
If (X, X_variance, Y) is given, this just returns.
:returns: (X, X_variance, Y)
"""
# model given
if hasattr(model, 'has_uncer... | def get_x_y_var(model):
"""
Either the the data from a model as
X the inputs,
X_variance the variance of the inputs ([default: None])
and Y the outputs
If (X, X_variance, Y) is given, this just returns.
:returns: (X, X_variance, Y)
"""
# model given
if hasattr(model, 'has_uncer... | [
"Either",
"the",
"the",
"data",
"from",
"a",
"model",
"as",
"X",
"the",
"inputs",
"X_variance",
"the",
"variance",
"of",
"the",
"inputs",
"(",
"[",
"default",
":",
"None",
"]",
")",
"and",
"Y",
"the",
"outputs"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/plot_util.py#L271-L301 | [
"def",
"get_x_y_var",
"(",
"model",
")",
":",
"# model given",
"if",
"hasattr",
"(",
"model",
",",
"'has_uncertain_inputs'",
")",
"and",
"model",
".",
"has_uncertain_inputs",
"(",
")",
":",
"X",
"=",
"model",
".",
"X",
".",
"mean",
".",
"values",
"X_varian... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | get_free_dims | work out what the inputs are for plotting (1D or 2D)
The visible dimensions are the dimensions, which are visible.
the fixed_dims are the fixed dimensions for this.
The free_dims are then the visible dims without the fixed dims. | GPy/plotting/gpy_plot/plot_util.py | def get_free_dims(model, visible_dims, fixed_dims):
"""
work out what the inputs are for plotting (1D or 2D)
The visible dimensions are the dimensions, which are visible.
the fixed_dims are the fixed dimensions for this.
The free_dims are then the visible dims without the fixed dims.
"""
i... | def get_free_dims(model, visible_dims, fixed_dims):
"""
work out what the inputs are for plotting (1D or 2D)
The visible dimensions are the dimensions, which are visible.
the fixed_dims are the fixed dimensions for this.
The free_dims are then the visible dims without the fixed dims.
"""
i... | [
"work",
"out",
"what",
"the",
"inputs",
"are",
"for",
"plotting",
"(",
"1D",
"or",
"2D",
")"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/plot_util.py#L303-L317 | [
"def",
"get_free_dims",
"(",
"model",
",",
"visible_dims",
",",
"fixed_dims",
")",
":",
"if",
"visible_dims",
"is",
"None",
":",
"visible_dims",
"=",
"np",
".",
"arange",
"(",
"model",
".",
"input_dim",
")",
"dims",
"=",
"np",
".",
"asanyarray",
"(",
"vi... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | get_which_data_ycols | Helper to get the data columns to plot. | GPy/plotting/gpy_plot/plot_util.py | def get_which_data_ycols(model, which_data_ycols):
"""
Helper to get the data columns to plot.
"""
if which_data_ycols == 'all' or which_data_ycols is None:
return np.arange(model.output_dim)
return which_data_ycols | def get_which_data_ycols(model, which_data_ycols):
"""
Helper to get the data columns to plot.
"""
if which_data_ycols == 'all' or which_data_ycols is None:
return np.arange(model.output_dim)
return which_data_ycols | [
"Helper",
"to",
"get",
"the",
"data",
"columns",
"to",
"plot",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/plot_util.py#L326-L332 | [
"def",
"get_which_data_ycols",
"(",
"model",
",",
"which_data_ycols",
")",
":",
"if",
"which_data_ycols",
"==",
"'all'",
"or",
"which_data_ycols",
"is",
"None",
":",
"return",
"np",
".",
"arange",
"(",
"model",
".",
"output_dim",
")",
"return",
"which_data_ycols... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | x_frame1D | Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits | GPy/plotting/gpy_plot/plot_util.py | def x_frame1D(X,plot_limits=None,resolution=None):
"""
Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits
"""
assert X.shape[1] ==1, "x_frame1D is defined for one-dimensional inputs"
if plot_limits is None:
from GPy.core.paramet... | def x_frame1D(X,plot_limits=None,resolution=None):
"""
Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits
"""
assert X.shape[1] ==1, "x_frame1D is defined for one-dimensional inputs"
if plot_limits is None:
from GPy.core.paramet... | [
"Internal",
"helper",
"function",
"for",
"making",
"plots",
"returns",
"a",
"set",
"of",
"input",
"values",
"to",
"plot",
"as",
"well",
"as",
"lower",
"and",
"upper",
"limits"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/plot_util.py#L342-L360 | [
"def",
"x_frame1D",
"(",
"X",
",",
"plot_limits",
"=",
"None",
",",
"resolution",
"=",
"None",
")",
":",
"assert",
"X",
".",
"shape",
"[",
"1",
"]",
"==",
"1",
",",
"\"x_frame1D is defined for one-dimensional inputs\"",
"if",
"plot_limits",
"is",
"None",
":"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | x_frame2D | Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits | GPy/plotting/gpy_plot/plot_util.py | def x_frame2D(X,plot_limits=None,resolution=None):
"""
Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits
"""
assert X.shape[1]==2, "x_frame2D is defined for two-dimensional inputs"
if plot_limits is None:
xmin, xmax = X.min(0),... | def x_frame2D(X,plot_limits=None,resolution=None):
"""
Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits
"""
assert X.shape[1]==2, "x_frame2D is defined for two-dimensional inputs"
if plot_limits is None:
xmin, xmax = X.min(0),... | [
"Internal",
"helper",
"function",
"for",
"making",
"plots",
"returns",
"a",
"set",
"of",
"input",
"values",
"to",
"plot",
"as",
"well",
"as",
"lower",
"and",
"upper",
"limits"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/plot_util.py#L362-L386 | [
"def",
"x_frame2D",
"(",
"X",
",",
"plot_limits",
"=",
"None",
",",
"resolution",
"=",
"None",
")",
":",
"assert",
"X",
".",
"shape",
"[",
"1",
"]",
"==",
"2",
",",
"\"x_frame2D is defined for two-dimensional inputs\"",
"if",
"plot_limits",
"is",
"None",
":"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | PCA.center | Center `X` in PCA space. | GPy/util/pca.py | def center(self, X):
"""
Center `X` in PCA space.
"""
X = X.copy()
inan = numpy.isnan(X)
if self.mu is None:
X_ = numpy.ma.masked_array(X, inan)
self.mu = X_.mean(0).base
self.sigma = X_.std(0).base
reduce(lambda y,x: setitem(x[... | def center(self, X):
"""
Center `X` in PCA space.
"""
X = X.copy()
inan = numpy.isnan(X)
if self.mu is None:
X_ = numpy.ma.masked_array(X, inan)
self.mu = X_.mean(0).base
self.sigma = X_.std(0).base
reduce(lambda y,x: setitem(x[... | [
"Center",
"X",
"in",
"PCA",
"space",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/pca.py#L41-L54 | [
"def",
"center",
"(",
"self",
",",
"X",
")",
":",
"X",
"=",
"X",
".",
"copy",
"(",
")",
"inan",
"=",
"numpy",
".",
"isnan",
"(",
"X",
")",
"if",
"self",
".",
"mu",
"is",
"None",
":",
"X_",
"=",
"numpy",
".",
"ma",
".",
"masked_array",
"(",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | PCA.project | Project X into PCA space, defined by the Q highest eigenvalues.
Y = X dot V | GPy/util/pca.py | def project(self, X, Q=None):
"""
Project X into PCA space, defined by the Q highest eigenvalues.
Y = X dot V
"""
if Q is None:
Q = self.Q
if Q > X.shape[1]:
raise IndexError("requested dimension larger then input dimension")
X = self.cente... | def project(self, X, Q=None):
"""
Project X into PCA space, defined by the Q highest eigenvalues.
Y = X dot V
"""
if Q is None:
Q = self.Q
if Q > X.shape[1]:
raise IndexError("requested dimension larger then input dimension")
X = self.cente... | [
"Project",
"X",
"into",
"PCA",
"space",
"defined",
"by",
"the",
"Q",
"highest",
"eigenvalues",
".",
"Y",
"=",
"X",
"dot",
"V"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/pca.py#L68-L78 | [
"def",
"project",
"(",
"self",
",",
"X",
",",
"Q",
"=",
"None",
")",
":",
"if",
"Q",
"is",
"None",
":",
"Q",
"=",
"self",
".",
"Q",
"if",
"Q",
">",
"X",
".",
"shape",
"[",
"1",
"]",
":",
"raise",
"IndexError",
"(",
"\"requested dimension larger t... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | PCA.plot_fracs | Plot fractions of Eigenvalues sorted in descending order. | GPy/util/pca.py | def plot_fracs(self, Q=None, ax=None, fignum=None):
"""
Plot fractions of Eigenvalues sorted in descending order.
"""
from ..plotting import Tango
Tango.reset()
col = Tango.nextMedium()
if ax is None:
fig = pylab.figure(fignum)
ax = fig.add... | def plot_fracs(self, Q=None, ax=None, fignum=None):
"""
Plot fractions of Eigenvalues sorted in descending order.
"""
from ..plotting import Tango
Tango.reset()
col = Tango.nextMedium()
if ax is None:
fig = pylab.figure(fignum)
ax = fig.add... | [
"Plot",
"fractions",
"of",
"Eigenvalues",
"sorted",
"in",
"descending",
"order",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/pca.py#L80-L103 | [
"def",
"plot_fracs",
"(",
"self",
",",
"Q",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"fignum",
"=",
"None",
")",
":",
"from",
".",
".",
"plotting",
"import",
"Tango",
"Tango",
".",
"reset",
"(",
")",
"col",
"=",
"Tango",
".",
"nextMedium",
"(",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | PCA.plot_2d | Plot dimensions `dimensions` with given labels against each other in
PC space. Labels can be any sequence of labels of dimensions X.shape[0].
Labels can be drawn with a subsequent call to legend() | GPy/util/pca.py | def plot_2d(self, X, labels=None, s=20, marker='o',
dimensions=(0, 1), ax=None, colors=None,
fignum=None, cmap=None, # @UndefinedVariable
** kwargs):
"""
Plot dimensions `dimensions` with given labels against each other in
PC space. Labels can be a... | def plot_2d(self, X, labels=None, s=20, marker='o',
dimensions=(0, 1), ax=None, colors=None,
fignum=None, cmap=None, # @UndefinedVariable
** kwargs):
"""
Plot dimensions `dimensions` with given labels against each other in
PC space. Labels can be a... | [
"Plot",
"dimensions",
"dimensions",
"with",
"given",
"labels",
"against",
"each",
"other",
"in",
"PC",
"space",
".",
"Labels",
"can",
"be",
"any",
"sequence",
"of",
"labels",
"of",
"dimensions",
"X",
".",
"shape",
"[",
"0",
"]",
".",
"Labels",
"can",
"be... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/pca.py#L105-L142 | [
"def",
"plot_2d",
"(",
"self",
",",
"X",
",",
"labels",
"=",
"None",
",",
"s",
"=",
"20",
",",
"marker",
"=",
"'o'",
",",
"dimensions",
"=",
"(",
"0",
",",
"1",
")",
",",
"ax",
"=",
"None",
",",
"colors",
"=",
"None",
",",
"fignum",
"=",
"Non... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_latent_scatter | Plot a scatter plot of the latent space.
:param array-like labels: a label for each data point (row) of the inputs
:param (int, int) which_indices: which input dimensions to plot against each other
:param bool legend: whether to plot the legend on the figure
:param plot_limits: the plot limits for the ... | GPy/plotting/gpy_plot/latent_plots.py | def plot_latent_scatter(self, labels=None,
which_indices=None,
legend=True,
plot_limits=None,
marker='<>^vsd',
num_samples=1000,
projection='2d',
**kwar... | def plot_latent_scatter(self, labels=None,
which_indices=None,
legend=True,
plot_limits=None,
marker='<>^vsd',
num_samples=1000,
projection='2d',
**kwar... | [
"Plot",
"a",
"scatter",
"plot",
"of",
"the",
"latent",
"space",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/latent_plots.py#L80-L108 | [
"def",
"plot_latent_scatter",
"(",
"self",
",",
"labels",
"=",
"None",
",",
"which_indices",
"=",
"None",
",",
"legend",
"=",
"True",
",",
"plot_limits",
"=",
"None",
",",
"marker",
"=",
"'<>^vsd'",
",",
"num_samples",
"=",
"1000",
",",
"projection",
"=",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_latent_inducing | Plot a scatter plot of the inducing inputs.
:param [int] which_indices: which input dimensions to plot against each other
:param bool legend: whether to plot the legend on the figure
:param plot_limits: the plot limits for the plot
:type plot_limits: (xmin, xmax, ymin, ymax) or ((xmin, xmax), (ymin, ym... | GPy/plotting/gpy_plot/latent_plots.py | def plot_latent_inducing(self,
which_indices=None,
legend=False,
plot_limits=None,
marker=None,
projection='2d',
**kwargs):
"""
Plot a scatter plot of the inducing inpu... | def plot_latent_inducing(self,
which_indices=None,
legend=False,
plot_limits=None,
marker=None,
projection='2d',
**kwargs):
"""
Plot a scatter plot of the inducing inpu... | [
"Plot",
"a",
"scatter",
"plot",
"of",
"the",
"inducing",
"inputs",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/latent_plots.py#L111-L138 | [
"def",
"plot_latent_inducing",
"(",
"self",
",",
"which_indices",
"=",
"None",
",",
"legend",
"=",
"False",
",",
"plot_limits",
"=",
"None",
",",
"marker",
"=",
"None",
",",
"projection",
"=",
"'2d'",
",",
"*",
"*",
"kwargs",
")",
":",
"canvas",
",",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_magnification | Plot the magnification factor of the GP on the inputs. This is the
density of the GP as a gray scale.
:param array-like labels: a label for each data point (row) of the inputs
:param (int, int) which_indices: which input dimensions to plot against each other
:param int resolution: the resolution at whi... | GPy/plotting/gpy_plot/latent_plots.py | def plot_magnification(self, labels=None, which_indices=None,
resolution=60, marker='<>^vsd', legend=True,
plot_limits=None,
updates=False,
mean=True, covariance=True,
kern=None, num_samples=1000,
scatter_kwargs=None, plot_s... | def plot_magnification(self, labels=None, which_indices=None,
resolution=60, marker='<>^vsd', legend=True,
plot_limits=None,
updates=False,
mean=True, covariance=True,
kern=None, num_samples=1000,
scatter_kwargs=None, plot_s... | [
"Plot",
"the",
"magnification",
"factor",
"of",
"the",
"GP",
"on",
"the",
"inputs",
".",
"This",
"is",
"the",
"density",
"of",
"the",
"GP",
"as",
"a",
"gray",
"scale",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/latent_plots.py#L164-L210 | [
"def",
"plot_magnification",
"(",
"self",
",",
"labels",
"=",
"None",
",",
"which_indices",
"=",
"None",
",",
"resolution",
"=",
"60",
",",
"marker",
"=",
"'<>^vsd'",
",",
"legend",
"=",
"True",
",",
"plot_limits",
"=",
"None",
",",
"updates",
"=",
"Fals... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_latent | Plot the latent space of the GP on the inputs. This is the
density of the GP posterior as a grey scale and the
scatter plot of the input dimemsions selected by which_indices.
:param array-like labels: a label for each data point (row) of the inputs
:param (int, int) which_indices: which input dimension... | GPy/plotting/gpy_plot/latent_plots.py | def plot_latent(self, labels=None, which_indices=None,
resolution=60, legend=True,
plot_limits=None,
updates=False,
kern=None, marker='<>^vsd',
num_samples=1000, projection='2d',
scatter_kwargs=None, **imshow_kwargs):
""... | def plot_latent(self, labels=None, which_indices=None,
resolution=60, legend=True,
plot_limits=None,
updates=False,
kern=None, marker='<>^vsd',
num_samples=1000, projection='2d',
scatter_kwargs=None, **imshow_kwargs):
""... | [
"Plot",
"the",
"latent",
"space",
"of",
"the",
"GP",
"on",
"the",
"inputs",
".",
"This",
"is",
"the",
"density",
"of",
"the",
"GP",
"posterior",
"as",
"a",
"grey",
"scale",
"and",
"the",
"scatter",
"plot",
"of",
"the",
"input",
"dimemsions",
"selected",
... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/latent_plots.py#L238-L280 | [
"def",
"plot_latent",
"(",
"self",
",",
"labels",
"=",
"None",
",",
"which_indices",
"=",
"None",
",",
"resolution",
"=",
"60",
",",
"legend",
"=",
"True",
",",
"plot_limits",
"=",
"None",
",",
"updates",
"=",
"False",
",",
"kern",
"=",
"None",
",",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_steepest_gradient_map | Plot the latent space of the GP on the inputs. This is the
density of the GP posterior as a grey scale and the
scatter plot of the input dimemsions selected by which_indices.
:param array-like labels: a label for each data point (row) of the inputs
:param (int, int) which_indices: which input dimension... | GPy/plotting/gpy_plot/latent_plots.py | def plot_steepest_gradient_map(self, output_labels=None, data_labels=None, which_indices=None,
resolution=15, legend=True,
plot_limits=None,
updates=False,
kern=None, marker='<>^vsd',
num_samples=1000,
annotation_kwargs=None... | def plot_steepest_gradient_map(self, output_labels=None, data_labels=None, which_indices=None,
resolution=15, legend=True,
plot_limits=None,
updates=False,
kern=None, marker='<>^vsd',
num_samples=1000,
annotation_kwargs=None... | [
"Plot",
"the",
"latent",
"space",
"of",
"the",
"GP",
"on",
"the",
"inputs",
".",
"This",
"is",
"the",
"density",
"of",
"the",
"GP",
"posterior",
"as",
"a",
"grey",
"scale",
"and",
"the",
"scatter",
"plot",
"of",
"the",
"input",
"dimemsions",
"selected",
... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/gpy_plot/latent_plots.py#L305-L346 | [
"def",
"plot_steepest_gradient_map",
"(",
"self",
",",
"output_labels",
"=",
"None",
",",
"data_labels",
"=",
"None",
",",
"which_indices",
"=",
"None",
",",
"resolution",
"=",
"15",
",",
"legend",
"=",
"True",
",",
"plot_limits",
"=",
"None",
",",
"updates"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Symbolic._set_expressions | This method is overwritten because we need to modify kdiag by substituting z for x. We do this by calling the parent expression method to extract variables from expressions, then subsitute the z variables that are present with x. | GPy/kern/src/symbolic.py | def _set_expressions(self, expressions):
"""This method is overwritten because we need to modify kdiag by substituting z for x. We do this by calling the parent expression method to extract variables from expressions, then subsitute the z variables that are present with x."""
Symbolic_core._set_expressi... | def _set_expressions(self, expressions):
"""This method is overwritten because we need to modify kdiag by substituting z for x. We do this by calling the parent expression method to extract variables from expressions, then subsitute the z variables that are present with x."""
Symbolic_core._set_expressi... | [
"This",
"method",
"is",
"overwritten",
"because",
"we",
"need",
"to",
"modify",
"kdiag",
"by",
"substituting",
"z",
"for",
"x",
".",
"We",
"do",
"this",
"by",
"calling",
"the",
"parent",
"expression",
"method",
"to",
"extract",
"variables",
"from",
"expressi... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/symbolic.py#L25-L32 | [
"def",
"_set_expressions",
"(",
"self",
",",
"expressions",
")",
":",
"Symbolic_core",
".",
"_set_expressions",
"(",
"self",
",",
"expressions",
")",
"Symbolic_core",
".",
"_set_variables",
"(",
"self",
",",
"self",
".",
"cacheable",
")",
"# Substitute z with x to... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | matrix_exponent | The function computes matrix exponent and handles some special cases | GPy/models/state_space_main.py | def matrix_exponent(M):
"""
The function computes matrix exponent and handles some special cases
"""
if (M.shape[0] == 1): # 1*1 matrix
Mexp = np.array( ((np.exp(M[0,0]) ,),) )
else: # matrix is larger
method = None
try:
Mexp = linalg.expm(M)
method ... | def matrix_exponent(M):
"""
The function computes matrix exponent and handles some special cases
"""
if (M.shape[0] == 1): # 1*1 matrix
Mexp = np.array( ((np.exp(M[0,0]) ,),) )
else: # matrix is larger
method = None
try:
Mexp = linalg.expm(M)
method ... | [
"The",
"function",
"computes",
"matrix",
"exponent",
"and",
"handles",
"some",
"special",
"cases"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L3448-L3474 | [
"def",
"matrix_exponent",
"(",
"M",
")",
":",
"if",
"(",
"M",
".",
"shape",
"[",
"0",
"]",
"==",
"1",
")",
":",
"# 1*1 matrix",
"Mexp",
"=",
"np",
".",
"array",
"(",
"(",
"(",
"np",
".",
"exp",
"(",
"M",
"[",
"0",
",",
"0",
"]",
")",
",",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | balance_matrix | Balance matrix, i.e. finds such similarity transformation of the original
matrix A: A = T * bA * T^{-1}, where norms of columns of bA and of rows of bA
are as close as possible. It is usually used as a preprocessing step in
eigenvalue calculation routine. It is useful also for State-Space models.
See ... | GPy/models/state_space_main.py | def balance_matrix(A):
"""
Balance matrix, i.e. finds such similarity transformation of the original
matrix A: A = T * bA * T^{-1}, where norms of columns of bA and of rows of bA
are as close as possible. It is usually used as a preprocessing step in
eigenvalue calculation routine. It is useful als... | def balance_matrix(A):
"""
Balance matrix, i.e. finds such similarity transformation of the original
matrix A: A = T * bA * T^{-1}, where norms of columns of bA and of rows of bA
are as close as possible. It is usually used as a preprocessing step in
eigenvalue calculation routine. It is useful als... | [
"Balance",
"matrix",
"i",
".",
"e",
".",
"finds",
"such",
"similarity",
"transformation",
"of",
"the",
"original",
"matrix",
"A",
":",
"A",
"=",
"T",
"*",
"bA",
"*",
"T^",
"{",
"-",
"1",
"}",
"where",
"norms",
"of",
"columns",
"of",
"bA",
"and",
"o... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L3476-L3552 | [
"def",
"balance_matrix",
"(",
"A",
")",
":",
"if",
"len",
"(",
"A",
".",
"shape",
")",
"!=",
"2",
"or",
"(",
"A",
".",
"shape",
"[",
"0",
"]",
"!=",
"A",
".",
"shape",
"[",
"1",
"]",
")",
":",
"raise",
"ValueError",
"(",
"'balance_matrix: Expecti... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | balance_ss_model | Balances State-Space model for more numerical stability
This is based on the following:
dx/dt = F x + L w
y = H x
Let T z = x, which gives
dz/dt = inv(T) F T z + inv(T) L w
y = H T z | GPy/models/state_space_main.py | def balance_ss_model(F,L,Qc,H,Pinf,P0,dF=None,dQc=None,dPinf=None,dP0=None):
"""
Balances State-Space model for more numerical stability
This is based on the following:
dx/dt = F x + L w
y = H x
Let T z = x, which gives
dz/dt = inv(T) F T z + inv(T) L w
y = H T z
"""... | def balance_ss_model(F,L,Qc,H,Pinf,P0,dF=None,dQc=None,dPinf=None,dP0=None):
"""
Balances State-Space model for more numerical stability
This is based on the following:
dx/dt = F x + L w
y = H x
Let T z = x, which gives
dz/dt = inv(T) F T z + inv(T) L w
y = H T z
"""... | [
"Balances",
"State",
"-",
"Space",
"model",
"for",
"more",
"numerical",
"stability"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L3554-L3622 | [
"def",
"balance_ss_model",
"(",
"F",
",",
"L",
",",
"Qc",
",",
"H",
",",
"Pinf",
",",
"P0",
",",
"dF",
"=",
"None",
",",
"dQc",
"=",
"None",
",",
"dPinf",
"=",
"None",
",",
"dP0",
"=",
"None",
")",
":",
"bF",
",",
"T",
",",
"T_inv",
"=",
"b... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | R_handling_Python.R_isrk | Function returns the inverse square root of R matrix on step k. | GPy/models/state_space_main.py | def R_isrk(self, k):
"""
Function returns the inverse square root of R matrix on step k.
"""
ind = int(self.index[self.R_time_var_index, k])
R = self.R[:, :, ind]
if (R.shape[0] == 1): # 1-D case handle simplier. No storage
# of the result, just compute it e... | def R_isrk(self, k):
"""
Function returns the inverse square root of R matrix on step k.
"""
ind = int(self.index[self.R_time_var_index, k])
R = self.R[:, :, ind]
if (R.shape[0] == 1): # 1-D case handle simplier. No storage
# of the result, just compute it e... | [
"Function",
"returns",
"the",
"inverse",
"square",
"root",
"of",
"R",
"matrix",
"on",
"step",
"k",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L244-L275 | [
"def",
"R_isrk",
"(",
"self",
",",
"k",
")",
":",
"ind",
"=",
"int",
"(",
"self",
".",
"index",
"[",
"self",
".",
"R_time_var_index",
",",
"k",
"]",
")",
"R",
"=",
"self",
".",
"R",
"[",
":",
",",
":",
",",
"ind",
"]",
"if",
"(",
"R",
".",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Std_Measurement_Callables_Python.Hk | function (k, m, P) return Jacobian of measurement function, it is
passed into p_h.
k (iteration number), starts at 0
m: point where Jacobian is evaluated
P: parameter for Jacobian, usually covariance matrix. | GPy/models/state_space_main.py | def Hk(self, k, m_pred, P_pred): # returns state iteration matrix
"""
function (k, m, P) return Jacobian of measurement function, it is
passed into p_h.
k (iteration number), starts at 0
m: point where Jacobian is evaluated
P: parameter for Jacobian, usua... | def Hk(self, k, m_pred, P_pred): # returns state iteration matrix
"""
function (k, m, P) return Jacobian of measurement function, it is
passed into p_h.
k (iteration number), starts at 0
m: point where Jacobian is evaluated
P: parameter for Jacobian, usua... | [
"function",
"(",
"k",
"m",
"P",
")",
"return",
"Jacobian",
"of",
"measurement",
"function",
"it",
"is",
"passed",
"into",
"p_h",
".",
"k",
"(",
"iteration",
"number",
")",
"starts",
"at",
"0",
"m",
":",
"point",
"where",
"Jacobian",
"is",
"evaluated",
... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L305-L314 | [
"def",
"Hk",
"(",
"self",
",",
"k",
",",
"m_pred",
",",
"P_pred",
")",
":",
"# returns state iteration matrix",
"return",
"self",
".",
"H",
"[",
":",
",",
":",
",",
"int",
"(",
"self",
".",
"index",
"[",
"self",
".",
"H_time_var_index",
",",
"k",
"]"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Q_handling_Python.Qk | function (k). Returns noise matrix of dynamic model on iteration k.
k (iteration number). starts at 0 | GPy/models/state_space_main.py | def Qk(self, k):
"""
function (k). Returns noise matrix of dynamic model on iteration k.
k (iteration number). starts at 0
"""
return self.Q[:, :, self.index[self.Q_time_var_index, k]] | def Qk(self, k):
"""
function (k). Returns noise matrix of dynamic model on iteration k.
k (iteration number). starts at 0
"""
return self.Q[:, :, self.index[self.Q_time_var_index, k]] | [
"function",
"(",
"k",
")",
".",
"Returns",
"noise",
"matrix",
"of",
"dynamic",
"model",
"on",
"iteration",
"k",
".",
"k",
"(",
"iteration",
"number",
")",
".",
"starts",
"at",
"0"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L370-L375 | [
"def",
"Qk",
"(",
"self",
",",
"k",
")",
":",
"return",
"self",
".",
"Q",
"[",
":",
",",
":",
",",
"self",
".",
"index",
"[",
"self",
".",
"Q_time_var_index",
",",
"k",
"]",
"]"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Q_handling_Python.Q_srk | function (k). Returns the square root of noise matrix of dynamic model
on iteration k.
k (iteration number). starts at 0
This function is implemented to use SVD prediction step. | GPy/models/state_space_main.py | def Q_srk(self, k):
"""
function (k). Returns the square root of noise matrix of dynamic model
on iteration k.
k (iteration number). starts at 0
This function is implemented to use SVD prediction step.
"""
ind = self.index[self.Q_time_var_index,... | def Q_srk(self, k):
"""
function (k). Returns the square root of noise matrix of dynamic model
on iteration k.
k (iteration number). starts at 0
This function is implemented to use SVD prediction step.
"""
ind = self.index[self.Q_time_var_index,... | [
"function",
"(",
"k",
")",
".",
"Returns",
"the",
"square",
"root",
"of",
"noise",
"matrix",
"of",
"dynamic",
"model",
"on",
"iteration",
"k",
".",
"k",
"(",
"iteration",
"number",
")",
".",
"starts",
"at",
"0"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L383-L420 | [
"def",
"Q_srk",
"(",
"self",
",",
"k",
")",
":",
"ind",
"=",
"self",
".",
"index",
"[",
"self",
".",
"Q_time_var_index",
",",
"k",
"]",
"Q",
"=",
"self",
".",
"Q",
"[",
":",
",",
":",
",",
"ind",
"]",
"if",
"(",
"Q",
".",
"shape",
"[",
"0",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Std_Dynamic_Callables_Python.Ak | function (k, m, P) return Jacobian of measurement function, it is
passed into p_h.
k (iteration number), starts at 0
m: point where Jacobian is evaluated
P: parameter for Jacobian, usually covariance matrix. | GPy/models/state_space_main.py | def Ak(self, k, m_pred, P_pred): # returns state iteration matrix
"""
function (k, m, P) return Jacobian of measurement function, it is
passed into p_h.
k (iteration number), starts at 0
m: point where Jacobian is evaluated
P: parameter for Jacobian, usua... | def Ak(self, k, m_pred, P_pred): # returns state iteration matrix
"""
function (k, m, P) return Jacobian of measurement function, it is
passed into p_h.
k (iteration number), starts at 0
m: point where Jacobian is evaluated
P: parameter for Jacobian, usua... | [
"function",
"(",
"k",
"m",
"P",
")",
"return",
"Jacobian",
"of",
"measurement",
"function",
"it",
"is",
"passed",
"into",
"p_h",
".",
"k",
"(",
"iteration",
"number",
")",
"starts",
"at",
"0",
"m",
":",
"point",
"where",
"Jacobian",
"is",
"evaluated",
... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L449-L458 | [
"def",
"Ak",
"(",
"self",
",",
"k",
",",
"m_pred",
",",
"P_pred",
")",
":",
"# returns state iteration matrix",
"return",
"self",
".",
"A",
"[",
":",
",",
":",
",",
"self",
".",
"index",
"[",
"self",
".",
"A_time_var_index",
",",
"k",
"]",
"]"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace._reshape_input_data | Static function returns the column-wise shape for for an input shape.
Input:
--------------
shape: tuple
Shape of an input array, so that it is always a column.
desired_dim: int
desired shape of output. For Y data it should be 3
(... | GPy/models/state_space_main.py | def _reshape_input_data(shape, desired_dim=3):
"""
Static function returns the column-wise shape for for an input shape.
Input:
--------------
shape: tuple
Shape of an input array, so that it is always a column.
desired_dim: int
d... | def _reshape_input_data(shape, desired_dim=3):
"""
Static function returns the column-wise shape for for an input shape.
Input:
--------------
shape: tuple
Shape of an input array, so that it is always a column.
desired_dim: int
d... | [
"Static",
"function",
"returns",
"the",
"column",
"-",
"wise",
"shape",
"for",
"for",
"an",
"input",
"shape",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L566-L612 | [
"def",
"_reshape_input_data",
"(",
"shape",
",",
"desired_dim",
"=",
"3",
")",
":",
"if",
"(",
"len",
"(",
"shape",
")",
">",
"3",
")",
":",
"raise",
"ValueError",
"(",
"\"\"\"Input array is not supposed to be more\n than 3 dimensional.\"\... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace.kalman_filter | This function implements the basic Kalman Filter algorithm
These notations for the State-Space model are assumed:
x_{k} = A_{k} * x_{k-1} + q_{k-1}; q_{k-1} ~ N(0, Q_{k-1})
y_{k} = H_{k} * x_{k} + r_{k}; r_{k-1} ~ N(0, R_{k})
Returns estimated filter distributi... | GPy/models/state_space_main.py | def kalman_filter(cls, p_A, p_Q, p_H, p_R, Y, index=None, m_init=None,
P_init=None, p_kalman_filter_type='regular',
calc_log_likelihood=False,
calc_grad_log_likelihood=False, grad_params_no=None,
grad_calc_params=None):
"""
... | def kalman_filter(cls, p_A, p_Q, p_H, p_R, Y, index=None, m_init=None,
P_init=None, p_kalman_filter_type='regular',
calc_log_likelihood=False,
calc_grad_log_likelihood=False, grad_params_no=None,
grad_calc_params=None):
"""
... | [
"This",
"function",
"implements",
"the",
"basic",
"Kalman",
"Filter",
"algorithm",
"These",
"notations",
"for",
"the",
"State",
"-",
"Space",
"model",
"are",
"assumed",
":",
"x_",
"{",
"k",
"}",
"=",
"A_",
"{",
"k",
"}",
"*",
"x_",
"{",
"k",
"-",
"1"... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L615-L882 | [
"def",
"kalman_filter",
"(",
"cls",
",",
"p_A",
",",
"p_Q",
",",
"p_H",
",",
"p_R",
",",
"Y",
",",
"index",
"=",
"None",
",",
"m_init",
"=",
"None",
",",
"P_init",
"=",
"None",
",",
"p_kalman_filter_type",
"=",
"'regular'",
",",
"calc_log_likelihood",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace.extended_kalman_filter | Extended Kalman Filter
Input:
-----------------
p_state_dim: integer
p_a: if None - the function from the linear model is assumed. No non-
linearity in the dynamic is assumed.
function (k, x_{k-1}, A_{k}). Dynamic function.
k: (iteration number)... | GPy/models/state_space_main.py | def extended_kalman_filter(cls,p_state_dim, p_a, p_f_A, p_f_Q, p_h, p_f_H, p_f_R, Y, m_init=None,
P_init=None,calc_log_likelihood=False):
"""
Extended Kalman Filter
Input:
-----------------
p_state_dim: integer
p_a: if None - the function fro... | def extended_kalman_filter(cls,p_state_dim, p_a, p_f_A, p_f_Q, p_h, p_f_H, p_f_R, Y, m_init=None,
P_init=None,calc_log_likelihood=False):
"""
Extended Kalman Filter
Input:
-----------------
p_state_dim: integer
p_a: if None - the function fro... | [
"Extended",
"Kalman",
"Filter"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L885-L1050 | [
"def",
"extended_kalman_filter",
"(",
"cls",
",",
"p_state_dim",
",",
"p_a",
",",
"p_f_A",
",",
"p_f_Q",
",",
"p_h",
",",
"p_f_H",
",",
"p_f_R",
",",
"Y",
",",
"m_init",
"=",
"None",
",",
"P_init",
"=",
"None",
",",
"calc_log_likelihood",
"=",
"False",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace._kalman_algorithm_raw | General nonlinear filtering algorithm for inference in the state-space
model:
x_{k} = f_a(k, x_{k-1}, A_{k}) + q_{k-1}; q_{k-1} ~ N(0, Q_{k-1})
y_{k} = f_h(k, x_{k}, H_{k}) + r_{k}; r_{k-1} ~ N(0, R_{k})
Returns estimated filter distributions x_{k} ~ N(m_{k}, P(k))
... | GPy/models/state_space_main.py | def _kalman_algorithm_raw(cls,state_dim, p_dynamic_callables, p_measurement_callables, Y, m_init,
P_init, p_kalman_filter_type='regular',
calc_log_likelihood=False,
calc_grad_log_likelihood=False, grad_params_no=None,
... | def _kalman_algorithm_raw(cls,state_dim, p_dynamic_callables, p_measurement_callables, Y, m_init,
P_init, p_kalman_filter_type='regular',
calc_log_likelihood=False,
calc_grad_log_likelihood=False, grad_params_no=None,
... | [
"General",
"nonlinear",
"filtering",
"algorithm",
"for",
"inference",
"in",
"the",
"state",
"-",
"space",
"model",
":"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L1053-L1273 | [
"def",
"_kalman_algorithm_raw",
"(",
"cls",
",",
"state_dim",
",",
"p_dynamic_callables",
",",
"p_measurement_callables",
",",
"Y",
",",
"m_init",
",",
"P_init",
",",
"p_kalman_filter_type",
"=",
"'regular'",
",",
"calc_log_likelihood",
"=",
"False",
",",
"calc_grad... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace._kalman_prediction_step | Desctrete prediction function
Input:
k:int
Iteration No. Starts at 0. Total number of iterations equal to the
number of measurements.
p_m: matrix of size (state_dim, time_series_no)
Mean value from the previous step. For "multiple time se... | GPy/models/state_space_main.py | def _kalman_prediction_step(k, p_m , p_P, p_dyn_model_callable, calc_grad_log_likelihood=False,
p_dm = None, p_dP = None):
"""
Desctrete prediction function
Input:
k:int
Iteration No. Starts at 0. Total number of iterations equal to th... | def _kalman_prediction_step(k, p_m , p_P, p_dyn_model_callable, calc_grad_log_likelihood=False,
p_dm = None, p_dP = None):
"""
Desctrete prediction function
Input:
k:int
Iteration No. Starts at 0. Total number of iterations equal to th... | [
"Desctrete",
"prediction",
"function"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L1276-L1354 | [
"def",
"_kalman_prediction_step",
"(",
"k",
",",
"p_m",
",",
"p_P",
",",
"p_dyn_model_callable",
",",
"calc_grad_log_likelihood",
"=",
"False",
",",
"p_dm",
"=",
"None",
",",
"p_dP",
"=",
"None",
")",
":",
"# index correspond to values from previous iteration.",
"A"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace._kalman_prediction_step_SVD | Desctrete prediction function
Input:
k:int
Iteration No. Starts at 0. Total number of iterations equal to the
number of measurements.
p_m: matrix of size (state_dim, time_series_no)
Mean value from the previous step. For "multiple time se... | GPy/models/state_space_main.py | def _kalman_prediction_step_SVD(k, p_m , p_P, p_dyn_model_callable, calc_grad_log_likelihood=False,
p_dm = None, p_dP = None):
"""
Desctrete prediction function
Input:
k:int
Iteration No. Starts at 0. Total number of iterations equal t... | def _kalman_prediction_step_SVD(k, p_m , p_P, p_dyn_model_callable, calc_grad_log_likelihood=False,
p_dm = None, p_dP = None):
"""
Desctrete prediction function
Input:
k:int
Iteration No. Starts at 0. Total number of iterations equal t... | [
"Desctrete",
"prediction",
"function"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L1357-L1454 | [
"def",
"_kalman_prediction_step_SVD",
"(",
"k",
",",
"p_m",
",",
"p_P",
",",
"p_dyn_model_callable",
",",
"calc_grad_log_likelihood",
"=",
"False",
",",
"p_dm",
"=",
"None",
",",
"p_dP",
"=",
"None",
")",
":",
"# covariance from the previous step and its SVD decomposi... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace._kalman_update_step | Input:
k: int
Iteration No. Starts at 0. Total number of iterations equal to the
number of measurements.
m_P: matrix of size (state_dim, time_series_no)
Mean value from the previous step. For "multiple time series mode"
it is matrix, second dime... | GPy/models/state_space_main.py | def _kalman_update_step(k, p_m , p_P, p_meas_model_callable, measurement, calc_log_likelihood= False,
calc_grad_log_likelihood=False, p_dm = None, p_dP = None):
"""
Input:
k: int
Iteration No. Starts at 0. Total number of iterations equal to the
... | def _kalman_update_step(k, p_m , p_P, p_meas_model_callable, measurement, calc_log_likelihood= False,
calc_grad_log_likelihood=False, p_dm = None, p_dP = None):
"""
Input:
k: int
Iteration No. Starts at 0. Total number of iterations equal to the
... | [
"Input",
":"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L1457-L1623 | [
"def",
"_kalman_update_step",
"(",
"k",
",",
"p_m",
",",
"p_P",
",",
"p_meas_model_callable",
",",
"measurement",
",",
"calc_log_likelihood",
"=",
"False",
",",
"calc_grad_log_likelihood",
"=",
"False",
",",
"p_dm",
"=",
"None",
",",
"p_dP",
"=",
"None",
")",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace._kalman_update_step_SVD | Input:
k: int
Iteration No. Starts at 0. Total number of iterations equal to the
number of measurements.
m_P: matrix of size (state_dim, time_series_no)
Mean value from the previous step. For "multiple time series mode"
it is matrix, second dime... | GPy/models/state_space_main.py | def _kalman_update_step_SVD(k, p_m , p_P, p_meas_model_callable, measurement, calc_log_likelihood= False,
calc_grad_log_likelihood=False, p_dm = None, p_dP = None):
"""
Input:
k: int
Iteration No. Starts at 0. Total number of iterations equal to the
... | def _kalman_update_step_SVD(k, p_m , p_P, p_meas_model_callable, measurement, calc_log_likelihood= False,
calc_grad_log_likelihood=False, p_dm = None, p_dP = None):
"""
Input:
k: int
Iteration No. Starts at 0. Total number of iterations equal to the
... | [
"Input",
":"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L1626-L1830 | [
"def",
"_kalman_update_step_SVD",
"(",
"k",
",",
"p_m",
",",
"p_P",
",",
"p_meas_model_callable",
",",
"measurement",
",",
"calc_log_likelihood",
"=",
"False",
",",
"calc_grad_log_likelihood",
"=",
"False",
",",
"p_dm",
"=",
"None",
",",
"p_dP",
"=",
"None",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace._rts_smoother_update_step | Rauch–Tung–Striebel(RTS) update step
Input:
-----------------------------
k: int
Iteration No. Starts at 0. Total number of iterations equal to the
number of measurements.
p_m: matrix of size (state_dim, time_series_no)
Filter mean on step k
... | GPy/models/state_space_main.py | def _rts_smoother_update_step(k, p_m , p_P, p_m_pred, p_P_pred, p_m_prev_step,
p_P_prev_step, p_dynamic_callables):
"""
Rauch–Tung–Striebel(RTS) update step
Input:
-----------------------------
k: int
Iteration No. Starts at 0. Tot... | def _rts_smoother_update_step(k, p_m , p_P, p_m_pred, p_P_pred, p_m_prev_step,
p_P_prev_step, p_dynamic_callables):
"""
Rauch–Tung–Striebel(RTS) update step
Input:
-----------------------------
k: int
Iteration No. Starts at 0. Tot... | [
"Rauch–Tung–Striebel",
"(",
"RTS",
")",
"update",
"step"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L1833-L1890 | [
"def",
"_rts_smoother_update_step",
"(",
"k",
",",
"p_m",
",",
"p_P",
",",
"p_m_pred",
",",
"p_P_pred",
",",
"p_m_prev_step",
",",
"p_P_prev_step",
",",
"p_dynamic_callables",
")",
":",
"A",
"=",
"p_dynamic_callables",
".",
"Ak",
"(",
"k",
",",
"p_m",
",",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace.rts_smoother | This function implements Rauch–Tung–Striebel(RTS) smoother algorithm
based on the results of kalman_filter_raw.
These notations are the same:
x_{k} = A_{k} * x_{k-1} + q_{k-1}; q_{k-1} ~ N(0, Q_{k-1})
y_{k} = H_{k} * x_{k} + r_{k}; r_{k-1} ~ N(0, R_{k})
... | GPy/models/state_space_main.py | def rts_smoother(cls,state_dim, p_dynamic_callables, filter_means,
filter_covars):
"""
This function implements Rauch–Tung–Striebel(RTS) smoother algorithm
based on the results of kalman_filter_raw.
These notations are the same:
x_{k} = A_{k} * x_{k... | def rts_smoother(cls,state_dim, p_dynamic_callables, filter_means,
filter_covars):
"""
This function implements Rauch–Tung–Striebel(RTS) smoother algorithm
based on the results of kalman_filter_raw.
These notations are the same:
x_{k} = A_{k} * x_{k... | [
"This",
"function",
"implements",
"Rauch–Tung–Striebel",
"(",
"RTS",
")",
"smoother",
"algorithm",
"based",
"on",
"the",
"results",
"of",
"kalman_filter_raw",
".",
"These",
"notations",
"are",
"the",
"same",
":",
"x_",
"{",
"k",
"}",
"=",
"A_",
"{",
"k",
"... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L1893-L1968 | [
"def",
"rts_smoother",
"(",
"cls",
",",
"state_dim",
",",
"p_dynamic_callables",
",",
"filter_means",
",",
"filter_covars",
")",
":",
"no_steps",
"=",
"filter_covars",
".",
"shape",
"[",
"0",
"]",
"-",
"1",
"# number of steps (minus initial covariance)",
"M",
"=",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace._EM_gradient | Gradient computation with the EM algorithm.
Input:
-----------------
M: Means from the smoother
P: Variances from the smoother
G: Gains? from the smoother | GPy/models/state_space_main.py | def _EM_gradient(A,Q,H,R,m_init,P_init,measurements, M, P, G, dA, dQ, dH, dR, dm_init, dP_init):
"""
Gradient computation with the EM algorithm.
Input:
-----------------
M: Means from the smoother
P: Variances from the smoother
G: Gains? from the smoother
... | def _EM_gradient(A,Q,H,R,m_init,P_init,measurements, M, P, G, dA, dQ, dH, dR, dm_init, dP_init):
"""
Gradient computation with the EM algorithm.
Input:
-----------------
M: Means from the smoother
P: Variances from the smoother
G: Gains? from the smoother
... | [
"Gradient",
"computation",
"with",
"the",
"EM",
"algorithm",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L1971-L2074 | [
"def",
"_EM_gradient",
"(",
"A",
",",
"Q",
",",
"H",
",",
"R",
",",
"m_init",
",",
"P_init",
",",
"measurements",
",",
"M",
",",
"P",
",",
"G",
",",
"dA",
",",
"dQ",
",",
"dH",
",",
"dR",
",",
"dm_init",
",",
"dP_init",
")",
":",
"import",
"p... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace._check_SS_matrix | Veryfy that on exit the matrix has appropriate shape for the KF algorithm.
Input:
p_M: matrix
As it is given for the user
state_dim: int
State dimensioanlity
measurement_dim: int
Measurement dimensionality
which: st... | GPy/models/state_space_main.py | def _check_SS_matrix(p_M, state_dim, measurement_dim, which='A'):
"""
Veryfy that on exit the matrix has appropriate shape for the KF algorithm.
Input:
p_M: matrix
As it is given for the user
state_dim: int
State dimensioanlity
... | def _check_SS_matrix(p_M, state_dim, measurement_dim, which='A'):
"""
Veryfy that on exit the matrix has appropriate shape for the KF algorithm.
Input:
p_M: matrix
As it is given for the user
state_dim: int
State dimensioanlity
... | [
"Veryfy",
"that",
"on",
"exit",
"the",
"matrix",
"has",
"appropriate",
"shape",
"for",
"the",
"KF",
"algorithm",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L2077-L2119 | [
"def",
"_check_SS_matrix",
"(",
"p_M",
",",
"state_dim",
",",
"measurement_dim",
",",
"which",
"=",
"'A'",
")",
":",
"old_M_shape",
"=",
"None",
"if",
"len",
"(",
"p_M",
".",
"shape",
")",
"<",
"3",
":",
"# new shape is 3 dimensional",
"old_M_shape",
"=",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace._check_grad_state_matrices | Function checks (mostly check dimensions) matrices for marginal likelihood
gradient parameters calculation. It check dA, dQ matrices.
Input:
-------------
dM: None, scaler or 3D matrix
It is supposed to be (state_dim,state_dim,grad_params_no) matrix.
... | GPy/models/state_space_main.py | def _check_grad_state_matrices(dM, state_dim, grad_params_no, which = 'dA'):
"""
Function checks (mostly check dimensions) matrices for marginal likelihood
gradient parameters calculation. It check dA, dQ matrices.
Input:
-------------
dM: None, scaler or 3D matrix
... | def _check_grad_state_matrices(dM, state_dim, grad_params_no, which = 'dA'):
"""
Function checks (mostly check dimensions) matrices for marginal likelihood
gradient parameters calculation. It check dA, dQ matrices.
Input:
-------------
dM: None, scaler or 3D matrix
... | [
"Function",
"checks",
"(",
"mostly",
"check",
"dimensions",
")",
"matrices",
"for",
"marginal",
"likelihood",
"gradient",
"parameters",
"calculation",
".",
"It",
"check",
"dA",
"dQ",
"matrices",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L2122-L2171 | [
"def",
"_check_grad_state_matrices",
"(",
"dM",
",",
"state_dim",
",",
"grad_params_no",
",",
"which",
"=",
"'dA'",
")",
":",
"if",
"dM",
"is",
"None",
":",
"dM",
"=",
"np",
".",
"zeros",
"(",
"(",
"state_dim",
",",
"state_dim",
",",
"grad_params_no",
")... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DescreteStateSpace._check_grad_measurement_matrices | Function checks (mostly check dimensions) matrices for marginal likelihood
gradient parameters calculation. It check dH, dR matrices.
Input:
-------------
dM: None, scaler or 3D matrix
It is supposed to be
(measurement_dim ,state_dim,grad_params_no) f... | GPy/models/state_space_main.py | def _check_grad_measurement_matrices(dM, state_dim, grad_params_no, measurement_dim, which = 'dH'):
"""
Function checks (mostly check dimensions) matrices for marginal likelihood
gradient parameters calculation. It check dH, dR matrices.
Input:
-------------
dM: None... | def _check_grad_measurement_matrices(dM, state_dim, grad_params_no, measurement_dim, which = 'dH'):
"""
Function checks (mostly check dimensions) matrices for marginal likelihood
gradient parameters calculation. It check dH, dR matrices.
Input:
-------------
dM: None... | [
"Function",
"checks",
"(",
"mostly",
"check",
"dimensions",
")",
"matrices",
"for",
"marginal",
"likelihood",
"gradient",
"parameters",
"calculation",
".",
"It",
"check",
"dH",
"dR",
"matrices",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L2175-L2234 | [
"def",
"_check_grad_measurement_matrices",
"(",
"dM",
",",
"state_dim",
",",
"grad_params_no",
",",
"measurement_dim",
",",
"which",
"=",
"'dH'",
")",
":",
"if",
"dM",
"is",
"None",
":",
"if",
"which",
"==",
"'dH'",
":",
"dM",
"=",
"np",
".",
"zeros",
"(... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | ContDescrStateSpace.cont_discr_kalman_filter | This function implements the continuous-discrete Kalman Filter algorithm
These notations for the State-Space model are assumed:
d/dt x(t) = F * x(t) + L * w(t); w(t) ~ N(0, Qc)
y_{k} = H_{k} * x_{k} + r_{k}; r_{k-1} ~ N(0, R_{k})
Returns estimated filter dist... | GPy/models/state_space_main.py | def cont_discr_kalman_filter(cls, F, L, Qc, p_H, p_R, P_inf, X, Y, index = None,
m_init=None, P_init=None,
p_kalman_filter_type='regular',
calc_log_likelihood=False,
calc_grad_log_likeliho... | def cont_discr_kalman_filter(cls, F, L, Qc, p_H, p_R, P_inf, X, Y, index = None,
m_init=None, P_init=None,
p_kalman_filter_type='regular',
calc_log_likelihood=False,
calc_grad_log_likeliho... | [
"This",
"function",
"implements",
"the",
"continuous",
"-",
"discrete",
"Kalman",
"Filter",
"algorithm",
"These",
"notations",
"for",
"the",
"State",
"-",
"Space",
"model",
"are",
"assumed",
":",
"d",
"/",
"dt",
"x",
"(",
"t",
")",
"=",
"F",
"*",
"x",
... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L2656-L2924 | [
"def",
"cont_discr_kalman_filter",
"(",
"cls",
",",
"F",
",",
"L",
",",
"Qc",
",",
"p_H",
",",
"p_R",
",",
"P_inf",
",",
"X",
",",
"Y",
",",
"index",
"=",
"None",
",",
"m_init",
"=",
"None",
",",
"P_init",
"=",
"None",
",",
"p_kalman_filter_type",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | ContDescrStateSpace._cont_to_discrete_object | Function return the object which is used in Kalman filter and/or
smoother to obtain matrices A, Q and their derivatives for discrete model
from the continuous model.
There are 2 objects AQcompute_once and AQcompute_batch and the function
returs the appropriate one based on the number of... | GPy/models/state_space_main.py | def _cont_to_discrete_object(cls, X, F, L, Qc, compute_derivatives=False,
grad_params_no=None,
P_inf=None, dP_inf=None, dF = None, dQc=None,
dt0=None):
"""
Function return the object which is used in Kalma... | def _cont_to_discrete_object(cls, X, F, L, Qc, compute_derivatives=False,
grad_params_no=None,
P_inf=None, dP_inf=None, dF = None, dQc=None,
dt0=None):
"""
Function return the object which is used in Kalma... | [
"Function",
"return",
"the",
"object",
"which",
"is",
"used",
"in",
"Kalman",
"filter",
"and",
"/",
"or",
"smoother",
"to",
"obtain",
"matrices",
"A",
"Q",
"and",
"their",
"derivatives",
"for",
"discrete",
"model",
"from",
"the",
"continuous",
"model",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L3196-L3274 | [
"def",
"_cont_to_discrete_object",
"(",
"cls",
",",
"X",
",",
"F",
",",
"L",
",",
"Qc",
",",
"compute_derivatives",
"=",
"False",
",",
"grad_params_no",
"=",
"None",
",",
"P_inf",
"=",
"None",
",",
"dP_inf",
"=",
"None",
",",
"dF",
"=",
"None",
",",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | ContDescrStateSpace.lti_sde_to_descrete | Linear Time-Invariant Stochastic Differential Equation (LTI SDE):
dx(t) = F x(t) dt + L d \beta ,where
x(t): (vector) stochastic process
\beta: (vector) Brownian motion process
F, L: (time invariant) matrices of corresponding dimensions
Qc: ... | GPy/models/state_space_main.py | def lti_sde_to_descrete(F,L,Qc,dt,compute_derivatives=False,
grad_params_no=None, P_inf=None,
dP_inf=None, dF = None, dQc=None):
"""
Linear Time-Invariant Stochastic Differential Equation (LTI SDE):
dx(t) = F x(t) dt + L d \beta ,wher... | def lti_sde_to_descrete(F,L,Qc,dt,compute_derivatives=False,
grad_params_no=None, P_inf=None,
dP_inf=None, dF = None, dQc=None):
"""
Linear Time-Invariant Stochastic Differential Equation (LTI SDE):
dx(t) = F x(t) dt + L d \beta ,wher... | [
"Linear",
"Time",
"-",
"Invariant",
"Stochastic",
"Differential",
"Equation",
"(",
"LTI",
"SDE",
")",
":"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_main.py#L3277-L3446 | [
"def",
"lti_sde_to_descrete",
"(",
"F",
",",
"L",
",",
"Qc",
",",
"dt",
",",
"compute_derivatives",
"=",
"False",
",",
"grad_params_no",
"=",
"None",
",",
"P_inf",
"=",
"None",
",",
"dP_inf",
"=",
"None",
",",
"dF",
"=",
"None",
",",
"dQc",
"=",
"Non... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | MLPext._f_preactivations | Computes the network preactivations, i.e. the results of all intermediate linear layers before applying the
activation function on them
:param X: input data
:return: list of preactivations [X, XW+b, f(XW+b)W+b, ...] | GPy/mappings/mlpext.py | def _f_preactivations(self, X):
"""Computes the network preactivations, i.e. the results of all intermediate linear layers before applying the
activation function on them
:param X: input data
:return: list of preactivations [X, XW+b, f(XW+b)W+b, ...]
"""
preactivations_l... | def _f_preactivations(self, X):
"""Computes the network preactivations, i.e. the results of all intermediate linear layers before applying the
activation function on them
:param X: input data
:return: list of preactivations [X, XW+b, f(XW+b)W+b, ...]
"""
preactivations_l... | [
"Computes",
"the",
"network",
"preactivations",
"i",
".",
"e",
".",
"the",
"results",
"of",
"all",
"intermediate",
"linear",
"layers",
"before",
"applying",
"the",
"activation",
"function",
"on",
"them",
":",
"param",
"X",
":",
"input",
"data",
":",
"return"... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/mappings/mlpext.py#L69-L86 | [
"def",
"_f_preactivations",
"(",
"self",
",",
"X",
")",
":",
"preactivations_list",
"=",
"list",
"(",
")",
"net",
"=",
"X",
"preactivations_list",
".",
"append",
"(",
"X",
")",
"for",
"W",
",",
"b",
",",
"i",
"in",
"zip",
"(",
"self",
".",
"W_list",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | MLPext.fix_parameters | Helper function that fixes all parameters | GPy/mappings/mlpext.py | def fix_parameters(self):
"""Helper function that fixes all parameters"""
for W, b in zip(self.W_list, self.b_list):
W.fix()
b.fix() | def fix_parameters(self):
"""Helper function that fixes all parameters"""
for W, b in zip(self.W_list, self.b_list):
W.fix()
b.fix() | [
"Helper",
"function",
"that",
"fixes",
"all",
"parameters"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/mappings/mlpext.py#L109-L113 | [
"def",
"fix_parameters",
"(",
"self",
")",
":",
"for",
"W",
",",
"b",
"in",
"zip",
"(",
"self",
".",
"W_list",
",",
"self",
".",
"b_list",
")",
":",
"W",
".",
"fix",
"(",
")",
"b",
".",
"fix",
"(",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | MLPext.unfix_parameters | Helper function that unfixes all parameters | GPy/mappings/mlpext.py | def unfix_parameters(self):
"""Helper function that unfixes all parameters"""
for W, b in zip(self.W_list, self.b_list):
W.unfix()
b.unfix() | def unfix_parameters(self):
"""Helper function that unfixes all parameters"""
for W, b in zip(self.W_list, self.b_list):
W.unfix()
b.unfix() | [
"Helper",
"function",
"that",
"unfixes",
"all",
"parameters"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/mappings/mlpext.py#L115-L119 | [
"def",
"unfix_parameters",
"(",
"self",
")",
":",
"for",
"W",
",",
"b",
"in",
"zip",
"(",
"self",
".",
"W_list",
",",
"self",
".",
"b_list",
")",
":",
"W",
".",
"unfix",
"(",
")",
"b",
".",
"unfix",
"(",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | numpy_invalid_op_as_exception | A decorator that allows catching numpy invalid operations
as exceptions (the default behaviour is raising warnings). | GPy/kern/src/prod.py | def numpy_invalid_op_as_exception(func):
"""
A decorator that allows catching numpy invalid operations
as exceptions (the default behaviour is raising warnings).
"""
def func_wrapper(*args, **kwargs):
np.seterr(invalid='raise')
result = func(*args, **kwargs)
np.seterr(invalid... | def numpy_invalid_op_as_exception(func):
"""
A decorator that allows catching numpy invalid operations
as exceptions (the default behaviour is raising warnings).
"""
def func_wrapper(*args, **kwargs):
np.seterr(invalid='raise')
result = func(*args, **kwargs)
np.seterr(invalid... | [
"A",
"decorator",
"that",
"allows",
"catching",
"numpy",
"invalid",
"operations",
"as",
"exceptions",
"(",
"the",
"default",
"behaviour",
"is",
"raising",
"warnings",
")",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/prod.py#L11-L21 | [
"def",
"numpy_invalid_op_as_exception",
"(",
"func",
")",
":",
"def",
"func_wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"np",
".",
"seterr",
"(",
"invalid",
"=",
"'raise'",
")",
"result",
"=",
"func",
"(",
"*",
"args",
",",
"*",
"*... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | dkron | Function computes the derivative of Kronecker product A*B
(or Kronecker sum A+B).
Input:
-----------------------
A: 2D matrix
Some matrix
dA: 3D (or 2D matrix)
Derivarives of A
B: 2D matrix
Some matrix
dB: 3D (or 2D matrix)
Derivarives of B
operation: s... | GPy/kern/src/prod.py | def dkron(A,dA,B,dB, operation='prod'):
"""
Function computes the derivative of Kronecker product A*B
(or Kronecker sum A+B).
Input:
-----------------------
A: 2D matrix
Some matrix
dA: 3D (or 2D matrix)
Derivarives of A
B: 2D matrix
Some matrix
dB: 3D (or 2... | def dkron(A,dA,B,dB, operation='prod'):
"""
Function computes the derivative of Kronecker product A*B
(or Kronecker sum A+B).
Input:
-----------------------
A: 2D matrix
Some matrix
dA: 3D (or 2D matrix)
Derivarives of A
B: 2D matrix
Some matrix
dB: 3D (or 2... | [
"Function",
"computes",
"the",
"derivative",
"of",
"Kronecker",
"product",
"A",
"*",
"B",
"(",
"or",
"Kronecker",
"sum",
"A",
"+",
"B",
")",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/prod.py#L181-L234 | [
"def",
"dkron",
"(",
"A",
",",
"dA",
",",
"B",
",",
"dB",
",",
"operation",
"=",
"'prod'",
")",
":",
"if",
"dA",
"is",
"None",
":",
"dA_param_num",
"=",
"0",
"dA",
"=",
"np",
".",
"zeros",
"(",
"(",
"A",
".",
"shape",
"[",
"0",
"]",
",",
"A... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Prod.to_dict | Convert the object into a json serializable dictionary.
Note: It uses the private method _save_to_input_dict of the parent.
:return dict: json serializable dictionary containing the needed information to instantiate the object | GPy/kern/src/prod.py | def to_dict(self):
"""
Convert the object into a json serializable dictionary.
Note: It uses the private method _save_to_input_dict of the parent.
:return dict: json serializable dictionary containing the needed information to instantiate the object
"""
input_dict = su... | def to_dict(self):
"""
Convert the object into a json serializable dictionary.
Note: It uses the private method _save_to_input_dict of the parent.
:return dict: json serializable dictionary containing the needed information to instantiate the object
"""
input_dict = su... | [
"Convert",
"the",
"object",
"into",
"a",
"json",
"serializable",
"dictionary",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/prod.py#L45-L56 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"input_dict",
"=",
"super",
"(",
"Prod",
",",
"self",
")",
".",
"_save_to_input_dict",
"(",
")",
"input_dict",
"[",
"\"class\"",
"]",
"=",
"str",
"(",
"\"GPy.kern.Prod\"",
")",
"return",
"input_dict"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Prod.sde_update_gradient_full | Update gradient in the order in which parameters are represented in the
kernel | GPy/kern/src/prod.py | def sde_update_gradient_full(self, gradients):
"""
Update gradient in the order in which parameters are represented in the
kernel
"""
part_start_param_index = 0
for p in self.parts:
if not p.is_fixed:
part_param_num = len(p.param_array) # numbe... | def sde_update_gradient_full(self, gradients):
"""
Update gradient in the order in which parameters are represented in the
kernel
"""
part_start_param_index = 0
for p in self.parts:
if not p.is_fixed:
part_param_num = len(p.param_array) # numbe... | [
"Update",
"gradient",
"in",
"the",
"order",
"in",
"which",
"parameters",
"are",
"represented",
"in",
"the",
"kernel"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/prod.py#L125-L135 | [
"def",
"sde_update_gradient_full",
"(",
"self",
",",
"gradients",
")",
":",
"part_start_param_index",
"=",
"0",
"for",
"p",
"in",
"self",
".",
"parts",
":",
"if",
"not",
"p",
".",
"is_fixed",
":",
"part_param_num",
"=",
"len",
"(",
"p",
".",
"param_array",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | StdPeriodic.to_dict | Convert the object into a json serializable dictionary.
Note: It uses the private method _save_to_input_dict of the parent.
:return dict: json serializable dictionary containing the needed information to instantiate the object | GPy/kern/src/standard_periodic.py | def to_dict(self):
"""
Convert the object into a json serializable dictionary.
Note: It uses the private method _save_to_input_dict of the parent.
:return dict: json serializable dictionary containing the needed information to instantiate the object
"""
input_dict = su... | def to_dict(self):
"""
Convert the object into a json serializable dictionary.
Note: It uses the private method _save_to_input_dict of the parent.
:return dict: json serializable dictionary containing the needed information to instantiate the object
"""
input_dict = su... | [
"Convert",
"the",
"object",
"into",
"a",
"json",
"serializable",
"dictionary",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/standard_periodic.py#L96-L112 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"input_dict",
"=",
"super",
"(",
"StdPeriodic",
",",
"self",
")",
".",
"_save_to_input_dict",
"(",
")",
"input_dict",
"[",
"\"class\"",
"]",
"=",
"\"GPy.kern.StdPeriodic\"",
"input_dict",
"[",
"\"variance\"",
"]",
"=",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | StdPeriodic.K | Compute the covariance matrix between X and X2. | GPy/kern/src/standard_periodic.py | def K(self, X, X2=None):
"""Compute the covariance matrix between X and X2."""
if X2 is None:
X2 = X
base = np.pi * (X[:, None, :] - X2[None, :, :]) / self.period
exp_dist = np.exp( -0.5* np.sum( np.square( np.sin( base ) / self.lengthscale ), axis = -1 ) )
return ... | def K(self, X, X2=None):
"""Compute the covariance matrix between X and X2."""
if X2 is None:
X2 = X
base = np.pi * (X[:, None, :] - X2[None, :, :]) / self.period
exp_dist = np.exp( -0.5* np.sum( np.square( np.sin( base ) / self.lengthscale ), axis = -1 ) )
return ... | [
"Compute",
"the",
"covariance",
"matrix",
"between",
"X",
"and",
"X2",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/standard_periodic.py#L126-L134 | [
"def",
"K",
"(",
"self",
",",
"X",
",",
"X2",
"=",
"None",
")",
":",
"if",
"X2",
"is",
"None",
":",
"X2",
"=",
"X",
"base",
"=",
"np",
".",
"pi",
"*",
"(",
"X",
"[",
":",
",",
"None",
",",
":",
"]",
"-",
"X2",
"[",
"None",
",",
":",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | StdPeriodic.Kdiag | Compute the diagonal of the covariance matrix associated to X. | GPy/kern/src/standard_periodic.py | def Kdiag(self, X):
"""Compute the diagonal of the covariance matrix associated to X."""
ret = np.empty(X.shape[0])
ret[:] = self.variance
return ret | def Kdiag(self, X):
"""Compute the diagonal of the covariance matrix associated to X."""
ret = np.empty(X.shape[0])
ret[:] = self.variance
return ret | [
"Compute",
"the",
"diagonal",
"of",
"the",
"covariance",
"matrix",
"associated",
"to",
"X",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/standard_periodic.py#L137-L141 | [
"def",
"Kdiag",
"(",
"self",
",",
"X",
")",
":",
"ret",
"=",
"np",
".",
"empty",
"(",
"X",
".",
"shape",
"[",
"0",
"]",
")",
"ret",
"[",
":",
"]",
"=",
"self",
".",
"variance",
"return",
"ret"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | StdPeriodic.update_gradients_full | derivative of the covariance matrix with respect to the parameters. | GPy/kern/src/standard_periodic.py | def update_gradients_full(self, dL_dK, X, X2=None):
"""derivative of the covariance matrix with respect to the parameters."""
if X2 is None:
X2 = X
base = np.pi * (X[:, None, :] - X2[None, :, :]) / self.period
sin_base = np.sin( base )
exp_dist = np.exp( -0.5* np.su... | def update_gradients_full(self, dL_dK, X, X2=None):
"""derivative of the covariance matrix with respect to the parameters."""
if X2 is None:
X2 = X
base = np.pi * (X[:, None, :] - X2[None, :, :]) / self.period
sin_base = np.sin( base )
exp_dist = np.exp( -0.5* np.su... | [
"derivative",
"of",
"the",
"covariance",
"matrix",
"with",
"respect",
"to",
"the",
"parameters",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/standard_periodic.py#L143-L168 | [
"def",
"update_gradients_full",
"(",
"self",
",",
"dL_dK",
",",
"X",
",",
"X2",
"=",
"None",
")",
":",
"if",
"X2",
"is",
"None",
":",
"X2",
"=",
"X",
"base",
"=",
"np",
".",
"pi",
"*",
"(",
"X",
"[",
":",
",",
"None",
",",
":",
"]",
"-",
"X... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | StdPeriodic.update_gradients_diag | derivative of the diagonal of the covariance matrix with respect to the parameters. | GPy/kern/src/standard_periodic.py | def update_gradients_diag(self, dL_dKdiag, X):
"""derivative of the diagonal of the covariance matrix with respect to the parameters."""
self.variance.gradient = np.sum(dL_dKdiag)
self.period.gradient = 0
self.lengthscale.gradient = 0 | def update_gradients_diag(self, dL_dKdiag, X):
"""derivative of the diagonal of the covariance matrix with respect to the parameters."""
self.variance.gradient = np.sum(dL_dKdiag)
self.period.gradient = 0
self.lengthscale.gradient = 0 | [
"derivative",
"of",
"the",
"diagonal",
"of",
"the",
"covariance",
"matrix",
"with",
"respect",
"to",
"the",
"parameters",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/standard_periodic.py#L170-L174 | [
"def",
"update_gradients_diag",
"(",
"self",
",",
"dL_dKdiag",
",",
"X",
")",
":",
"self",
".",
"variance",
".",
"gradient",
"=",
"np",
".",
"sum",
"(",
"dL_dKdiag",
")",
"self",
".",
"period",
".",
"gradient",
"=",
"0",
"self",
".",
"lengthscale",
"."... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot | Plot the geometry of a shapefile
:param shape_records: geometry and attributes list
:type shape_records: ShapeRecord object (output of a shapeRecords() method)
:param facecolor: color to be used to fill in polygons
:param edgecolor: color to be used for lines
:param ax: axes to plot on.
:type a... | GPy/plotting/matplot_dep/maps.py | def plot(shape_records,facecolor='w',edgecolor='k',linewidths=.5, ax=None,xlims=None,ylims=None):
"""
Plot the geometry of a shapefile
:param shape_records: geometry and attributes list
:type shape_records: ShapeRecord object (output of a shapeRecords() method)
:param facecolor: color to be used to... | def plot(shape_records,facecolor='w',edgecolor='k',linewidths=.5, ax=None,xlims=None,ylims=None):
"""
Plot the geometry of a shapefile
:param shape_records: geometry and attributes list
:type shape_records: ShapeRecord object (output of a shapeRecords() method)
:param facecolor: color to be used to... | [
"Plot",
"the",
"geometry",
"of",
"a",
"shapefile"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/maps.py#L18-L55 | [
"def",
"plot",
"(",
"shape_records",
",",
"facecolor",
"=",
"'w'",
",",
"edgecolor",
"=",
"'k'",
",",
"linewidths",
"=",
".5",
",",
"ax",
"=",
"None",
",",
"xlims",
"=",
"None",
",",
"ylims",
"=",
"None",
")",
":",
"#Axes handle",
"if",
"ax",
"is",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | string_match | Return the geometry and attributes of a shapefile whose fields match a regular expression given
:param sf: shapefile
:type sf: shapefile object
:regex: regular expression to match
:type regex: string
:field: field number to be matched with the regex
:type field: integer | GPy/plotting/matplot_dep/maps.py | def string_match(sf,regex,field=2):
"""
Return the geometry and attributes of a shapefile whose fields match a regular expression given
:param sf: shapefile
:type sf: shapefile object
:regex: regular expression to match
:type regex: string
:field: field number to be matched with the regex
... | def string_match(sf,regex,field=2):
"""
Return the geometry and attributes of a shapefile whose fields match a regular expression given
:param sf: shapefile
:type sf: shapefile object
:regex: regular expression to match
:type regex: string
:field: field number to be matched with the regex
... | [
"Return",
"the",
"geometry",
"and",
"attributes",
"of",
"a",
"shapefile",
"whose",
"fields",
"match",
"a",
"regular",
"expression",
"given"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/maps.py#L58-L76 | [
"def",
"string_match",
"(",
"sf",
",",
"regex",
",",
"field",
"=",
"2",
")",
":",
"index",
"=",
"[",
"]",
"shape_records",
"=",
"[",
"]",
"for",
"rec",
"in",
"enumerate",
"(",
"sf",
".",
"shapeRecords",
"(",
")",
")",
":",
"m",
"=",
"re",
".",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | bbox_match | Return the geometry and attributes of a shapefile that lie within (or intersect) a bounding box
:param sf: shapefile
:type sf: shapefile object
:param bbox: bounding box
:type bbox: list of floats [x_min,y_min,x_max,y_max]
:inside_only: True if the objects returned are those that lie within the bbo... | GPy/plotting/matplot_dep/maps.py | def bbox_match(sf,bbox,inside_only=True):
"""
Return the geometry and attributes of a shapefile that lie within (or intersect) a bounding box
:param sf: shapefile
:type sf: shapefile object
:param bbox: bounding box
:type bbox: list of floats [x_min,y_min,x_max,y_max]
:inside_only: True if ... | def bbox_match(sf,bbox,inside_only=True):
"""
Return the geometry and attributes of a shapefile that lie within (or intersect) a bounding box
:param sf: shapefile
:type sf: shapefile object
:param bbox: bounding box
:type bbox: list of floats [x_min,y_min,x_max,y_max]
:inside_only: True if ... | [
"Return",
"the",
"geometry",
"and",
"attributes",
"of",
"a",
"shapefile",
"that",
"lie",
"within",
"(",
"or",
"intersect",
")",
"a",
"bounding",
"box"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/maps.py#L78-L110 | [
"def",
"bbox_match",
"(",
"sf",
",",
"bbox",
",",
"inside_only",
"=",
"True",
")",
":",
"A",
",",
"B",
",",
"C",
",",
"D",
"=",
"bbox",
"index",
"=",
"[",
"]",
"shape_records",
"=",
"[",
"]",
"for",
"rec",
"in",
"enumerate",
"(",
"sf",
".",
"sh... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_bbox | Plot the geometry of a shapefile within a bbox
:param sf: shapefile
:type sf: shapefile object
:param bbox: bounding box
:type bbox: list of floats [x_min,y_min,x_max,y_max]
:inside_only: True if the objects returned are those that lie within the bbox and False if the objects returned are any that ... | GPy/plotting/matplot_dep/maps.py | def plot_bbox(sf,bbox,inside_only=True):
"""
Plot the geometry of a shapefile within a bbox
:param sf: shapefile
:type sf: shapefile object
:param bbox: bounding box
:type bbox: list of floats [x_min,y_min,x_max,y_max]
:inside_only: True if the objects returned are those that lie within the... | def plot_bbox(sf,bbox,inside_only=True):
"""
Plot the geometry of a shapefile within a bbox
:param sf: shapefile
:type sf: shapefile object
:param bbox: bounding box
:type bbox: list of floats [x_min,y_min,x_max,y_max]
:inside_only: True if the objects returned are those that lie within the... | [
"Plot",
"the",
"geometry",
"of",
"a",
"shapefile",
"within",
"a",
"bbox"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/maps.py#L113-L126 | [
"def",
"plot_bbox",
"(",
"sf",
",",
"bbox",
",",
"inside_only",
"=",
"True",
")",
":",
"index",
",",
"shape_records",
"=",
"bbox_match",
"(",
"sf",
",",
"bbox",
",",
"inside_only",
")",
"A",
",",
"B",
",",
"C",
",",
"D",
"=",
"bbox",
"plot",
"(",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_string_match | Plot the geometry of a shapefile whose fields match a regular expression given
:param sf: shapefile
:type sf: shapefile object
:regex: regular expression to match
:type regex: string
:field: field number to be matched with the regex
:type field: integer | GPy/plotting/matplot_dep/maps.py | def plot_string_match(sf,regex,field,**kwargs):
"""
Plot the geometry of a shapefile whose fields match a regular expression given
:param sf: shapefile
:type sf: shapefile object
:regex: regular expression to match
:type regex: string
:field: field number to be matched with the regex
:t... | def plot_string_match(sf,regex,field,**kwargs):
"""
Plot the geometry of a shapefile whose fields match a regular expression given
:param sf: shapefile
:type sf: shapefile object
:regex: regular expression to match
:type regex: string
:field: field number to be matched with the regex
:t... | [
"Plot",
"the",
"geometry",
"of",
"a",
"shapefile",
"whose",
"fields",
"match",
"a",
"regular",
"expression",
"given"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/maps.py#L128-L140 | [
"def",
"plot_string_match",
"(",
"sf",
",",
"regex",
",",
"field",
",",
"*",
"*",
"kwargs",
")",
":",
"index",
",",
"shape_records",
"=",
"string_match",
"(",
"sf",
",",
"regex",
",",
"field",
")",
"plot",
"(",
"shape_records",
",",
"*",
"*",
"kwargs",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | apply_bbox | Use bbox as xlim and ylim in ax | GPy/plotting/matplot_dep/maps.py | def apply_bbox(sf,ax):
"""
Use bbox as xlim and ylim in ax
"""
limits = sf.bbox
xlim = limits[0],limits[2]
ylim = limits[1],limits[3]
ax.set_xlim(xlim)
ax.set_ylim(ylim) | def apply_bbox(sf,ax):
"""
Use bbox as xlim and ylim in ax
"""
limits = sf.bbox
xlim = limits[0],limits[2]
ylim = limits[1],limits[3]
ax.set_xlim(xlim)
ax.set_ylim(ylim) | [
"Use",
"bbox",
"as",
"xlim",
"and",
"ylim",
"in",
"ax"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/maps.py#L171-L179 | [
"def",
"apply_bbox",
"(",
"sf",
",",
"ax",
")",
":",
"limits",
"=",
"sf",
".",
"bbox",
"xlim",
"=",
"limits",
"[",
"0",
"]",
",",
"limits",
"[",
"2",
"]",
"ylim",
"=",
"limits",
"[",
"1",
"]",
",",
"limits",
"[",
"3",
"]",
"ax",
".",
"set_xli... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | WarpedGP.parameters_changed | Notice that we update the warping function gradients here. | GPy/models/warped_gp.py | def parameters_changed(self):
"""
Notice that we update the warping function gradients here.
"""
self.Y_normalized[:] = self.transform_data()
super(WarpedGP, self).parameters_changed()
Kiy = self.posterior.woodbury_vector.flatten()
self.warping_function.update_gra... | def parameters_changed(self):
"""
Notice that we update the warping function gradients here.
"""
self.Y_normalized[:] = self.transform_data()
super(WarpedGP, self).parameters_changed()
Kiy = self.posterior.woodbury_vector.flatten()
self.warping_function.update_gra... | [
"Notice",
"that",
"we",
"update",
"the",
"warping",
"function",
"gradients",
"here",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/warped_gp.py#L38-L45 | [
"def",
"parameters_changed",
"(",
"self",
")",
":",
"self",
".",
"Y_normalized",
"[",
":",
"]",
"=",
"self",
".",
"transform_data",
"(",
")",
"super",
"(",
"WarpedGP",
",",
"self",
")",
".",
"parameters_changed",
"(",
")",
"Kiy",
"=",
"self",
".",
"pos... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | WarpedGP.log_likelihood | Notice we add the jacobian of the warping function here. | GPy/models/warped_gp.py | def log_likelihood(self):
"""
Notice we add the jacobian of the warping function here.
"""
ll = GP.log_likelihood(self)
jacobian = self.warping_function.fgrad_y(self.Y_untransformed)
return ll + np.log(jacobian).sum() | def log_likelihood(self):
"""
Notice we add the jacobian of the warping function here.
"""
ll = GP.log_likelihood(self)
jacobian = self.warping_function.fgrad_y(self.Y_untransformed)
return ll + np.log(jacobian).sum() | [
"Notice",
"we",
"add",
"the",
"jacobian",
"of",
"the",
"warping",
"function",
"here",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/warped_gp.py#L51-L57 | [
"def",
"log_likelihood",
"(",
"self",
")",
":",
"ll",
"=",
"GP",
".",
"log_likelihood",
"(",
"self",
")",
"jacobian",
"=",
"self",
".",
"warping_function",
".",
"fgrad_y",
"(",
"self",
".",
"Y_untransformed",
")",
"return",
"ll",
"+",
"np",
".",
"log",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | WarpedGP._get_warped_mean | Calculate the warped mean by using Gauss-Hermite quadrature. | GPy/models/warped_gp.py | def _get_warped_mean(self, mean, std, pred_init=None, deg_gauss_hermite=20):
"""
Calculate the warped mean by using Gauss-Hermite quadrature.
"""
gh_samples, gh_weights = np.polynomial.hermite.hermgauss(deg_gauss_hermite)
gh_samples = gh_samples[:, None]
gh_weights = gh_w... | def _get_warped_mean(self, mean, std, pred_init=None, deg_gauss_hermite=20):
"""
Calculate the warped mean by using Gauss-Hermite quadrature.
"""
gh_samples, gh_weights = np.polynomial.hermite.hermgauss(deg_gauss_hermite)
gh_samples = gh_samples[:, None]
gh_weights = gh_w... | [
"Calculate",
"the",
"warped",
"mean",
"by",
"using",
"Gauss",
"-",
"Hermite",
"quadrature",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/warped_gp.py#L67-L74 | [
"def",
"_get_warped_mean",
"(",
"self",
",",
"mean",
",",
"std",
",",
"pred_init",
"=",
"None",
",",
"deg_gauss_hermite",
"=",
"20",
")",
":",
"gh_samples",
",",
"gh_weights",
"=",
"np",
".",
"polynomial",
".",
"hermite",
".",
"hermgauss",
"(",
"deg_gauss_... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | WarpedGP._get_warped_variance | Calculate the warped variance by using Gauss-Hermite quadrature. | GPy/models/warped_gp.py | def _get_warped_variance(self, mean, std, pred_init=None, deg_gauss_hermite=20):
"""
Calculate the warped variance by using Gauss-Hermite quadrature.
"""
gh_samples, gh_weights = np.polynomial.hermite.hermgauss(deg_gauss_hermite)
gh_samples = gh_samples[:, None]
gh_weight... | def _get_warped_variance(self, mean, std, pred_init=None, deg_gauss_hermite=20):
"""
Calculate the warped variance by using Gauss-Hermite quadrature.
"""
gh_samples, gh_weights = np.polynomial.hermite.hermgauss(deg_gauss_hermite)
gh_samples = gh_samples[:, None]
gh_weight... | [
"Calculate",
"the",
"warped",
"variance",
"by",
"using",
"Gauss",
"-",
"Hermite",
"quadrature",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/warped_gp.py#L76-L87 | [
"def",
"_get_warped_variance",
"(",
"self",
",",
"mean",
",",
"std",
",",
"pred_init",
"=",
"None",
",",
"deg_gauss_hermite",
"=",
"20",
")",
":",
"gh_samples",
",",
"gh_weights",
"=",
"np",
".",
"polynomial",
".",
"hermite",
".",
"hermgauss",
"(",
"deg_ga... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | WarpedGP.predict | Prediction results depend on:
- The value of the self.predict_in_warped_space flag
- The median flag passed as argument
The likelihood keyword is never used, it is just to follow the plotting API. | GPy/models/warped_gp.py | def predict(self, Xnew, kern=None, pred_init=None, Y_metadata=None,
median=False, deg_gauss_hermite=20, likelihood=None):
"""
Prediction results depend on:
- The value of the self.predict_in_warped_space flag
- The median flag passed as argument
The likelihood key... | def predict(self, Xnew, kern=None, pred_init=None, Y_metadata=None,
median=False, deg_gauss_hermite=20, likelihood=None):
"""
Prediction results depend on:
- The value of the self.predict_in_warped_space flag
- The median flag passed as argument
The likelihood key... | [
"Prediction",
"results",
"depend",
"on",
":",
"-",
"The",
"value",
"of",
"the",
"self",
".",
"predict_in_warped_space",
"flag",
"-",
"The",
"median",
"flag",
"passed",
"as",
"argument",
"The",
"likelihood",
"keyword",
"is",
"never",
"used",
"it",
"is",
"just... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/warped_gp.py#L89-L116 | [
"def",
"predict",
"(",
"self",
",",
"Xnew",
",",
"kern",
"=",
"None",
",",
"pred_init",
"=",
"None",
",",
"Y_metadata",
"=",
"None",
",",
"median",
"=",
"False",
",",
"deg_gauss_hermite",
"=",
"20",
",",
"likelihood",
"=",
"None",
")",
":",
"#mu, var =... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | WarpedGP.predict_quantiles | Get the predictive quantiles around the prediction at X
:param X: The points at which to make a prediction
:type X: np.ndarray (Xnew x self.input_dim)
:param quantiles: tuple of quantiles, default is (2.5, 97.5) which is the 95% interval
:type quantiles: tuple
:returns: list of ... | GPy/models/warped_gp.py | def predict_quantiles(self, X, quantiles=(2.5, 97.5), Y_metadata=None, likelihood=None, kern=None):
"""
Get the predictive quantiles around the prediction at X
:param X: The points at which to make a prediction
:type X: np.ndarray (Xnew x self.input_dim)
:param quantiles: tuple ... | def predict_quantiles(self, X, quantiles=(2.5, 97.5), Y_metadata=None, likelihood=None, kern=None):
"""
Get the predictive quantiles around the prediction at X
:param X: The points at which to make a prediction
:type X: np.ndarray (Xnew x self.input_dim)
:param quantiles: tuple ... | [
"Get",
"the",
"predictive",
"quantiles",
"around",
"the",
"prediction",
"at",
"X"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/warped_gp.py#L118-L132 | [
"def",
"predict_quantiles",
"(",
"self",
",",
"X",
",",
"quantiles",
"=",
"(",
"2.5",
",",
"97.5",
")",
",",
"Y_metadata",
"=",
"None",
",",
"likelihood",
"=",
"None",
",",
"kern",
"=",
"None",
")",
":",
"qs",
"=",
"super",
"(",
"WarpedGP",
",",
"s... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | WarpedGP.log_predictive_density | Calculation of the log predictive density. Notice we add
the jacobian of the warping function here.
.. math:
p(y_{*}|D) = p(y_{*}|f_{*})p(f_{*}|\mu_{*}\\sigma^{2}_{*})
:param x_test: test locations (x_{*})
:type x_test: (Nx1) array
:param y_test: test observations (... | GPy/models/warped_gp.py | def log_predictive_density(self, x_test, y_test, Y_metadata=None):
"""
Calculation of the log predictive density. Notice we add
the jacobian of the warping function here.
.. math:
p(y_{*}|D) = p(y_{*}|f_{*})p(f_{*}|\mu_{*}\\sigma^{2}_{*})
:param x_test: test locatio... | def log_predictive_density(self, x_test, y_test, Y_metadata=None):
"""
Calculation of the log predictive density. Notice we add
the jacobian of the warping function here.
.. math:
p(y_{*}|D) = p(y_{*}|f_{*})p(f_{*}|\mu_{*}\\sigma^{2}_{*})
:param x_test: test locatio... | [
"Calculation",
"of",
"the",
"log",
"predictive",
"density",
".",
"Notice",
"we",
"add",
"the",
"jacobian",
"of",
"the",
"warping",
"function",
"here",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/warped_gp.py#L143-L160 | [
"def",
"log_predictive_density",
"(",
"self",
",",
"x_test",
",",
"y_test",
",",
"Y_metadata",
"=",
"None",
")",
":",
"mu_star",
",",
"var_star",
"=",
"self",
".",
"_raw_predict",
"(",
"x_test",
")",
"fy",
"=",
"self",
".",
"warping_function",
".",
"f",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | sde_Matern32.sde_update_gradient_full | Update gradient in the order in which parameters are represented in the
kernel | GPy/kern/src/sde_matern.py | def sde_update_gradient_full(self, gradients):
"""
Update gradient in the order in which parameters are represented in the
kernel
"""
self.variance.gradient = gradients[0]
self.lengthscale.gradient = gradients[1] | def sde_update_gradient_full(self, gradients):
"""
Update gradient in the order in which parameters are represented in the
kernel
"""
self.variance.gradient = gradients[0]
self.lengthscale.gradient = gradients[1] | [
"Update",
"gradient",
"in",
"the",
"order",
"in",
"which",
"parameters",
"are",
"represented",
"in",
"the",
"kernel"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/sde_matern.py#L25-L32 | [
"def",
"sde_update_gradient_full",
"(",
"self",
",",
"gradients",
")",
":",
"self",
".",
"variance",
".",
"gradient",
"=",
"gradients",
"[",
"0",
"]",
"self",
".",
"lengthscale",
".",
"gradient",
"=",
"gradients",
"[",
"1",
"]"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | sde_Matern52.sde | Return the state space representation of the covariance. | GPy/kern/src/sde_matern.py | def sde(self):
"""
Return the state space representation of the covariance.
"""
variance = float(self.variance.values)
lengthscale = float(self.lengthscale.values)
lamda = np.sqrt(5.0)/lengthscale
kappa = 5.0/3.0*variance/lengthscale**2
... | def sde(self):
"""
Return the state space representation of the covariance.
"""
variance = float(self.variance.values)
lengthscale = float(self.lengthscale.values)
lamda = np.sqrt(5.0)/lengthscale
kappa = 5.0/3.0*variance/lengthscale**2
... | [
"Return",
"the",
"state",
"space",
"representation",
"of",
"the",
"covariance",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/sde_matern.py#L94-L137 | [
"def",
"sde",
"(",
"self",
")",
":",
"variance",
"=",
"float",
"(",
"self",
".",
"variance",
".",
"values",
")",
"lengthscale",
"=",
"float",
"(",
"self",
".",
"lengthscale",
".",
"values",
")",
"lamda",
"=",
"np",
".",
"sqrt",
"(",
"5.0",
")",
"/"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | HMC.sample | Sample the (unfixed) model parameters.
:param num_samples: the number of samples to draw (1000 by default)
:type num_samples: int
:param hmc_iters: the number of leap-frog iterations (20 by default)
:type hmc_iters: int
:return: the list of parameters samples with the si... | GPy/inference/mcmc/hmc.py | def sample(self, num_samples=1000, hmc_iters=20):
"""
Sample the (unfixed) model parameters.
:param num_samples: the number of samples to draw (1000 by default)
:type num_samples: int
:param hmc_iters: the number of leap-frog iterations (20 by default)
:type hmc_... | def sample(self, num_samples=1000, hmc_iters=20):
"""
Sample the (unfixed) model parameters.
:param num_samples: the number of samples to draw (1000 by default)
:type num_samples: int
:param hmc_iters: the number of leap-frog iterations (20 by default)
:type hmc_... | [
"Sample",
"the",
"(",
"unfixed",
")",
"model",
"parameters",
".",
":",
"param",
"num_samples",
":",
"the",
"number",
"of",
"samples",
"to",
"draw",
"(",
"1000",
"by",
"default",
")",
":",
"type",
"num_samples",
":",
"int",
":",
"param",
"hmc_iters",
":",... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/mcmc/hmc.py#L30-L59 | [
"def",
"sample",
"(",
"self",
",",
"num_samples",
"=",
"1000",
",",
"hmc_iters",
"=",
"20",
")",
":",
"params",
"=",
"np",
".",
"empty",
"(",
"(",
"num_samples",
",",
"self",
".",
"p",
".",
"size",
")",
")",
"for",
"i",
"in",
"range",
"(",
"num_s... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | GpGrid.parameters_changed | Method that is called upon any changes to :class:`~GPy.core.parameterization.param.Param` variables within the model.
In particular in the GP class this method reperforms inference, recalculating the posterior and log marginal likelihood and gradients of the model
.. warning::
This method i... | GPy/core/gp_grid.py | def parameters_changed(self):
"""
Method that is called upon any changes to :class:`~GPy.core.parameterization.param.Param` variables within the model.
In particular in the GP class this method reperforms inference, recalculating the posterior and log marginal likelihood and gradients of the mod... | def parameters_changed(self):
"""
Method that is called upon any changes to :class:`~GPy.core.parameterization.param.Param` variables within the model.
In particular in the GP class this method reperforms inference, recalculating the posterior and log marginal likelihood and gradients of the mod... | [
"Method",
"that",
"is",
"called",
"upon",
"any",
"changes",
"to",
":",
"class",
":",
"~GPy",
".",
"core",
".",
"parameterization",
".",
"param",
".",
"Param",
"variables",
"within",
"the",
"model",
".",
"In",
"particular",
"in",
"the",
"GP",
"class",
"th... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/gp_grid.py#L52-L63 | [
"def",
"parameters_changed",
"(",
"self",
")",
":",
"self",
".",
"posterior",
",",
"self",
".",
"_log_marginal_likelihood",
",",
"self",
".",
"grad_dict",
"=",
"self",
".",
"inference_method",
".",
"inference",
"(",
"self",
".",
"kern",
",",
"self",
".",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | GpGrid._raw_predict | Make a prediction for the latent function values | GPy/core/gp_grid.py | def _raw_predict(self, Xnew, full_cov=False, kern=None):
"""
Make a prediction for the latent function values
"""
if kern is None:
kern = self.kern
# compute mean predictions
Kmn = kern.K(Xnew, self.X)
alpha_kron = self.posterior.alpha
mu = np... | def _raw_predict(self, Xnew, full_cov=False, kern=None):
"""
Make a prediction for the latent function values
"""
if kern is None:
kern = self.kern
# compute mean predictions
Kmn = kern.K(Xnew, self.X)
alpha_kron = self.posterior.alpha
mu = np... | [
"Make",
"a",
"prediction",
"for",
"the",
"latent",
"function",
"values"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/gp_grid.py#L87-L116 | [
"def",
"_raw_predict",
"(",
"self",
",",
"Xnew",
",",
"full_cov",
"=",
"False",
",",
"kern",
"=",
"None",
")",
":",
"if",
"kern",
"is",
"None",
":",
"kern",
"=",
"self",
".",
"kern",
"# compute mean predictions",
"Kmn",
"=",
"kern",
".",
"K",
"(",
"X... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.