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 | sde_Linear.sde | Return the state space representation of the covariance. | GPy/kern/src/sde_linear.py | def sde(self):
"""
Return the state space representation of the covariance.
"""
variance = float(self.variances.values) # this is initial variancve in Bayesian linear regression
t0 = float(self.t0)
F = np.array( ((0,1.0),(0,0) ))
L = np.array... | def sde(self):
"""
Return the state space representation of the covariance.
"""
variance = float(self.variances.values) # this is initial variancve in Bayesian linear regression
t0 = float(self.t0)
F = np.array( ((0,1.0),(0,0) ))
L = np.array... | [
"Return",
"the",
"state",
"space",
"representation",
"of",
"the",
"covariance",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/sde_linear.py#L44-L66 | [
"def",
"sde",
"(",
"self",
")",
":",
"variance",
"=",
"float",
"(",
"self",
".",
"variances",
".",
"values",
")",
"# this is initial variancve in Bayesian linear regression",
"t0",
"=",
"float",
"(",
"self",
".",
"t0",
")",
"F",
"=",
"np",
".",
"array",
"(... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | ODE_st.K | Compute the covariance matrix between X and X2. | GPy/kern/src/ODE_st.py | def K(self, X, X2=None):
# model : -a d^2y/dx^2 + b dy/dt + c * y = U
# kernel Kyy rbf spatiol temporal
# vyt Y temporal variance vyx Y spatiol variance lyt Y temporal lengthscale lyx Y spatiol lengthscale
# kernel Kuu doper( doper(Kyy))
# a b c lyt lyx vyx*vyt
"... | def K(self, X, X2=None):
# model : -a d^2y/dx^2 + b dy/dt + c * y = U
# kernel Kyy rbf spatiol temporal
# vyt Y temporal variance vyx Y spatiol variance lyt Y temporal lengthscale lyx Y spatiol lengthscale
# kernel Kuu doper( doper(Kyy))
# a b c lyt lyx vyx*vyt
"... | [
"Compute",
"the",
"covariance",
"matrix",
"between",
"X",
"and",
"X2",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/ODE_st.py#L44-L104 | [
"def",
"K",
"(",
"self",
",",
"X",
",",
"X2",
"=",
"None",
")",
":",
"# model : -a d^2y/dx^2 + b dy/dt + c * y = U",
"# kernel Kyy rbf spatiol temporal",
"# vyt Y temporal variance vyx Y spatiol variance lyt Y temporal lengthscale lyx Y spatiol lengthscale",
"# kernel Kuu doper... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | ODE_st.Kdiag | Compute the diagonal of the covariance matrix associated to X. | GPy/kern/src/ODE_st.py | def Kdiag(self, X):
"""Compute the diagonal of the covariance matrix associated to X."""
vyt = self.variance_Yt
vyx = self.variance_Yx
lyt = 1./(2*self.lengthscale_Yt)
lyx = 1./(2*self.lengthscale_Yx)
a = self.a
b = self.b
c = self.c
## dk^2/dtd... | def Kdiag(self, X):
"""Compute the diagonal of the covariance matrix associated to X."""
vyt = self.variance_Yt
vyx = self.variance_Yx
lyt = 1./(2*self.lengthscale_Yt)
lyx = 1./(2*self.lengthscale_Yx)
a = self.a
b = self.b
c = self.c
## dk^2/dtd... | [
"Compute",
"the",
"diagonal",
"of",
"the",
"covariance",
"matrix",
"associated",
"to",
"X",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/ODE_st.py#L106-L140 | [
"def",
"Kdiag",
"(",
"self",
",",
"X",
")",
":",
"vyt",
"=",
"self",
".",
"variance_Yt",
"vyx",
"=",
"self",
".",
"variance_Yx",
"lyt",
"=",
"1.",
"/",
"(",
"2",
"*",
"self",
".",
"lengthscale_Yt",
")",
"lyx",
"=",
"1.",
"/",
"(",
"2",
"*",
"se... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | ODE_st.update_gradients_full | derivative of the covariance matrix with respect to the parameters. | GPy/kern/src/ODE_st.py | def update_gradients_full(self, dL_dK, X, X2=None):
#def dK_dtheta(self, dL_dK, X, X2, target):
"""derivative of the covariance matrix with respect to the parameters."""
X,slices = X[:,:-1],index_to_slices(X[:,-1])
if X2 is None:
X2,slices2 = X,slices
K = np.zeros((X.... | def update_gradients_full(self, dL_dK, X, X2=None):
#def dK_dtheta(self, dL_dK, X, X2, target):
"""derivative of the covariance matrix with respect to the parameters."""
X,slices = X[:,:-1],index_to_slices(X[:,-1])
if X2 is None:
X2,slices2 = X,slices
K = np.zeros((X.... | [
"derivative",
"of",
"the",
"covariance",
"matrix",
"with",
"respect",
"to",
"the",
"parameters",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/ODE_st.py#L143-L266 | [
"def",
"update_gradients_full",
"(",
"self",
",",
"dL_dK",
",",
"X",
",",
"X2",
"=",
"None",
")",
":",
"#def dK_dtheta(self, dL_dK, X, X2, target):",
"X",
",",
"slices",
"=",
"X",
"[",
":",
",",
":",
"-",
"1",
"]",
",",
"index_to_slices",
"(",
"X",
"[",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | SSGPLVM.get_X_gradients | Get the gradients of the posterior distribution of X in its specific form. | GPy/models/ss_gplvm.py | def get_X_gradients(self, X):
"""Get the gradients of the posterior distribution of X in its specific form."""
return X.mean.gradient, X.variance.gradient, X.binary_prob.gradient | def get_X_gradients(self, X):
"""Get the gradients of the posterior distribution of X in its specific form."""
return X.mean.gradient, X.variance.gradient, X.binary_prob.gradient | [
"Get",
"the",
"gradients",
"of",
"the",
"posterior",
"distribution",
"of",
"X",
"in",
"its",
"specific",
"form",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/ss_gplvm.py#L249-L251 | [
"def",
"get_X_gradients",
"(",
"self",
",",
"X",
")",
":",
"return",
"X",
".",
"mean",
".",
"gradient",
",",
"X",
".",
"variance",
".",
"gradient",
",",
"X",
".",
"binary_prob",
".",
"gradient"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | SSGPLVM.sample_W | Sample the loading matrix if the kernel is linear. | GPy/models/ss_gplvm.py | def sample_W(self, nSamples, raw_samples=False):
"""
Sample the loading matrix if the kernel is linear.
"""
assert isinstance(self.kern, kern.Linear)
from ..util.linalg import pdinv
N, D = self.Y.shape
Q = self.X.shape[1]
noise_var = self.likelihood.varian... | def sample_W(self, nSamples, raw_samples=False):
"""
Sample the loading matrix if the kernel is linear.
"""
assert isinstance(self.kern, kern.Linear)
from ..util.linalg import pdinv
N, D = self.Y.shape
Q = self.X.shape[1]
noise_var = self.likelihood.varian... | [
"Sample",
"the",
"loading",
"matrix",
"if",
"the",
"kernel",
"is",
"linear",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/ss_gplvm.py#L278-L305 | [
"def",
"sample_W",
"(",
"self",
",",
"nSamples",
",",
"raw_samples",
"=",
"False",
")",
":",
"assert",
"isinstance",
"(",
"self",
".",
"kern",
",",
"kern",
".",
"Linear",
")",
"from",
".",
".",
"util",
".",
"linalg",
"import",
"pdinv",
"N",
",",
"D",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | posteriorParams.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/inference/latent_function_inference/expectation_propagation.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
"""
#TODO: Implemen... | 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
"""
#TODO: Implemen... | [
"Convert",
"the",
"object",
"into",
"a",
"json",
"serializable",
"dictionary",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/expectation_propagation.py#L107-L120 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"#TODO: Implement a more memory efficient variant",
"if",
"self",
".",
"L",
"is",
"None",
":",
"return",
"{",
"\"mu\"",
":",
"self",
".",
"mu",
".",
"tolist",
"(",
")",
",",
"\"Sigma\"",
":",
"self",
".",
"Sigma",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | EP.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/inference/latent_function_inference/expectation_propagation.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/inference/latent_function_inference/expectation_propagation.py#L404-L424 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"input_dict",
"=",
"super",
"(",
"EP",
",",
"self",
")",
".",
"_save_to_input_dict",
"(",
")",
"input_dict",
"[",
"\"class\"",
"]",
"=",
"\"GPy.inference.latent_function_inference.expectation_propagation.EP\"",
"if",
"self",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | EPDTC.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/inference/latent_function_inference/expectation_propagation.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/inference/latent_function_inference/expectation_propagation.py#L587-L606 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"input_dict",
"=",
"super",
"(",
"EPDTC",
",",
"self",
")",
".",
"_save_to_input_dict",
"(",
")",
"input_dict",
"[",
"\"class\"",
"]",
"=",
"\"GPy.inference.latent_function_inference.expectation_propagation.EPDTC\"",
"if",
"s... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | NormalPosterior.KL | Compute the KL divergence to another NormalPosterior Object. This only holds, if the two NormalPosterior objects have the same shape, as we do computational tricks for the multivariate normal KL divergence. | GPy/core/parameterization/variational.py | def KL(self, other):
"""Compute the KL divergence to another NormalPosterior Object. This only holds, if the two NormalPosterior objects have the same shape, as we do computational tricks for the multivariate normal KL divergence.
"""
return .5*(
np.sum(self.variance/other.variance)
... | def KL(self, other):
"""Compute the KL divergence to another NormalPosterior Object. This only holds, if the two NormalPosterior objects have the same shape, as we do computational tricks for the multivariate normal KL divergence.
"""
return .5*(
np.sum(self.variance/other.variance)
... | [
"Compute",
"the",
"KL",
"divergence",
"to",
"another",
"NormalPosterior",
"Object",
".",
"This",
"only",
"holds",
"if",
"the",
"two",
"NormalPosterior",
"objects",
"have",
"the",
"same",
"shape",
"as",
"we",
"do",
"computational",
"tricks",
"for",
"the",
"mult... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/parameterization/variational.py#L165-L173 | [
"def",
"KL",
"(",
"self",
",",
"other",
")",
":",
"return",
".5",
"*",
"(",
"np",
".",
"sum",
"(",
"self",
".",
"variance",
"/",
"other",
".",
"variance",
")",
"+",
"(",
"(",
"other",
".",
"mean",
"-",
"self",
".",
"mean",
")",
"**",
"2",
"/"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | SpikeAndSlabPosterior.plot | Plot latent space X in 1D:
See GPy.plotting.matplot_dep.variational_plots | GPy/core/parameterization/variational.py | def plot(self, *args, **kwargs):
"""
Plot latent space X in 1D:
See GPy.plotting.matplot_dep.variational_plots
"""
import sys
assert "matplotlib" in sys.modules, "matplotlib package has not been imported."
from ...plotting.matplot_dep import variational_plots
... | def plot(self, *args, **kwargs):
"""
Plot latent space X in 1D:
See GPy.plotting.matplot_dep.variational_plots
"""
import sys
assert "matplotlib" in sys.modules, "matplotlib package has not been imported."
from ...plotting.matplot_dep import variational_plots
... | [
"Plot",
"latent",
"space",
"X",
"in",
"1D",
":"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/parameterization/variational.py#L232-L241 | [
"def",
"plot",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"sys",
"assert",
"\"matplotlib\"",
"in",
"sys",
".",
"modules",
",",
"\"matplotlib package has not been imported.\"",
"from",
".",
".",
".",
"plotting",
".",
"matplot_... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | chain_2 | Generic chaining function for second derivative
.. math::
\\frac{d^{2}(f . g)}{dx^{2}} = \\frac{d^{2}f}{dg^{2}}(\\frac{dg}{dx})^{2} + \\frac{df}{dg}\\frac{d^{2}g}{dx^{2}} | GPy/util/misc.py | def chain_2(d2f_dg2, dg_dx, df_dg, d2g_dx2):
"""
Generic chaining function for second derivative
.. math::
\\frac{d^{2}(f . g)}{dx^{2}} = \\frac{d^{2}f}{dg^{2}}(\\frac{dg}{dx})^{2} + \\frac{df}{dg}\\frac{d^{2}g}{dx^{2}}
"""
if np.all(dg_dx==1.) and np.all(d2g_dx2 == 0):
return d2f_d... | def chain_2(d2f_dg2, dg_dx, df_dg, d2g_dx2):
"""
Generic chaining function for second derivative
.. math::
\\frac{d^{2}(f . g)}{dx^{2}} = \\frac{d^{2}f}{dg^{2}}(\\frac{dg}{dx})^{2} + \\frac{df}{dg}\\frac{d^{2}g}{dx^{2}}
"""
if np.all(dg_dx==1.) and np.all(d2g_dx2 == 0):
return d2f_d... | [
"Generic",
"chaining",
"function",
"for",
"second",
"derivative"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/misc.py#L47-L58 | [
"def",
"chain_2",
"(",
"d2f_dg2",
",",
"dg_dx",
",",
"df_dg",
",",
"d2g_dx2",
")",
":",
"if",
"np",
".",
"all",
"(",
"dg_dx",
"==",
"1.",
")",
"and",
"np",
".",
"all",
"(",
"d2g_dx2",
"==",
"0",
")",
":",
"return",
"d2f_dg2",
"dg_dx_2",
"=",
"np"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | chain_3 | Generic chaining function for third derivative
.. math::
\\frac{d^{3}(f . g)}{dx^{3}} = \\frac{d^{3}f}{dg^{3}}(\\frac{dg}{dx})^{3} + 3\\frac{d^{2}f}{dg^{2}}\\frac{dg}{dx}\\frac{d^{2}g}{dx^{2}} + \\frac{df}{dg}\\frac{d^{3}g}{dx^{3}} | GPy/util/misc.py | def chain_3(d3f_dg3, dg_dx, d2f_dg2, d2g_dx2, df_dg, d3g_dx3):
"""
Generic chaining function for third derivative
.. math::
\\frac{d^{3}(f . g)}{dx^{3}} = \\frac{d^{3}f}{dg^{3}}(\\frac{dg}{dx})^{3} + 3\\frac{d^{2}f}{dg^{2}}\\frac{dg}{dx}\\frac{d^{2}g}{dx^{2}} + \\frac{df}{dg}\\frac{d^{3}g}{dx^{3}}
... | def chain_3(d3f_dg3, dg_dx, d2f_dg2, d2g_dx2, df_dg, d3g_dx3):
"""
Generic chaining function for third derivative
.. math::
\\frac{d^{3}(f . g)}{dx^{3}} = \\frac{d^{3}f}{dg^{3}}(\\frac{dg}{dx})^{3} + 3\\frac{d^{2}f}{dg^{2}}\\frac{dg}{dx}\\frac{d^{2}g}{dx^{2}} + \\frac{df}{dg}\\frac{d^{3}g}{dx^{3}}
... | [
"Generic",
"chaining",
"function",
"for",
"third",
"derivative"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/misc.py#L60-L70 | [
"def",
"chain_3",
"(",
"d3f_dg3",
",",
"dg_dx",
",",
"d2f_dg2",
",",
"d2g_dx2",
",",
"df_dg",
",",
"d3g_dx3",
")",
":",
"if",
"np",
".",
"all",
"(",
"dg_dx",
"==",
"1.",
")",
"and",
"np",
".",
"all",
"(",
"d2g_dx2",
"==",
"0",
")",
"and",
"np",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | linear_grid | Creates a D-dimensional grid of n linearly spaced points
:param D: dimension of the grid
:param n: number of points
:param min_max: (min, max) list | GPy/util/misc.py | def linear_grid(D, n = 100, min_max = (-100, 100)):
"""
Creates a D-dimensional grid of n linearly spaced points
:param D: dimension of the grid
:param n: number of points
:param min_max: (min, max) list
"""
g = np.linspace(min_max[0], min_max[1], n)
G = np.ones((n, D))
return G*... | def linear_grid(D, n = 100, min_max = (-100, 100)):
"""
Creates a D-dimensional grid of n linearly spaced points
:param D: dimension of the grid
:param n: number of points
:param min_max: (min, max) list
"""
g = np.linspace(min_max[0], min_max[1], n)
G = np.ones((n, D))
return G*... | [
"Creates",
"a",
"D",
"-",
"dimensional",
"grid",
"of",
"n",
"linearly",
"spaced",
"points"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/misc.py#L81-L94 | [
"def",
"linear_grid",
"(",
"D",
",",
"n",
"=",
"100",
",",
"min_max",
"=",
"(",
"-",
"100",
",",
"100",
")",
")",
":",
"g",
"=",
"np",
".",
"linspace",
"(",
"min_max",
"[",
"0",
"]",
",",
"min_max",
"[",
"1",
"]",
",",
"n",
")",
"G",
"=",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | kmm_init | This is the same initialization algorithm that is used
in Kmeans++. It's quite simple and very useful to initialize
the locations of the inducing points in sparse GPs.
:param X: data
:param m: number of inducing points | GPy/util/misc.py | def kmm_init(X, m = 10):
"""
This is the same initialization algorithm that is used
in Kmeans++. It's quite simple and very useful to initialize
the locations of the inducing points in sparse GPs.
:param X: data
:param m: number of inducing points
"""
# compute the distances
XXT =... | def kmm_init(X, m = 10):
"""
This is the same initialization algorithm that is used
in Kmeans++. It's quite simple and very useful to initialize
the locations of the inducing points in sparse GPs.
:param X: data
:param m: number of inducing points
"""
# compute the distances
XXT =... | [
"This",
"is",
"the",
"same",
"initialization",
"algorithm",
"that",
"is",
"used",
"in",
"Kmeans",
"++",
".",
"It",
"s",
"quite",
"simple",
"and",
"very",
"useful",
"to",
"initialize",
"the",
"locations",
"of",
"the",
"inducing",
"points",
"in",
"sparse",
"... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/misc.py#L96-L122 | [
"def",
"kmm_init",
"(",
"X",
",",
"m",
"=",
"10",
")",
":",
"# compute the distances",
"XXT",
"=",
"np",
".",
"dot",
"(",
"X",
",",
"X",
".",
"T",
")",
"D",
"=",
"(",
"-",
"2.",
"*",
"XXT",
"+",
"np",
".",
"diag",
"(",
"XXT",
")",
"[",
":",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | param_to_array | Convert an arbitrary number of parameters to :class:ndarray class objects.
This is for converting parameter objects to numpy arrays, when using
scipy.weave.inline routine. In scipy.weave.blitz there is no automatic
array detection (even when the array inherits from :class:ndarray) | GPy/util/misc.py | def param_to_array(*param):
"""
Convert an arbitrary number of parameters to :class:ndarray class objects.
This is for converting parameter objects to numpy arrays, when using
scipy.weave.inline routine. In scipy.weave.blitz there is no automatic
array detection (even when the array inherits from :... | def param_to_array(*param):
"""
Convert an arbitrary number of parameters to :class:ndarray class objects.
This is for converting parameter objects to numpy arrays, when using
scipy.weave.inline routine. In scipy.weave.blitz there is no automatic
array detection (even when the array inherits from :... | [
"Convert",
"an",
"arbitrary",
"number",
"of",
"parameters",
"to",
":",
"class",
":",
"ndarray",
"class",
"objects",
".",
"This",
"is",
"for",
"converting",
"parameter",
"objects",
"to",
"numpy",
"arrays",
"when",
"using",
"scipy",
".",
"weave",
".",
"inline"... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/misc.py#L125-L137 | [
"def",
"param_to_array",
"(",
"*",
"param",
")",
":",
"import",
"warnings",
"warnings",
".",
"warn",
"(",
"\"Please use param.values, as this function will be deprecated in the next release.\"",
",",
"DeprecationWarning",
")",
"assert",
"len",
"(",
"param",
")",
">",
"0... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | ODE_UYC.Kdiag | Compute the diagonal of the covariance matrix associated to X. | GPy/kern/src/ODE_UYC.py | def Kdiag(self, X):
"""Compute the diagonal of the covariance matrix associated to X."""
Kdiag = np.zeros(X.shape[0])
ly=1/self.lengthscale_Y
lu=np.sqrt(3)/self.lengthscale_U
Vu = self.variance_U
Vy=self.variance_Y
k1 = (2*lu+ly)/(lu+ly)**2
k2 = (ly-2*lu... | def Kdiag(self, X):
"""Compute the diagonal of the covariance matrix associated to X."""
Kdiag = np.zeros(X.shape[0])
ly=1/self.lengthscale_Y
lu=np.sqrt(3)/self.lengthscale_U
Vu = self.variance_U
Vy=self.variance_Y
k1 = (2*lu+ly)/(lu+ly)**2
k2 = (ly-2*lu... | [
"Compute",
"the",
"diagonal",
"of",
"the",
"covariance",
"matrix",
"associated",
"to",
"X",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/ODE_UYC.py#L96-L121 | [
"def",
"Kdiag",
"(",
"self",
",",
"X",
")",
":",
"Kdiag",
"=",
"np",
".",
"zeros",
"(",
"X",
".",
"shape",
"[",
"0",
"]",
")",
"ly",
"=",
"1",
"/",
"self",
".",
"lengthscale_Y",
"lu",
"=",
"np",
".",
"sqrt",
"(",
"3",
")",
"/",
"self",
".",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | ODE_UYC.update_gradients_full | derivative of the covariance matrix with respect to the parameters. | GPy/kern/src/ODE_UYC.py | def update_gradients_full(self, dL_dK, X, X2=None):
"""derivative of the covariance matrix with respect to the parameters."""
X,slices = X[:,:-1],index_to_slices(X[:,-1])
if X2 is None:
X2,slices2 = X,slices
else:
X2,slices2 = X2[:,:-1],index_to_slices(X2[:,-1])
... | def update_gradients_full(self, dL_dK, X, X2=None):
"""derivative of the covariance matrix with respect to the parameters."""
X,slices = X[:,:-1],index_to_slices(X[:,-1])
if X2 is None:
X2,slices2 = X,slices
else:
X2,slices2 = X2[:,:-1],index_to_slices(X2[:,-1])
... | [
"derivative",
"of",
"the",
"covariance",
"matrix",
"with",
"respect",
"to",
"the",
"parameters",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/ODE_UYC.py#L124-L289 | [
"def",
"update_gradients_full",
"(",
"self",
",",
"dL_dK",
",",
"X",
",",
"X2",
"=",
"None",
")",
":",
"X",
",",
"slices",
"=",
"X",
"[",
":",
",",
":",
"-",
"1",
"]",
",",
"index_to_slices",
"(",
"X",
"[",
":",
",",
"-",
"1",
"]",
")",
"if",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | SVGP.set_data | Set the data without calling parameters_changed to avoid wasted computation
If this is called by the stochastic_grad function this will immediately update the gradients | GPy/core/svgp.py | def set_data(self, X, Y):
"""
Set the data without calling parameters_changed to avoid wasted computation
If this is called by the stochastic_grad function this will immediately update the gradients
"""
assert X.shape[1]==self.Z.shape[1]
self.X, self.Y = X, Y | def set_data(self, X, Y):
"""
Set the data without calling parameters_changed to avoid wasted computation
If this is called by the stochastic_grad function this will immediately update the gradients
"""
assert X.shape[1]==self.Z.shape[1]
self.X, self.Y = X, Y | [
"Set",
"the",
"data",
"without",
"calling",
"parameters_changed",
"to",
"avoid",
"wasted",
"computation",
"If",
"this",
"is",
"called",
"by",
"the",
"stochastic_grad",
"function",
"this",
"will",
"immediately",
"update",
"the",
"gradients"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/svgp.py#L80-L86 | [
"def",
"set_data",
"(",
"self",
",",
"X",
",",
"Y",
")",
":",
"assert",
"X",
".",
"shape",
"[",
"1",
"]",
"==",
"self",
".",
"Z",
".",
"shape",
"[",
"1",
"]",
"self",
".",
"X",
",",
"self",
".",
"Y",
"=",
"X",
",",
"Y"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | SVGP.new_batch | Return a new batch of X and Y by taking a chunk of data from the complete X and Y | GPy/core/svgp.py | def new_batch(self):
"""
Return a new batch of X and Y by taking a chunk of data from the complete X and Y
"""
i = next(self.slicer)
return self.X_all[i], self.Y_all[i] | def new_batch(self):
"""
Return a new batch of X and Y by taking a chunk of data from the complete X and Y
"""
i = next(self.slicer)
return self.X_all[i], self.Y_all[i] | [
"Return",
"a",
"new",
"batch",
"of",
"X",
"and",
"Y",
"by",
"taking",
"a",
"chunk",
"of",
"data",
"from",
"the",
"complete",
"X",
"and",
"Y"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/svgp.py#L88-L93 | [
"def",
"new_batch",
"(",
"self",
")",
":",
"i",
"=",
"next",
"(",
"self",
".",
"slicer",
")",
"return",
"self",
".",
"X_all",
"[",
"i",
"]",
",",
"self",
".",
"Y_all",
"[",
"i",
"]"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | _Norm.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/util/normalizer.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/util/normalizer.py#L60-L78 | [
"def",
"from_dict",
"(",
"input_dict",
")",
":",
"import",
"copy",
"input_dict",
"=",
"copy",
".",
"deepcopy",
"(",
"input_dict",
")",
"normalizer_class",
"=",
"input_dict",
".",
"pop",
"(",
"'class'",
")",
"import",
"GPy",
"normalizer_class",
"=",
"eval",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Standardize.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/util/normalizer.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/util/normalizer.py#L110-L124 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"input_dict",
"=",
"super",
"(",
"Standardize",
",",
"self",
")",
".",
"_save_to_input_dict",
"(",
")",
"input_dict",
"[",
"\"class\"",
"]",
"=",
"\"GPy.util.normalizer.Standardize\"",
"if",
"self",
".",
"mean",
"is",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Metropolis_Hastings.predict | Make a prediction for the function, to which we will pass the additional arguments | GPy/inference/mcmc/samplers.py | def predict(self,function,args):
"""Make a prediction for the function, to which we will pass the additional arguments"""
param = self.model.param_array
fs = []
for p in self.chain:
self.model.param_array = p
fs.append(function(*args))
# reset model to sta... | def predict(self,function,args):
"""Make a prediction for the function, to which we will pass the additional arguments"""
param = self.model.param_array
fs = []
for p in self.chain:
self.model.param_array = p
fs.append(function(*args))
# reset model to sta... | [
"Make",
"a",
"prediction",
"for",
"the",
"function",
"to",
"which",
"we",
"will",
"pass",
"the",
"additional",
"arguments"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/mcmc/samplers.py#L73-L82 | [
"def",
"predict",
"(",
"self",
",",
"function",
",",
"args",
")",
":",
"param",
"=",
"self",
".",
"model",
".",
"param_array",
"fs",
"=",
"[",
"]",
"for",
"p",
"in",
"self",
".",
"chain",
":",
"self",
".",
"model",
".",
"param_array",
"=",
"p",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | FiniteDimensional._param_grad_helper | Return shape is NxMx(Ntheta) | GPy/kern/src/todo/finite_dimensional.py | def _param_grad_helper(self,X,X2,target):
"""Return shape is NxMx(Ntheta)"""
if X2 is None: X2 = X
FX = np.column_stack([f(X) for f in self.F])
FX2 = np.column_stack([f(X2) for f in self.F])
DER = np.zeros((self.n,self.n,self.n))
for i in range(self.n):
DER[i,... | def _param_grad_helper(self,X,X2,target):
"""Return shape is NxMx(Ntheta)"""
if X2 is None: X2 = X
FX = np.column_stack([f(X) for f in self.F])
FX2 = np.column_stack([f(X2) for f in self.F])
DER = np.zeros((self.n,self.n,self.n))
for i in range(self.n):
DER[i,... | [
"Return",
"shape",
"is",
"NxMx",
"(",
"Ntheta",
")"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/finite_dimensional.py#L53-L64 | [
"def",
"_param_grad_helper",
"(",
"self",
",",
"X",
",",
"X2",
",",
"target",
")",
":",
"if",
"X2",
"is",
"None",
":",
"X2",
"=",
"X",
"FX",
"=",
"np",
".",
"column_stack",
"(",
"[",
"f",
"(",
"X",
")",
"for",
"f",
"in",
"self",
".",
"F",
"]"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | TPRegression.set_XY | Set the input / output data of the model
This is useful if we wish to change our existing data but maintain the same model
:param X: input observations
:type X: np.ndarray
:param Y: output observations
:type Y: np.ndarray or ObsAr | GPy/models/tp_regression.py | def set_XY(self, X, Y):
"""
Set the input / output data of the model
This is useful if we wish to change our existing data but maintain the same model
:param X: input observations
:type X: np.ndarray
:param Y: output observations
:type Y: np.ndarray or ObsAr
... | def set_XY(self, X, Y):
"""
Set the input / output data of the model
This is useful if we wish to change our existing data but maintain the same model
:param X: input observations
:type X: np.ndarray
:param Y: output observations
:type Y: np.ndarray or ObsAr
... | [
"Set",
"the",
"input",
"/",
"output",
"data",
"of",
"the",
"model",
"This",
"is",
"useful",
"if",
"we",
"wish",
"to",
"change",
"our",
"existing",
"data",
"but",
"maintain",
"the",
"same",
"model"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/tp_regression.py#L105-L118 | [
"def",
"set_XY",
"(",
"self",
",",
"X",
",",
"Y",
")",
":",
"self",
".",
"update_model",
"(",
"False",
")",
"self",
".",
"set_Y",
"(",
"Y",
")",
"self",
".",
"set_X",
"(",
"X",
")",
"self",
".",
"update_model",
"(",
"True",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | TPRegression.set_X | Set the input data of the model
:param X: input observations
:type X: np.ndarray | GPy/models/tp_regression.py | def set_X(self, X):
"""
Set the input data of the model
:param X: input observations
:type X: np.ndarray
"""
assert isinstance(X, np.ndarray)
state = self.update_model()
self.update_model(False)
self.X = ObsAr(X)
self.update_model(state) | def set_X(self, X):
"""
Set the input data of the model
:param X: input observations
:type X: np.ndarray
"""
assert isinstance(X, np.ndarray)
state = self.update_model()
self.update_model(False)
self.X = ObsAr(X)
self.update_model(state) | [
"Set",
"the",
"input",
"data",
"of",
"the",
"model"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/tp_regression.py#L120-L131 | [
"def",
"set_X",
"(",
"self",
",",
"X",
")",
":",
"assert",
"isinstance",
"(",
"X",
",",
"np",
".",
"ndarray",
")",
"state",
"=",
"self",
".",
"update_model",
"(",
")",
"self",
".",
"update_model",
"(",
"False",
")",
"self",
".",
"X",
"=",
"ObsAr",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | TPRegression.set_Y | Set the output data of the model
:param Y: output observations
:type Y: np.ndarray or ObsArray | GPy/models/tp_regression.py | def set_Y(self, Y):
"""
Set the output data of the model
:param Y: output observations
:type Y: np.ndarray or ObsArray
"""
assert isinstance(Y, (np.ndarray, ObsAr))
state = self.update_model()
self.update_model(False)
if self.normalizer is not Non... | def set_Y(self, Y):
"""
Set the output data of the model
:param Y: output observations
:type Y: np.ndarray or ObsArray
"""
assert isinstance(Y, (np.ndarray, ObsAr))
state = self.update_model()
self.update_model(False)
if self.normalizer is not Non... | [
"Set",
"the",
"output",
"data",
"of",
"the",
"model"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/tp_regression.py#L133-L150 | [
"def",
"set_Y",
"(",
"self",
",",
"Y",
")",
":",
"assert",
"isinstance",
"(",
"Y",
",",
"(",
"np",
".",
"ndarray",
",",
"ObsAr",
")",
")",
"state",
"=",
"self",
".",
"update_model",
"(",
")",
"self",
".",
"update_model",
"(",
"False",
")",
"if",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | TPRegression.parameters_changed | Method that is called upon any changes to :class:`~GPy.core.parameterization.param.Param` variables within the model.
In particular in this class this method re-performs inference, recalculating the posterior, log marginal likelihood and gradients of the model
.. warning::
This method is no... | GPy/models/tp_regression.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 this class this method re-performs inference, recalculating the posterior, log marginal likelihood and gradients of the model
... | 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 this class this method re-performs inference, recalculating the posterior, log marginal likelihood and gradients of the model
... | [
"Method",
"that",
"is",
"called",
"upon",
"any",
"changes",
"to",
":",
"class",
":",
"~GPy",
".",
"core",
".",
"parameterization",
".",
"param",
".",
"Param",
"variables",
"within",
"the",
"model",
".",
"In",
"particular",
"in",
"this",
"class",
"this",
... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/tp_regression.py#L152-L170 | [
"def",
"parameters_changed",
"(",
"self",
")",
":",
"self",
".",
"posterior",
",",
"self",
".",
"_log_marginal_likelihood",
",",
"grad_dict",
"=",
"self",
".",
"inference_method",
".",
"inference",
"(",
"self",
".",
"kern",
",",
"self",
".",
"X",
",",
"sel... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | TPRegression._raw_predict | For making predictions, does not account for normalization or likelihood
full_cov is a boolean which defines whether the full covariance matrix
of the prediction is computed. If full_cov is False (default), only the
diagonal of the covariance is returned.
.. math::
p(f*|X*,... | GPy/models/tp_regression.py | def _raw_predict(self, Xnew, full_cov=False, kern=None):
"""
For making predictions, does not account for normalization or likelihood
full_cov is a boolean which defines whether the full covariance matrix
of the prediction is computed. If full_cov is False (default), only the
di... | def _raw_predict(self, Xnew, full_cov=False, kern=None):
"""
For making predictions, does not account for normalization or likelihood
full_cov is a boolean which defines whether the full covariance matrix
of the prediction is computed. If full_cov is False (default), only the
di... | [
"For",
"making",
"predictions",
"does",
"not",
"account",
"for",
"normalization",
"or",
"likelihood"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/tp_regression.py#L178-L196 | [
"def",
"_raw_predict",
"(",
"self",
",",
"Xnew",
",",
"full_cov",
"=",
"False",
",",
"kern",
"=",
"None",
")",
":",
"mu",
",",
"var",
"=",
"self",
".",
"posterior",
".",
"_raw_predict",
"(",
"kern",
"=",
"self",
".",
"kern",
"if",
"kern",
"is",
"No... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | TPRegression.predict | Predict the function(s) at the new point(s) Xnew. For Student-t processes, this method is equivalent to
predict_noiseless as no likelihood is included in the model. | GPy/models/tp_regression.py | def predict(self, Xnew, full_cov=False, kern=None, **kwargs):
"""
Predict the function(s) at the new point(s) Xnew. For Student-t processes, this method is equivalent to
predict_noiseless as no likelihood is included in the model.
"""
return self.predict_noiseless(Xnew, full_cov=... | def predict(self, Xnew, full_cov=False, kern=None, **kwargs):
"""
Predict the function(s) at the new point(s) Xnew. For Student-t processes, this method is equivalent to
predict_noiseless as no likelihood is included in the model.
"""
return self.predict_noiseless(Xnew, full_cov=... | [
"Predict",
"the",
"function",
"(",
"s",
")",
"at",
"the",
"new",
"point",
"(",
"s",
")",
"Xnew",
".",
"For",
"Student",
"-",
"t",
"processes",
"this",
"method",
"is",
"equivalent",
"to",
"predict_noiseless",
"as",
"no",
"likelihood",
"is",
"included",
"i... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/tp_regression.py#L198-L203 | [
"def",
"predict",
"(",
"self",
",",
"Xnew",
",",
"full_cov",
"=",
"False",
",",
"kern",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"predict_noiseless",
"(",
"Xnew",
",",
"full_cov",
"=",
"full_cov",
",",
"kern",
"=",
"kern... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | TPRegression.predict_noiseless | Predict the underlying function f at the new point(s) Xnew.
:param Xnew: The points at which to make a prediction
:type Xnew: np.ndarray (Nnew x self.input_dim)
:param full_cov: whether to return the full covariance matrix, or just the diagonal
:type full_cov: bool
:param kern:... | GPy/models/tp_regression.py | def predict_noiseless(self, Xnew, full_cov=False, kern=None):
"""
Predict the underlying function f at the new point(s) Xnew.
:param Xnew: The points at which to make a prediction
:type Xnew: np.ndarray (Nnew x self.input_dim)
:param full_cov: whether to return the full covaria... | def predict_noiseless(self, Xnew, full_cov=False, kern=None):
"""
Predict the underlying function f at the new point(s) Xnew.
:param Xnew: The points at which to make a prediction
:type Xnew: np.ndarray (Nnew x self.input_dim)
:param full_cov: whether to return the full covaria... | [
"Predict",
"the",
"underlying",
"function",
"f",
"at",
"the",
"new",
"point",
"(",
"s",
")",
"Xnew",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/tp_regression.py#L205-L230 | [
"def",
"predict_noiseless",
"(",
"self",
",",
"Xnew",
",",
"full_cov",
"=",
"False",
",",
"kern",
"=",
"None",
")",
":",
"# Predict the latent function values",
"mu",
",",
"var",
"=",
"self",
".",
"_raw_predict",
"(",
"Xnew",
",",
"full_cov",
"=",
"full_cov"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | TPRegression.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
:param kern: optio... | GPy/models/tp_regression.py | def predict_quantiles(self, X, quantiles=(2.5, 97.5), kern=None, **kwargs):
"""
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... | def predict_quantiles(self, X, quantiles=(2.5, 97.5), kern=None, **kwargs):
"""
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... | [
"Get",
"the",
"predictive",
"quantiles",
"around",
"the",
"prediction",
"at",
"X"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/tp_regression.py#L232-L251 | [
"def",
"predict_quantiles",
"(",
"self",
",",
"X",
",",
"quantiles",
"=",
"(",
"2.5",
",",
"97.5",
")",
",",
"kern",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"mu",
",",
"var",
"=",
"self",
".",
"_raw_predict",
"(",
"X",
",",
"full_cov",
"=... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | TPRegression.posterior_samples | Samples the posterior GP at the points X, equivalent to posterior_samples_f due to the absence of a likelihood. | GPy/models/tp_regression.py | def posterior_samples(self, X, size=10, full_cov=False, Y_metadata=None, likelihood=None, **predict_kwargs):
"""
Samples the posterior GP at the points X, equivalent to posterior_samples_f due to the absence of a likelihood.
"""
return self.posterior_samples_f(X, size, full_cov=full_cov,... | def posterior_samples(self, X, size=10, full_cov=False, Y_metadata=None, likelihood=None, **predict_kwargs):
"""
Samples the posterior GP at the points X, equivalent to posterior_samples_f due to the absence of a likelihood.
"""
return self.posterior_samples_f(X, size, full_cov=full_cov,... | [
"Samples",
"the",
"posterior",
"GP",
"at",
"the",
"points",
"X",
"equivalent",
"to",
"posterior_samples_f",
"due",
"to",
"the",
"absence",
"of",
"a",
"likelihood",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/tp_regression.py#L253-L257 | [
"def",
"posterior_samples",
"(",
"self",
",",
"X",
",",
"size",
"=",
"10",
",",
"full_cov",
"=",
"False",
",",
"Y_metadata",
"=",
"None",
",",
"likelihood",
"=",
"None",
",",
"*",
"*",
"predict_kwargs",
")",
":",
"return",
"self",
".",
"posterior_samples... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | TPRegression.posterior_samples_f | Samples the posterior TP at the points X.
:param X: The points at which to take the samples.
:type X: np.ndarray (Nnew x self.input_dim)
:param size: the number of a posteriori samples.
:type size: int.
:param full_cov: whether to return the full covariance matrix, or just the d... | GPy/models/tp_regression.py | def posterior_samples_f(self, X, size=10, full_cov=True, **predict_kwargs):
"""
Samples the posterior TP at the points X.
:param X: The points at which to take the samples.
:type X: np.ndarray (Nnew x self.input_dim)
:param size: the number of a posteriori samples.
:type... | def posterior_samples_f(self, X, size=10, full_cov=True, **predict_kwargs):
"""
Samples the posterior TP at the points X.
:param X: The points at which to take the samples.
:type X: np.ndarray (Nnew x self.input_dim)
:param size: the number of a posteriori samples.
:type... | [
"Samples",
"the",
"posterior",
"TP",
"at",
"the",
"points",
"X",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/tp_regression.py#L259-L294 | [
"def",
"posterior_samples_f",
"(",
"self",
",",
"X",
",",
"size",
"=",
"10",
",",
"full_cov",
"=",
"True",
",",
"*",
"*",
"predict_kwargs",
")",
":",
"mu",
",",
"var",
"=",
"self",
".",
"_raw_predict",
"(",
"X",
",",
"full_cov",
"=",
"full_cov",
",",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | view | Get a view on the diagonal elements of a 2D array.
This is actually a view (!) on the diagonal of the array, so you can
in-place adjust the view.
:param :class:`ndarray` A: 2 dimensional numpy array
:param int offset: view offset to give back (negative entries allowed)
:rtype: :class:`ndarray` vie... | GPy/util/diag.py | def view(A, offset=0):
"""
Get a view on the diagonal elements of a 2D array.
This is actually a view (!) on the diagonal of the array, so you can
in-place adjust the view.
:param :class:`ndarray` A: 2 dimensional numpy array
:param int offset: view offset to give back (negative entries allowe... | def view(A, offset=0):
"""
Get a view on the diagonal elements of a 2D array.
This is actually a view (!) on the diagonal of the array, so you can
in-place adjust the view.
:param :class:`ndarray` A: 2 dimensional numpy array
:param int offset: view offset to give back (negative entries allowe... | [
"Get",
"a",
"view",
"on",
"the",
"diagonal",
"elements",
"of",
"a",
"2D",
"array",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/diag.py#L6-L40 | [
"def",
"view",
"(",
"A",
",",
"offset",
"=",
"0",
")",
":",
"from",
"numpy",
".",
"lib",
".",
"stride_tricks",
"import",
"as_strided",
"assert",
"A",
".",
"ndim",
"==",
"2",
",",
"\"only implemented for 2 dimensions\"",
"assert",
"A",
".",
"shape",
"[",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | times | Times the view of A with b in place (!).
Returns modified A
Broadcasting is allowed, thus b can be scalar.
if offset is not zero, make sure b is of right shape!
:param ndarray A: 2 dimensional array
:param ndarray-like b: either one dimensional or scalar
:param int offset: same as in view.
... | GPy/util/diag.py | def times(A, b, offset=0):
"""
Times the view of A with b in place (!).
Returns modified A
Broadcasting is allowed, thus b can be scalar.
if offset is not zero, make sure b is of right shape!
:param ndarray A: 2 dimensional array
:param ndarray-like b: either one dimensional or scalar
... | def times(A, b, offset=0):
"""
Times the view of A with b in place (!).
Returns modified A
Broadcasting is allowed, thus b can be scalar.
if offset is not zero, make sure b is of right shape!
:param ndarray A: 2 dimensional array
:param ndarray-like b: either one dimensional or scalar
... | [
"Times",
"the",
"view",
"of",
"A",
"with",
"b",
"in",
"place",
"(",
"!",
")",
".",
"Returns",
"modified",
"A",
"Broadcasting",
"is",
"allowed",
"thus",
"b",
"can",
"be",
"scalar",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/diag.py#L54-L67 | [
"def",
"times",
"(",
"A",
",",
"b",
",",
"offset",
"=",
"0",
")",
":",
"return",
"_diag_ufunc",
"(",
"A",
",",
"b",
",",
"offset",
",",
"np",
".",
"multiply",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | divide | Divide the view of A by b in place (!).
Returns modified A
Broadcasting is allowed, thus b can be scalar.
if offset is not zero, make sure b is of right shape!
:param ndarray A: 2 dimensional array
:param ndarray-like b: either one dimensional or scalar
:param int offset: same as in view.
... | GPy/util/diag.py | def divide(A, b, offset=0):
"""
Divide the view of A by b in place (!).
Returns modified A
Broadcasting is allowed, thus b can be scalar.
if offset is not zero, make sure b is of right shape!
:param ndarray A: 2 dimensional array
:param ndarray-like b: either one dimensional or scalar
... | def divide(A, b, offset=0):
"""
Divide the view of A by b in place (!).
Returns modified A
Broadcasting is allowed, thus b can be scalar.
if offset is not zero, make sure b is of right shape!
:param ndarray A: 2 dimensional array
:param ndarray-like b: either one dimensional or scalar
... | [
"Divide",
"the",
"view",
"of",
"A",
"by",
"b",
"in",
"place",
"(",
"!",
")",
".",
"Returns",
"modified",
"A",
"Broadcasting",
"is",
"allowed",
"thus",
"b",
"can",
"be",
"scalar",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/diag.py#L70-L83 | [
"def",
"divide",
"(",
"A",
",",
"b",
",",
"offset",
"=",
"0",
")",
":",
"return",
"_diag_ufunc",
"(",
"A",
",",
"b",
",",
"offset",
",",
"np",
".",
"divide",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | add | Add b to the view of A in place (!).
Returns modified A.
Broadcasting is allowed, thus b can be scalar.
if offset is not zero, make sure b is of right shape!
:param ndarray A: 2 dimensional array
:param ndarray-like b: either one dimensional or scalar
:param int offset: same as in view.
:r... | GPy/util/diag.py | def add(A, b, offset=0):
"""
Add b to the view of A in place (!).
Returns modified A.
Broadcasting is allowed, thus b can be scalar.
if offset is not zero, make sure b is of right shape!
:param ndarray A: 2 dimensional array
:param ndarray-like b: either one dimensional or scalar
:para... | def add(A, b, offset=0):
"""
Add b to the view of A in place (!).
Returns modified A.
Broadcasting is allowed, thus b can be scalar.
if offset is not zero, make sure b is of right shape!
:param ndarray A: 2 dimensional array
:param ndarray-like b: either one dimensional or scalar
:para... | [
"Add",
"b",
"to",
"the",
"view",
"of",
"A",
"in",
"place",
"(",
"!",
")",
".",
"Returns",
"modified",
"A",
".",
"Broadcasting",
"is",
"allowed",
"thus",
"b",
"can",
"be",
"scalar",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/diag.py#L85-L98 | [
"def",
"add",
"(",
"A",
",",
"b",
",",
"offset",
"=",
"0",
")",
":",
"return",
"_diag_ufunc",
"(",
"A",
",",
"b",
",",
"offset",
",",
"np",
".",
"add",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | subtract | Subtract b from the view of A in place (!).
Returns modified A.
Broadcasting is allowed, thus b can be scalar.
if offset is not zero, make sure b is of right shape!
:param ndarray A: 2 dimensional array
:param ndarray-like b: either one dimensional or scalar
:param int offset: same as in view.... | GPy/util/diag.py | def subtract(A, b, offset=0):
"""
Subtract b from the view of A in place (!).
Returns modified A.
Broadcasting is allowed, thus b can be scalar.
if offset is not zero, make sure b is of right shape!
:param ndarray A: 2 dimensional array
:param ndarray-like b: either one dimensional or scal... | def subtract(A, b, offset=0):
"""
Subtract b from the view of A in place (!).
Returns modified A.
Broadcasting is allowed, thus b can be scalar.
if offset is not zero, make sure b is of right shape!
:param ndarray A: 2 dimensional array
:param ndarray-like b: either one dimensional or scal... | [
"Subtract",
"b",
"from",
"the",
"view",
"of",
"A",
"in",
"place",
"(",
"!",
")",
".",
"Returns",
"modified",
"A",
".",
"Broadcasting",
"is",
"allowed",
"thus",
"b",
"can",
"be",
"scalar",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/diag.py#L100-L113 | [
"def",
"subtract",
"(",
"A",
",",
"b",
",",
"offset",
"=",
"0",
")",
":",
"return",
"_diag_ufunc",
"(",
"A",
",",
"b",
",",
"offset",
",",
"np",
".",
"subtract",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | LatentFunctionInference.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/inference/latent_function_inference/__init__.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/inference/latent_function_inference/__init__.py#L52-L70 | [
"def",
"from_dict",
"(",
"input_dict",
")",
":",
"import",
"copy",
"input_dict",
"=",
"copy",
".",
"deepcopy",
"(",
"input_dict",
")",
"inference_class",
"=",
"input_dict",
".",
"pop",
"(",
"'class'",
")",
"import",
"GPy",
"inference_class",
"=",
"eval",
"("... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Add.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/add.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/add.py#L46-L57 | [
"def",
"to_dict",
"(",
"self",
")",
":",
"input_dict",
"=",
"super",
"(",
"Add",
",",
"self",
")",
".",
"_save_to_input_dict",
"(",
")",
"input_dict",
"[",
"\"class\"",
"]",
"=",
"str",
"(",
"\"GPy.kern.Add\"",
")",
"return",
"input_dict"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Add.gradients_X | Compute the gradient of the objective function with respect to X.
:param dL_dK: An array of gradients of the objective function with respect to the covariance function.
:type dL_dK: np.ndarray (num_samples x num_inducing)
:param X: Observed data inputs
:type X: np.ndarray (num_samples x... | GPy/kern/src/add.py | def gradients_X(self, dL_dK, X, X2=None):
"""Compute the gradient of the objective function with respect to X.
:param dL_dK: An array of gradients of the objective function with respect to the covariance function.
:type dL_dK: np.ndarray (num_samples x num_inducing)
:param X: Observed d... | def gradients_X(self, dL_dK, X, X2=None):
"""Compute the gradient of the objective function with respect to X.
:param dL_dK: An array of gradients of the objective function with respect to the covariance function.
:type dL_dK: np.ndarray (num_samples x num_inducing)
:param X: Observed d... | [
"Compute",
"the",
"gradient",
"of",
"the",
"objective",
"function",
"with",
"respect",
"to",
"X",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/add.py#L88-L100 | [
"def",
"gradients_X",
"(",
"self",
",",
"dL_dK",
",",
"X",
",",
"X2",
"=",
"None",
")",
":",
"target",
"=",
"np",
".",
"zeros",
"(",
"X",
".",
"shape",
")",
"[",
"target",
".",
"__iadd__",
"(",
"p",
".",
"gradients_X",
"(",
"dL_dK",
",",
"X",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Add.sde | Support adding kernels for sde representation | GPy/kern/src/add.py | def sde(self):
"""
Support adding kernels for sde representation
"""
import scipy.linalg as la
F = None
L = None
Qc = None
H = None
Pinf = None
P0 = None
dF = None
dQc = None
dPinf = None
... | def sde(self):
"""
Support adding kernels for sde representation
"""
import scipy.linalg as la
F = None
L = None
Qc = None
H = None
Pinf = None
P0 = None
dF = None
dQc = None
dPinf = None
... | [
"Support",
"adding",
"kernels",
"for",
"sde",
"representation"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/add.py#L305-L380 | [
"def",
"sde",
"(",
"self",
")",
":",
"import",
"scipy",
".",
"linalg",
"as",
"la",
"F",
"=",
"None",
"L",
"=",
"None",
"Qc",
"=",
"None",
"H",
"=",
"None",
"Pinf",
"=",
"None",
"P0",
"=",
"None",
"dF",
"=",
"None",
"dQc",
"=",
"None",
"dPinf",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | conf_matrix | Returns error rate and true/false positives in a binary classification problem
- Actual classes are displayed by column.
- Predicted classes are displayed by row.
:param p: array of class '1' probabilities.
:param labels: array of actual classes.
:param names: list of class names, defaults to ['1',... | GPy/util/classification.py | def conf_matrix(p,labels,names=['1','0'],threshold=.5,show=True):
"""
Returns error rate and true/false positives in a binary classification problem
- Actual classes are displayed by column.
- Predicted classes are displayed by row.
:param p: array of class '1' probabilities.
:param labels: arr... | def conf_matrix(p,labels,names=['1','0'],threshold=.5,show=True):
"""
Returns error rate and true/false positives in a binary classification problem
- Actual classes are displayed by column.
- Predicted classes are displayed by row.
:param p: array of class '1' probabilities.
:param labels: arr... | [
"Returns",
"error",
"rate",
"and",
"true",
"/",
"false",
"positives",
"in",
"a",
"binary",
"classification",
"problem",
"-",
"Actual",
"classes",
"are",
"displayed",
"by",
"column",
".",
"-",
"Predicted",
"classes",
"are",
"displayed",
"by",
"row",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/classification.py#L5-L33 | [
"def",
"conf_matrix",
"(",
"p",
",",
"labels",
",",
"names",
"=",
"[",
"'1'",
",",
"'0'",
"]",
",",
"threshold",
"=",
".5",
",",
"show",
"=",
"True",
")",
":",
"assert",
"p",
".",
"size",
"==",
"labels",
".",
"size",
",",
"\"Arrays p and labels have ... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | SparseGP.to_dict | Convert the object into a json serializable dictionary.
:param boolean save_data: if true, it adds the training data self.X and self.Y to the dictionary
:return dict: json serializable dictionary containing the needed information to instantiate the object | GPy/core/sparse_gp.py | def to_dict(self, save_data=True):
"""
Convert the object into a json serializable dictionary.
:param boolean save_data: if true, it adds the training data self.X and self.Y to the dictionary
:return dict: json serializable dictionary containing the needed information to instantiate the... | def to_dict(self, save_data=True):
"""
Convert the object into a json serializable dictionary.
:param boolean save_data: if true, it adds the training data self.X and self.Y to the dictionary
:return dict: json serializable dictionary containing the needed information to instantiate the... | [
"Convert",
"the",
"object",
"into",
"a",
"json",
"serializable",
"dictionary",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/sparse_gp.py#L121-L131 | [
"def",
"to_dict",
"(",
"self",
",",
"save_data",
"=",
"True",
")",
":",
"input_dict",
"=",
"super",
"(",
"SparseGP",
",",
"self",
")",
".",
"to_dict",
"(",
"save_data",
")",
"input_dict",
"[",
"\"class\"",
"]",
"=",
"\"GPy.core.SparseGP\"",
"input_dict",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | force_F_ordered_symmetric | return a F ordered version of A, assuming A is symmetric | GPy/util/linalg.py | def force_F_ordered_symmetric(A):
"""
return a F ordered version of A, assuming A is symmetric
"""
if A.flags['F_CONTIGUOUS']:
return A
if A.flags['C_CONTIGUOUS']:
return A.T
else:
return np.asfortranarray(A) | def force_F_ordered_symmetric(A):
"""
return a F ordered version of A, assuming A is symmetric
"""
if A.flags['F_CONTIGUOUS']:
return A
if A.flags['C_CONTIGUOUS']:
return A.T
else:
return np.asfortranarray(A) | [
"return",
"a",
"F",
"ordered",
"version",
"of",
"A",
"assuming",
"A",
"is",
"symmetric"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L20-L29 | [
"def",
"force_F_ordered_symmetric",
"(",
"A",
")",
":",
"if",
"A",
".",
"flags",
"[",
"'F_CONTIGUOUS'",
"]",
":",
"return",
"A",
"if",
"A",
".",
"flags",
"[",
"'C_CONTIGUOUS'",
"]",
":",
"return",
"A",
".",
"T",
"else",
":",
"return",
"np",
".",
"asf... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | dtrtrs | Wrapper for lapack dtrtrs function
DTRTRS solves a triangular system of the form
A * X = B or A**T * X = B,
where A is a triangular matrix of order N, and B is an N-by-NRHS
matrix. A check is made to verify that A is nonsingular.
:param A: Matrix A(triangular)
:param B: Matrix B
:... | GPy/util/linalg.py | def dtrtrs(A, B, lower=1, trans=0, unitdiag=0):
"""
Wrapper for lapack dtrtrs function
DTRTRS solves a triangular system of the form
A * X = B or A**T * X = B,
where A is a triangular matrix of order N, and B is an N-by-NRHS
matrix. A check is made to verify that A is nonsingular.
... | def dtrtrs(A, B, lower=1, trans=0, unitdiag=0):
"""
Wrapper for lapack dtrtrs function
DTRTRS solves a triangular system of the form
A * X = B or A**T * X = B,
where A is a triangular matrix of order N, and B is an N-by-NRHS
matrix. A check is made to verify that A is nonsingular.
... | [
"Wrapper",
"for",
"lapack",
"dtrtrs",
"function"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L95-L114 | [
"def",
"dtrtrs",
"(",
"A",
",",
"B",
",",
"lower",
"=",
"1",
",",
"trans",
"=",
"0",
",",
"unitdiag",
"=",
"0",
")",
":",
"A",
"=",
"np",
".",
"asfortranarray",
"(",
"A",
")",
"#Note: B does not seem to need to be F ordered!",
"return",
"lapack",
".",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | dpotrs | Wrapper for lapack dpotrs function
:param A: Matrix A
:param B: Matrix B
:param lower: is matrix lower (true) or upper (false)
:returns: | GPy/util/linalg.py | def dpotrs(A, B, lower=1):
"""
Wrapper for lapack dpotrs function
:param A: Matrix A
:param B: Matrix B
:param lower: is matrix lower (true) or upper (false)
:returns:
"""
A = force_F_ordered(A)
return lapack.dpotrs(A, B, lower=lower) | def dpotrs(A, B, lower=1):
"""
Wrapper for lapack dpotrs function
:param A: Matrix A
:param B: Matrix B
:param lower: is matrix lower (true) or upper (false)
:returns:
"""
A = force_F_ordered(A)
return lapack.dpotrs(A, B, lower=lower) | [
"Wrapper",
"for",
"lapack",
"dpotrs",
"function",
":",
"param",
"A",
":",
"Matrix",
"A",
":",
"param",
"B",
":",
"Matrix",
"B",
":",
"param",
"lower",
":",
"is",
"matrix",
"lower",
"(",
"true",
")",
"or",
"upper",
"(",
"false",
")",
":",
"returns",
... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L116-L125 | [
"def",
"dpotrs",
"(",
"A",
",",
"B",
",",
"lower",
"=",
"1",
")",
":",
"A",
"=",
"force_F_ordered",
"(",
"A",
")",
"return",
"lapack",
".",
"dpotrs",
"(",
"A",
",",
"B",
",",
"lower",
"=",
"lower",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | dpotri | Wrapper for lapack dpotri function
DPOTRI - compute the inverse of a real symmetric positive
definite matrix A using the Cholesky factorization A =
U**T*U or A = L*L**T computed by DPOTRF
:param A: Matrix A
:param lower: is matrix lower (true) or upper (false)
:returns: A inverse | GPy/util/linalg.py | def dpotri(A, lower=1):
"""
Wrapper for lapack dpotri function
DPOTRI - compute the inverse of a real symmetric positive
definite matrix A using the Cholesky factorization A =
U**T*U or A = L*L**T computed by DPOTRF
:param A: Matrix A
:param lower: is matrix lower (true) or upper (fals... | def dpotri(A, lower=1):
"""
Wrapper for lapack dpotri function
DPOTRI - compute the inverse of a real symmetric positive
definite matrix A using the Cholesky factorization A =
U**T*U or A = L*L**T computed by DPOTRF
:param A: Matrix A
:param lower: is matrix lower (true) or upper (fals... | [
"Wrapper",
"for",
"lapack",
"dpotri",
"function"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L127-L145 | [
"def",
"dpotri",
"(",
"A",
",",
"lower",
"=",
"1",
")",
":",
"A",
"=",
"force_F_ordered",
"(",
"A",
")",
"R",
",",
"info",
"=",
"lapack",
".",
"dpotri",
"(",
"A",
",",
"lower",
"=",
"lower",
")",
"#needs to be zero here, seems to be a scipy bug",
"symmet... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | pddet | Determinant of a positive definite matrix, only symmetric matricies though | GPy/util/linalg.py | def pddet(A):
"""
Determinant of a positive definite matrix, only symmetric matricies though
"""
L = jitchol(A)
logdetA = 2*sum(np.log(np.diag(L)))
return logdetA | def pddet(A):
"""
Determinant of a positive definite matrix, only symmetric matricies though
"""
L = jitchol(A)
logdetA = 2*sum(np.log(np.diag(L)))
return logdetA | [
"Determinant",
"of",
"a",
"positive",
"definite",
"matrix",
"only",
"symmetric",
"matricies",
"though"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L147-L153 | [
"def",
"pddet",
"(",
"A",
")",
":",
"L",
"=",
"jitchol",
"(",
"A",
")",
"logdetA",
"=",
"2",
"*",
"sum",
"(",
"np",
".",
"log",
"(",
"np",
".",
"diag",
"(",
"L",
")",
")",
")",
"return",
"logdetA"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | mdot | Multiply all the arguments using matrix product rules.
The output is equivalent to multiplying the arguments one by one
from left to right using dot().
Precedence can be controlled by creating tuples of arguments,
for instance mdot(a,((b,c),d)) multiplies a (a*((b*c)*d)).
Note that this means the ou... | GPy/util/linalg.py | def mdot(*args):
"""
Multiply all the arguments using matrix product rules.
The output is equivalent to multiplying the arguments one by one
from left to right using dot().
Precedence can be controlled by creating tuples of arguments,
for instance mdot(a,((b,c),d)) multiplies a (a*((b*c)*d)).
... | def mdot(*args):
"""
Multiply all the arguments using matrix product rules.
The output is equivalent to multiplying the arguments one by one
from left to right using dot().
Precedence can be controlled by creating tuples of arguments,
for instance mdot(a,((b,c),d)) multiplies a (a*((b*c)*d)).
... | [
"Multiply",
"all",
"the",
"arguments",
"using",
"matrix",
"product",
"rules",
".",
"The",
"output",
"is",
"equivalent",
"to",
"multiplying",
"the",
"arguments",
"one",
"by",
"one",
"from",
"left",
"to",
"right",
"using",
"dot",
"()",
".",
"Precedence",
"can"... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L161-L177 | [
"def",
"mdot",
"(",
"*",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"==",
"1",
":",
"return",
"args",
"[",
"0",
"]",
"elif",
"len",
"(",
"args",
")",
"==",
"2",
":",
"return",
"_mdot_r",
"(",
"args",
"[",
"0",
"]",
",",
"args",
"[",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | _mdot_r | Recursive helper for mdot | GPy/util/linalg.py | def _mdot_r(a, b):
"""Recursive helper for mdot"""
if type(a) == tuple:
if len(a) > 1:
a = mdot(*a)
else:
a = a[0]
if type(b) == tuple:
if len(b) > 1:
b = mdot(*b)
else:
b = b[0]
return np.dot(a, b) | def _mdot_r(a, b):
"""Recursive helper for mdot"""
if type(a) == tuple:
if len(a) > 1:
a = mdot(*a)
else:
a = a[0]
if type(b) == tuple:
if len(b) > 1:
b = mdot(*b)
else:
b = b[0]
return np.dot(a, b) | [
"Recursive",
"helper",
"for",
"mdot"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L179-L191 | [
"def",
"_mdot_r",
"(",
"a",
",",
"b",
")",
":",
"if",
"type",
"(",
"a",
")",
"==",
"tuple",
":",
"if",
"len",
"(",
"a",
")",
">",
"1",
":",
"a",
"=",
"mdot",
"(",
"*",
"a",
")",
"else",
":",
"a",
"=",
"a",
"[",
"0",
"]",
"if",
"type",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | pdinv | :param A: A DxD pd numpy array
:rval Ai: the inverse of A
:rtype Ai: np.ndarray
:rval L: the Cholesky decomposition of A
:rtype L: np.ndarray
:rval Li: the Cholesky decomposition of Ai
:rtype Li: np.ndarray
:rval logdet: the log of the determinant of A
:rtype logdet: float64 | GPy/util/linalg.py | def pdinv(A, *args):
"""
:param A: A DxD pd numpy array
:rval Ai: the inverse of A
:rtype Ai: np.ndarray
:rval L: the Cholesky decomposition of A
:rtype L: np.ndarray
:rval Li: the Cholesky decomposition of Ai
:rtype Li: np.ndarray
:rval logdet: the log of the determinant of A
:... | def pdinv(A, *args):
"""
:param A: A DxD pd numpy array
:rval Ai: the inverse of A
:rtype Ai: np.ndarray
:rval L: the Cholesky decomposition of A
:rtype L: np.ndarray
:rval Li: the Cholesky decomposition of Ai
:rtype Li: np.ndarray
:rval logdet: the log of the determinant of A
:... | [
":",
"param",
"A",
":",
"A",
"DxD",
"pd",
"numpy",
"array"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L193-L214 | [
"def",
"pdinv",
"(",
"A",
",",
"*",
"args",
")",
":",
"L",
"=",
"jitchol",
"(",
"A",
",",
"*",
"args",
")",
"logdet",
"=",
"2.",
"*",
"np",
".",
"sum",
"(",
"np",
".",
"log",
"(",
"np",
".",
"diag",
"(",
"L",
")",
")",
")",
"Li",
"=",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | multiple_pdinv | :param A: A DxDxN numpy array (each A[:,:,i] is pd)
:rval invs: the inverses of A
:rtype invs: np.ndarray
:rval hld: 0.5* the log of the determinants of A
:rtype hld: np.array | GPy/util/linalg.py | def multiple_pdinv(A):
"""
:param A: A DxDxN numpy array (each A[:,:,i] is pd)
:rval invs: the inverses of A
:rtype invs: np.ndarray
:rval hld: 0.5* the log of the determinants of A
:rtype hld: np.array
"""
N = A.shape[-1]
chols = [jitchol(A[:, :, i]) for i in range(N)]
halflog... | def multiple_pdinv(A):
"""
:param A: A DxDxN numpy array (each A[:,:,i] is pd)
:rval invs: the inverses of A
:rtype invs: np.ndarray
:rval hld: 0.5* the log of the determinants of A
:rtype hld: np.array
"""
N = A.shape[-1]
chols = [jitchol(A[:, :, i]) for i in range(N)]
halflog... | [
":",
"param",
"A",
":",
"A",
"DxDxN",
"numpy",
"array",
"(",
"each",
"A",
"[",
":",
":",
"i",
"]",
"is",
"pd",
")"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L230-L245 | [
"def",
"multiple_pdinv",
"(",
"A",
")",
":",
"N",
"=",
"A",
".",
"shape",
"[",
"-",
"1",
"]",
"chols",
"=",
"[",
"jitchol",
"(",
"A",
"[",
":",
",",
":",
",",
"i",
"]",
")",
"for",
"i",
"in",
"range",
"(",
"N",
")",
"]",
"halflogdets",
"=",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | pca | Principal component analysis: maximum likelihood solution by SVD
:param Y: NxD np.array of data
:param input_dim: int, dimension of projection
:rval X: - Nxinput_dim np.array of dimensionality reduced data
:rval W: - input_dimxD mapping from X to Y | GPy/util/linalg.py | def pca(Y, input_dim):
"""
Principal component analysis: maximum likelihood solution by SVD
:param Y: NxD np.array of data
:param input_dim: int, dimension of projection
:rval X: - Nxinput_dim np.array of dimensionality reduced data
:rval W: - input_dimxD mapping from X to Y
"""
if n... | def pca(Y, input_dim):
"""
Principal component analysis: maximum likelihood solution by SVD
:param Y: NxD np.array of data
:param input_dim: int, dimension of projection
:rval X: - Nxinput_dim np.array of dimensionality reduced data
:rval W: - input_dimxD mapping from X to Y
"""
if n... | [
"Principal",
"component",
"analysis",
":",
"maximum",
"likelihood",
"solution",
"by",
"SVD"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L248-L270 | [
"def",
"pca",
"(",
"Y",
",",
"input_dim",
")",
":",
"if",
"not",
"np",
".",
"allclose",
"(",
"Y",
".",
"mean",
"(",
"axis",
"=",
"0",
")",
",",
"0.0",
")",
":",
"print",
"(",
"\"Y is not zero mean, centering it locally (GPy.util.linalg.pca)\"",
")",
"# Y -... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | ppca | EM implementation for probabilistic pca.
:param array-like Y: Observed Data
:param int Q: Dimensionality for reduced array
:param int iterations: number of iterations for EM | GPy/util/linalg.py | def ppca(Y, Q, iterations=100):
"""
EM implementation for probabilistic pca.
:param array-like Y: Observed Data
:param int Q: Dimensionality for reduced array
:param int iterations: number of iterations for EM
"""
from numpy.ma import dot as madot
N, D = Y.shape
# Initialise W rando... | def ppca(Y, Q, iterations=100):
"""
EM implementation for probabilistic pca.
:param array-like Y: Observed Data
:param int Q: Dimensionality for reduced array
:param int iterations: number of iterations for EM
"""
from numpy.ma import dot as madot
N, D = Y.shape
# Initialise W rando... | [
"EM",
"implementation",
"for",
"probabilistic",
"pca",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L272-L294 | [
"def",
"ppca",
"(",
"Y",
",",
"Q",
",",
"iterations",
"=",
"100",
")",
":",
"from",
"numpy",
".",
"ma",
"import",
"dot",
"as",
"madot",
"N",
",",
"D",
"=",
"Y",
".",
"shape",
"# Initialise W randomly",
"W",
"=",
"np",
".",
"random",
".",
"randn",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | tdot_blas | returns np.dot(mat, mat.T), but faster for large 2D arrays of doubles. | GPy/util/linalg.py | def tdot_blas(mat, out=None):
"""returns np.dot(mat, mat.T), but faster for large 2D arrays of doubles."""
if (mat.dtype != 'float64') or (len(mat.shape) != 2):
return np.dot(mat, mat.T)
nn = mat.shape[0]
if out is None:
out = np.zeros((nn, nn))
else:
assert(out.dtype == 'flo... | def tdot_blas(mat, out=None):
"""returns np.dot(mat, mat.T), but faster for large 2D arrays of doubles."""
if (mat.dtype != 'float64') or (len(mat.shape) != 2):
return np.dot(mat, mat.T)
nn = mat.shape[0]
if out is None:
out = np.zeros((nn, nn))
else:
assert(out.dtype == 'flo... | [
"returns",
"np",
".",
"dot",
"(",
"mat",
"mat",
".",
"T",
")",
"but",
"faster",
"for",
"large",
"2D",
"arrays",
"of",
"doubles",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L299-L320 | [
"def",
"tdot_blas",
"(",
"mat",
",",
"out",
"=",
"None",
")",
":",
"if",
"(",
"mat",
".",
"dtype",
"!=",
"'float64'",
")",
"or",
"(",
"len",
"(",
"mat",
".",
"shape",
")",
"!=",
"2",
")",
":",
"return",
"np",
".",
"dot",
"(",
"mat",
",",
"mat... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DSYR_blas | Performs a symmetric rank-1 update operation:
A <- A + alpha * np.dot(x,x.T)
:param A: Symmetric NxN np.array
:param x: Nx1 np.array
:param alpha: scalar | GPy/util/linalg.py | def DSYR_blas(A, x, alpha=1.):
"""
Performs a symmetric rank-1 update operation:
A <- A + alpha * np.dot(x,x.T)
:param A: Symmetric NxN np.array
:param x: Nx1 np.array
:param alpha: scalar
"""
At = blas.dsyr(lower=0, x=x, a=A, alpha=alpha, overwrite_a=False) #See https://github.com/sci... | def DSYR_blas(A, x, alpha=1.):
"""
Performs a symmetric rank-1 update operation:
A <- A + alpha * np.dot(x,x.T)
:param A: Symmetric NxN np.array
:param x: Nx1 np.array
:param alpha: scalar
"""
At = blas.dsyr(lower=0, x=x, a=A, alpha=alpha, overwrite_a=False) #See https://github.com/sci... | [
"Performs",
"a",
"symmetric",
"rank",
"-",
"1",
"update",
"operation",
":",
"A",
"<",
"-",
"A",
"+",
"alpha",
"*",
"np",
".",
"dot",
"(",
"x",
"x",
".",
"T",
")"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L325-L337 | [
"def",
"DSYR_blas",
"(",
"A",
",",
"x",
",",
"alpha",
"=",
"1.",
")",
":",
"At",
"=",
"blas",
".",
"dsyr",
"(",
"lower",
"=",
"0",
",",
"x",
"=",
"x",
",",
"a",
"=",
"A",
",",
"alpha",
"=",
"alpha",
",",
"overwrite_a",
"=",
"False",
")",
"#... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | DSYR_numpy | Performs a symmetric rank-1 update operation:
A <- A + alpha * np.dot(x,x.T)
:param A: Symmetric NxN np.array
:param x: Nx1 np.array
:param alpha: scalar | GPy/util/linalg.py | def DSYR_numpy(A, x, alpha=1.):
"""
Performs a symmetric rank-1 update operation:
A <- A + alpha * np.dot(x,x.T)
:param A: Symmetric NxN np.array
:param x: Nx1 np.array
:param alpha: scalar
"""
A += alpha * np.dot(x[:, None], x[None, :]) | def DSYR_numpy(A, x, alpha=1.):
"""
Performs a symmetric rank-1 update operation:
A <- A + alpha * np.dot(x,x.T)
:param A: Symmetric NxN np.array
:param x: Nx1 np.array
:param alpha: scalar
"""
A += alpha * np.dot(x[:, None], x[None, :]) | [
"Performs",
"a",
"symmetric",
"rank",
"-",
"1",
"update",
"operation",
":",
"A",
"<",
"-",
"A",
"+",
"alpha",
"*",
"np",
".",
"dot",
"(",
"x",
"x",
".",
"T",
")"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L339-L349 | [
"def",
"DSYR_numpy",
"(",
"A",
",",
"x",
",",
"alpha",
"=",
"1.",
")",
":",
"A",
"+=",
"alpha",
"*",
"np",
".",
"dot",
"(",
"x",
"[",
":",
",",
"None",
"]",
",",
"x",
"[",
"None",
",",
":",
"]",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | symmetrify | Take the square matrix A and make it symmetrical by copting elements from
the lower half to the upper
works IN PLACE.
note: tries to use cython, falls back to a slower numpy version | GPy/util/linalg.py | def symmetrify(A, upper=False):
"""
Take the square matrix A and make it symmetrical by copting elements from
the lower half to the upper
works IN PLACE.
note: tries to use cython, falls back to a slower numpy version
"""
if use_linalg_cython:
_symmetrify_cython(A, upper)
else:... | def symmetrify(A, upper=False):
"""
Take the square matrix A and make it symmetrical by copting elements from
the lower half to the upper
works IN PLACE.
note: tries to use cython, falls back to a slower numpy version
"""
if use_linalg_cython:
_symmetrify_cython(A, upper)
else:... | [
"Take",
"the",
"square",
"matrix",
"A",
"and",
"make",
"it",
"symmetrical",
"by",
"copting",
"elements",
"from",
"the",
"lower",
"half",
"to",
"the",
"upper"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L356-L368 | [
"def",
"symmetrify",
"(",
"A",
",",
"upper",
"=",
"False",
")",
":",
"if",
"use_linalg_cython",
":",
"_symmetrify_cython",
"(",
"A",
",",
"upper",
")",
"else",
":",
"_symmetrify_numpy",
"(",
"A",
",",
"upper",
")"
] | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | backsub_both_sides | Return L^-T * X * L^-1, assumuing X is symmetrical and L is lower cholesky | GPy/util/linalg.py | def backsub_both_sides(L, X, transpose='left'):
"""
Return L^-T * X * L^-1, assumuing X is symmetrical and L is lower cholesky
"""
if transpose == 'left':
tmp, _ = dtrtrs(L, X, lower=1, trans=1)
return dtrtrs(L, tmp.T, lower=1, trans=1)[0].T
else:
tmp, _ = dtrtrs(L, X, lower=... | def backsub_both_sides(L, X, transpose='left'):
"""
Return L^-T * X * L^-1, assumuing X is symmetrical and L is lower cholesky
"""
if transpose == 'left':
tmp, _ = dtrtrs(L, X, lower=1, trans=1)
return dtrtrs(L, tmp.T, lower=1, trans=1)[0].T
else:
tmp, _ = dtrtrs(L, X, lower=... | [
"Return",
"L^",
"-",
"T",
"*",
"X",
"*",
"L^",
"-",
"1",
"assumuing",
"X",
"is",
"symmetrical",
"and",
"L",
"is",
"lower",
"cholesky"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L381-L390 | [
"def",
"backsub_both_sides",
"(",
"L",
",",
"X",
",",
"transpose",
"=",
"'left'",
")",
":",
"if",
"transpose",
"==",
"'left'",
":",
"tmp",
",",
"_",
"=",
"dtrtrs",
"(",
"L",
",",
"X",
",",
"lower",
"=",
"1",
",",
"trans",
"=",
"1",
")",
"return",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | ij_jlk_to_ilk | Faster version of einsum 'ij,jlk->ilk' | GPy/util/linalg.py | def ij_jlk_to_ilk(A, B):
"""
Faster version of einsum 'ij,jlk->ilk'
"""
return A.dot(B.reshape(B.shape[0], -1)).reshape(A.shape[0], B.shape[1], B.shape[2]) | def ij_jlk_to_ilk(A, B):
"""
Faster version of einsum 'ij,jlk->ilk'
"""
return A.dot(B.reshape(B.shape[0], -1)).reshape(A.shape[0], B.shape[1], B.shape[2]) | [
"Faster",
"version",
"of",
"einsum",
"ij",
"jlk",
"-",
">",
"ilk"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L392-L396 | [
"def",
"ij_jlk_to_ilk",
"(",
"A",
",",
"B",
")",
":",
"return",
"A",
".",
"dot",
"(",
"B",
".",
"reshape",
"(",
"B",
".",
"shape",
"[",
"0",
"]",
",",
"-",
"1",
")",
")",
".",
"reshape",
"(",
"A",
".",
"shape",
"[",
"0",
"]",
",",
"B",
".... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | ijk_jlk_to_il | Faster version of einsum einsum('ijk,jlk->il', A,B) | GPy/util/linalg.py | def ijk_jlk_to_il(A, B):
"""
Faster version of einsum einsum('ijk,jlk->il', A,B)
"""
res = np.zeros((A.shape[0], B.shape[1]))
[np.add(np.dot(A[:,:,k], B[:,:,k]), res, out=res) for k in range(B.shape[-1])]
return res | def ijk_jlk_to_il(A, B):
"""
Faster version of einsum einsum('ijk,jlk->il', A,B)
"""
res = np.zeros((A.shape[0], B.shape[1]))
[np.add(np.dot(A[:,:,k], B[:,:,k]), res, out=res) for k in range(B.shape[-1])]
return res | [
"Faster",
"version",
"of",
"einsum",
"einsum",
"(",
"ijk",
"jlk",
"-",
">",
"il",
"A",
"B",
")"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L398-L404 | [
"def",
"ijk_jlk_to_il",
"(",
"A",
",",
"B",
")",
":",
"res",
"=",
"np",
".",
"zeros",
"(",
"(",
"A",
".",
"shape",
"[",
"0",
"]",
",",
"B",
".",
"shape",
"[",
"1",
"]",
")",
")",
"[",
"np",
".",
"add",
"(",
"np",
".",
"dot",
"(",
"A",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | ijk_ljk_to_ilk | Faster version of einsum np.einsum('ijk,ljk->ilk', A, B)
I.e A.dot(B.T) for every dimension | GPy/util/linalg.py | def ijk_ljk_to_ilk(A, B):
"""
Faster version of einsum np.einsum('ijk,ljk->ilk', A, B)
I.e A.dot(B.T) for every dimension
"""
res = np.zeros((A.shape[-1], A.shape[0], B.shape[0]))
[np.dot(A[:,:,i], B[:,:,i].T, out=res[i,:,:]) for i in range(A.shape[-1])]
res = res.swapaxes(0, 2).swapaxes(0,... | def ijk_ljk_to_ilk(A, B):
"""
Faster version of einsum np.einsum('ijk,ljk->ilk', A, B)
I.e A.dot(B.T) for every dimension
"""
res = np.zeros((A.shape[-1], A.shape[0], B.shape[0]))
[np.dot(A[:,:,i], B[:,:,i].T, out=res[i,:,:]) for i in range(A.shape[-1])]
res = res.swapaxes(0, 2).swapaxes(0,... | [
"Faster",
"version",
"of",
"einsum",
"np",
".",
"einsum",
"(",
"ijk",
"ljk",
"-",
">",
"ilk",
"A",
"B",
")"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/linalg.py#L406-L415 | [
"def",
"ijk_ljk_to_ilk",
"(",
"A",
",",
"B",
")",
":",
"res",
"=",
"np",
".",
"zeros",
"(",
"(",
"A",
".",
"shape",
"[",
"-",
"1",
"]",
",",
"A",
".",
"shape",
"[",
"0",
"]",
",",
"B",
".",
"shape",
"[",
"0",
"]",
")",
")",
"[",
"np",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | load | Load a previously pickled model, using `m.pickle('path/to/file.pickle)'
:param file_name: path/to/file.pickle | GPy/__init__.py | def load(file_or_path):
"""
Load a previously pickled model, using `m.pickle('path/to/file.pickle)'
:param file_name: path/to/file.pickle
"""
# This is the pickling pain when changing _src -> src
import sys
import inspect
sys.modules['GPy.kern._src'] = kern.src
for name, module in i... | def load(file_or_path):
"""
Load a previously pickled model, using `m.pickle('path/to/file.pickle)'
:param file_name: path/to/file.pickle
"""
# This is the pickling pain when changing _src -> src
import sys
import inspect
sys.modules['GPy.kern._src'] = kern.src
for name, module in i... | [
"Load",
"a",
"previously",
"pickled",
"model",
"using",
"m",
".",
"pickle",
"(",
"path",
"/",
"to",
"/",
"file",
".",
"pickle",
")"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/__init__.py#L46-L61 | [
"def",
"load",
"(",
"file_or_path",
")",
":",
"# This is the pickling pain when changing _src -> src",
"import",
"sys",
"import",
"inspect",
"sys",
".",
"modules",
"[",
"'GPy.kern._src'",
"]",
"=",
"kern",
".",
"src",
"for",
"name",
",",
"module",
"in",
"inspect",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | quadvgk | numpy implementation makes use of the code here: http://se.mathworks.com/matlabcentral/fileexchange/18801-quadvgk
We here use gaussian kronrod integration already used in gpstuff for evaluating one dimensional integrals.
This is vectorised quadrature which means that several functions can be evaluated at the sa... | GPy/util/quad_integrate.py | def quadvgk(feval, fmin, fmax, tol1=1e-5, tol2=1e-5):
"""
numpy implementation makes use of the code here: http://se.mathworks.com/matlabcentral/fileexchange/18801-quadvgk
We here use gaussian kronrod integration already used in gpstuff for evaluating one dimensional integrals.
This is vectorised quadra... | def quadvgk(feval, fmin, fmax, tol1=1e-5, tol2=1e-5):
"""
numpy implementation makes use of the code here: http://se.mathworks.com/matlabcentral/fileexchange/18801-quadvgk
We here use gaussian kronrod integration already used in gpstuff for evaluating one dimensional integrals.
This is vectorised quadra... | [
"numpy",
"implementation",
"makes",
"use",
"of",
"the",
"code",
"here",
":",
"http",
":",
"//",
"se",
".",
"mathworks",
".",
"com",
"/",
"matlabcentral",
"/",
"fileexchange",
"/",
"18801",
"-",
"quadvgk",
"We",
"here",
"use",
"gaussian",
"kronrod",
"integr... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/quad_integrate.py#L24-L94 | [
"def",
"quadvgk",
"(",
"feval",
",",
"fmin",
",",
"fmax",
",",
"tol1",
"=",
"1e-5",
",",
"tol2",
"=",
"1e-5",
")",
":",
"XK",
"=",
"np",
".",
"array",
"(",
"[",
"-",
"0.991455371120813",
",",
"-",
"0.949107912342759",
",",
"-",
"0.864864423359769",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | quadgk_int | Integrate f from fmin to fmax,
do integration by substitution
x = r / (1-r**2)
when r goes from -1 to 1 , x goes from -inf to inf.
the interval for quadgk function is from -1 to +1, so we transform the space from (-inf,inf) to (-1,1)
:param f:
:param fmin:
:param fmax:
:param difftol:
... | GPy/util/quad_integrate.py | def quadgk_int(f, fmin=-np.inf, fmax=np.inf, difftol=0.1):
"""
Integrate f from fmin to fmax,
do integration by substitution
x = r / (1-r**2)
when r goes from -1 to 1 , x goes from -inf to inf.
the interval for quadgk function is from -1 to +1, so we transform the space from (-inf,inf) to (-1,1)... | def quadgk_int(f, fmin=-np.inf, fmax=np.inf, difftol=0.1):
"""
Integrate f from fmin to fmax,
do integration by substitution
x = r / (1-r**2)
when r goes from -1 to 1 , x goes from -inf to inf.
the interval for quadgk function is from -1 to +1, so we transform the space from (-inf,inf) to (-1,1)... | [
"Integrate",
"f",
"from",
"fmin",
"to",
"fmax",
"do",
"integration",
"by",
"substitution",
"x",
"=",
"r",
"/",
"(",
"1",
"-",
"r",
"**",
"2",
")",
"when",
"r",
"goes",
"from",
"-",
"1",
"to",
"1",
"x",
"goes",
"from",
"-",
"inf",
"to",
"inf",
"... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/quad_integrate.py#L96-L117 | [
"def",
"quadgk_int",
"(",
"f",
",",
"fmin",
"=",
"-",
"np",
".",
"inf",
",",
"fmax",
"=",
"np",
".",
"inf",
",",
"difftol",
"=",
"0.1",
")",
":",
"difftol",
"=",
"1e-4",
"def",
"trans_func",
"(",
"r",
")",
":",
"r2",
"=",
"np",
".",
"square",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | SpikeAndSlabPrior_SSMRD._update_inernal | Make an update of the internal status by gathering the variational posteriors for all the individual models. | GPy/models/ss_mrd.py | def _update_inernal(self, varp_list):
"""Make an update of the internal status by gathering the variational posteriors for all the individual models."""
# The probability for the binary variable for the same latent dimension of any of the models is on.
if self.group_spike:
self._b_pr... | def _update_inernal(self, varp_list):
"""Make an update of the internal status by gathering the variational posteriors for all the individual models."""
# The probability for the binary variable for the same latent dimension of any of the models is on.
if self.group_spike:
self._b_pr... | [
"Make",
"an",
"update",
"of",
"the",
"internal",
"status",
"by",
"gathering",
"the",
"variational",
"posteriors",
"for",
"all",
"the",
"individual",
"models",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/ss_mrd.py#L162-L170 | [
"def",
"_update_inernal",
"(",
"self",
",",
"varp_list",
")",
":",
"# The probability for the binary variable for the same latent dimension of any of the models is on.",
"if",
"self",
".",
"group_spike",
":",
"self",
".",
"_b_prob_all",
"=",
"1.",
"-",
"param_to_array",
"("... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | IBPPrior_SSMRD._update_inernal | Make an update of the internal status by gathering the variational posteriors for all the individual models. | GPy/models/ss_mrd.py | def _update_inernal(self, varp_list):
"""Make an update of the internal status by gathering the variational posteriors for all the individual models."""
# The probability for the binary variable for the same latent dimension of any of the models is on.
self._b_prob_all = 1.-param_to_array(varp_l... | def _update_inernal(self, varp_list):
"""Make an update of the internal status by gathering the variational posteriors for all the individual models."""
# The probability for the binary variable for the same latent dimension of any of the models is on.
self._b_prob_all = 1.-param_to_array(varp_l... | [
"Make",
"an",
"update",
"of",
"the",
"internal",
"status",
"by",
"gathering",
"the",
"variational",
"posteriors",
"for",
"all",
"the",
"individual",
"models",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/ss_mrd.py#L225-L229 | [
"def",
"_update_inernal",
"(",
"self",
",",
"varp_list",
")",
":",
"# The probability for the binary variable for the same latent dimension of any of the models is on.",
"self",
".",
"_b_prob_all",
"=",
"1.",
"-",
"param_to_array",
"(",
"varp_list",
"[",
"0",
"]",
".",
"g... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Symmetric.K | Compute the covariance matrix between X and X2. | GPy/kern/src/todo/symmetric.py | def K(self,X,X2,target):
"""Compute the covariance matrix between X and X2."""
AX = np.dot(X,self.transform)
if X2 is None:
X2 = X
AX2 = AX
else:
AX2 = np.dot(X2, self.transform)
self.k.K(X,X2,target)
self.k.K(AX,X2,target)
self... | def K(self,X,X2,target):
"""Compute the covariance matrix between X and X2."""
AX = np.dot(X,self.transform)
if X2 is None:
X2 = X
AX2 = AX
else:
AX2 = np.dot(X2, self.transform)
self.k.K(X,X2,target)
self.k.K(AX,X2,target)
self... | [
"Compute",
"the",
"covariance",
"matrix",
"between",
"X",
"and",
"X2",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/symmetric.py#L30-L41 | [
"def",
"K",
"(",
"self",
",",
"X",
",",
"X2",
",",
"target",
")",
":",
"AX",
"=",
"np",
".",
"dot",
"(",
"X",
",",
"self",
".",
"transform",
")",
"if",
"X2",
"is",
"None",
":",
"X2",
"=",
"X",
"AX2",
"=",
"AX",
"else",
":",
"AX2",
"=",
"n... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Symmetric._param_grad_helper | derivative of the covariance matrix with respect to the parameters. | GPy/kern/src/todo/symmetric.py | def _param_grad_helper(self,dL_dK,X,X2,target):
"""derivative of the covariance matrix with respect to the parameters."""
AX = np.dot(X,self.transform)
if X2 is None:
X2 = X
ZX2 = AX
else:
AX2 = np.dot(X2, self.transform)
self.k._param_grad_hel... | def _param_grad_helper(self,dL_dK,X,X2,target):
"""derivative of the covariance matrix with respect to the parameters."""
AX = np.dot(X,self.transform)
if X2 is None:
X2 = X
ZX2 = AX
else:
AX2 = np.dot(X2, self.transform)
self.k._param_grad_hel... | [
"derivative",
"of",
"the",
"covariance",
"matrix",
"with",
"respect",
"to",
"the",
"parameters",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/symmetric.py#L43-L54 | [
"def",
"_param_grad_helper",
"(",
"self",
",",
"dL_dK",
",",
"X",
",",
"X2",
",",
"target",
")",
":",
"AX",
"=",
"np",
".",
"dot",
"(",
"X",
",",
"self",
".",
"transform",
")",
"if",
"X2",
"is",
"None",
":",
"X2",
"=",
"X",
"ZX2",
"=",
"AX",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Symmetric.Kdiag | Compute the diagonal of the covariance matrix associated to X. | GPy/kern/src/todo/symmetric.py | def Kdiag(self,X,target):
"""Compute the diagonal of the covariance matrix associated to X."""
foo = np.zeros((X.shape[0],X.shape[0]))
self.K(X,X,foo)
target += np.diag(foo) | def Kdiag(self,X,target):
"""Compute the diagonal of the covariance matrix associated to X."""
foo = np.zeros((X.shape[0],X.shape[0]))
self.K(X,X,foo)
target += np.diag(foo) | [
"Compute",
"the",
"diagonal",
"of",
"the",
"covariance",
"matrix",
"associated",
"to",
"X",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/symmetric.py#L70-L74 | [
"def",
"Kdiag",
"(",
"self",
",",
"X",
",",
"target",
")",
":",
"foo",
"=",
"np",
".",
"zeros",
"(",
"(",
"X",
".",
"shape",
"[",
"0",
"]",
",",
"X",
".",
"shape",
"[",
"0",
"]",
")",
")",
"self",
".",
"K",
"(",
"X",
",",
"X",
",",
"foo... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | RBFInv.dpsi2_dtheta | Shape N,num_inducing,num_inducing,Ntheta | GPy/kern/src/todo/rbf_inv.py | def dpsi2_dtheta(self, dL_dpsi2, Z, mu, S, target):
"""Shape N,num_inducing,num_inducing,Ntheta"""
self._psi_computations(Z, mu, S)
d_var = 2.*self._psi2 / self.variance
# d_length = 2.*self._psi2[:, :, :, None] * (self._psi2_Zdist_sq * self._psi2_denom + self._psi2_mudist_sq + S[:, None... | def dpsi2_dtheta(self, dL_dpsi2, Z, mu, S, target):
"""Shape N,num_inducing,num_inducing,Ntheta"""
self._psi_computations(Z, mu, S)
d_var = 2.*self._psi2 / self.variance
# d_length = 2.*self._psi2[:, :, :, None] * (self._psi2_Zdist_sq * self._psi2_denom + self._psi2_mudist_sq + S[:, None... | [
"Shape",
"N",
"num_inducing",
"num_inducing",
"Ntheta"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/rbf_inv.py#L199-L210 | [
"def",
"dpsi2_dtheta",
"(",
"self",
",",
"dL_dpsi2",
",",
"Z",
",",
"mu",
",",
"S",
",",
"target",
")",
":",
"self",
".",
"_psi_computations",
"(",
"Z",
",",
"mu",
",",
"S",
")",
"d_var",
"=",
"2.",
"*",
"self",
".",
"_psi2",
"/",
"self",
".",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | RBFInv.dpsi2_dmuS | Think N,num_inducing,num_inducing,input_dim | GPy/kern/src/todo/rbf_inv.py | def dpsi2_dmuS(self, dL_dpsi2, Z, mu, S, target_mu, target_S):
"""Think N,num_inducing,num_inducing,input_dim """
self._psi_computations(Z, mu, S)
tmp = (self.inv_lengthscale2 * self._psi2[:, :, :, None]) / self._psi2_denom
target_mu += -2.*(dL_dpsi2[:, :, :, None] * tmp * self._psi2_mud... | def dpsi2_dmuS(self, dL_dpsi2, Z, mu, S, target_mu, target_S):
"""Think N,num_inducing,num_inducing,input_dim """
self._psi_computations(Z, mu, S)
tmp = (self.inv_lengthscale2 * self._psi2[:, :, :, None]) / self._psi2_denom
target_mu += -2.*(dL_dpsi2[:, :, :, None] * tmp * self._psi2_mud... | [
"Think",
"N",
"num_inducing",
"num_inducing",
"input_dim"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/rbf_inv.py#L220-L225 | [
"def",
"dpsi2_dmuS",
"(",
"self",
",",
"dL_dpsi2",
",",
"Z",
",",
"mu",
",",
"S",
",",
"target_mu",
",",
"target_S",
")",
":",
"self",
".",
"_psi_computations",
"(",
"Z",
",",
"mu",
",",
"S",
")",
"tmp",
"=",
"(",
"self",
".",
"inv_lengthscale2",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | PSICOMP_RBF_GPU._psicomputations | Z - MxQ
mu - NxQ
S - NxQ | GPy/kern/src/psi_comp/rbf_psi_gpucomp.py | def _psicomputations(self, kern, Z, variational_posterior, return_psi2_n=False):
"""
Z - MxQ
mu - NxQ
S - NxQ
"""
variance, lengthscale = kern.variance, kern.lengthscale
N,M,Q = self.get_dimensions(Z, variational_posterior)
self._initGPUCache(N,M,Q)
... | def _psicomputations(self, kern, Z, variational_posterior, return_psi2_n=False):
"""
Z - MxQ
mu - NxQ
S - NxQ
"""
variance, lengthscale = kern.variance, kern.lengthscale
N,M,Q = self.get_dimensions(Z, variational_posterior)
self._initGPUCache(N,M,Q)
... | [
"Z",
"-",
"MxQ",
"mu",
"-",
"NxQ",
"S",
"-",
"NxQ"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/psi_comp/rbf_psi_gpucomp.py#L328-L364 | [
"def",
"_psicomputations",
"(",
"self",
",",
"kern",
",",
"Z",
",",
"variational_posterior",
",",
"return_psi2_n",
"=",
"False",
")",
":",
"variance",
",",
"lengthscale",
"=",
"kern",
".",
"variance",
",",
"kern",
".",
"lengthscale",
"N",
",",
"M",
",",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | VarDTC_SVI_Multiout.inference | The SVI-VarDTC inference | GPy/inference/latent_function_inference/vardtc_svi_multiout.py | def inference(self, kern_r, kern_c, Xr, Xc, Zr, Zc, likelihood, Y, qU_mean ,qU_var_r, qU_var_c):
"""
The SVI-VarDTC inference
"""
N, D, Mr, Mc, Qr, Qc = Y.shape[0], Y.shape[1], Zr.shape[0], Zc.shape[0], Zr.shape[1], Zc.shape[1]
uncertain_inputs_r = isinstance(Xr, VariationalPos... | def inference(self, kern_r, kern_c, Xr, Xc, Zr, Zc, likelihood, Y, qU_mean ,qU_var_r, qU_var_c):
"""
The SVI-VarDTC inference
"""
N, D, Mr, Mc, Qr, Qc = Y.shape[0], Y.shape[1], Zr.shape[0], Zc.shape[0], Zr.shape[1], Zc.shape[1]
uncertain_inputs_r = isinstance(Xr, VariationalPos... | [
"The",
"SVI",
"-",
"VarDTC",
"inference"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/vardtc_svi_multiout.py#L42-L206 | [
"def",
"inference",
"(",
"self",
",",
"kern_r",
",",
"kern_c",
",",
"Xr",
",",
"Xc",
",",
"Zr",
",",
"Zc",
",",
"likelihood",
",",
"Y",
",",
"qU_mean",
",",
"qU_var_r",
",",
"qU_var_c",
")",
":",
"N",
",",
"D",
",",
"Mr",
",",
"Mc",
",",
"Qr",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Priorizable.set_prior | Set the prior for this object to prior.
:param :class:`~GPy.priors.Prior` prior: a prior to set for this parameter
:param bool warning: whether to warn if another prior was set for this parameter | GPy/core/parameterization/priorizable.py | def set_prior(self, prior, warning=True):
"""
Set the prior for this object to prior.
:param :class:`~GPy.priors.Prior` prior: a prior to set for this parameter
:param bool warning: whether to warn if another prior was set for this parameter
"""
repriorized = self.unset_p... | def set_prior(self, prior, warning=True):
"""
Set the prior for this object to prior.
:param :class:`~GPy.priors.Prior` prior: a prior to set for this parameter
:param bool warning: whether to warn if another prior was set for this parameter
"""
repriorized = self.unset_p... | [
"Set",
"the",
"prior",
"for",
"this",
"object",
"to",
"prior",
".",
":",
"param",
":",
"class",
":",
"~GPy",
".",
"priors",
".",
"Prior",
"prior",
":",
"a",
"prior",
"to",
"set",
"for",
"this",
"parameter",
":",
"param",
"bool",
"warning",
":",
"whet... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/parameterization/priorizable.py#L25-L41 | [
"def",
"set_prior",
"(",
"self",
",",
"prior",
",",
"warning",
"=",
"True",
")",
":",
"repriorized",
"=",
"self",
".",
"unset_priors",
"(",
")",
"self",
".",
"_add_to_index_operations",
"(",
"self",
".",
"priors",
",",
"repriorized",
",",
"prior",
",",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Priorizable.log_prior | evaluate the prior | GPy/core/parameterization/priorizable.py | def log_prior(self):
"""evaluate the prior"""
if self.priors.size == 0:
return 0.
x = self.param_array
#evaluate the prior log densities
log_p = reduce(lambda a, b: a + b, (p.lnpdf(x[ind]).sum() for p, ind in self.priors.items()), 0)
#account for the transfor... | def log_prior(self):
"""evaluate the prior"""
if self.priors.size == 0:
return 0.
x = self.param_array
#evaluate the prior log densities
log_p = reduce(lambda a, b: a + b, (p.lnpdf(x[ind]).sum() for p, ind in self.priors.items()), 0)
#account for the transfor... | [
"evaluate",
"the",
"prior"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/parameterization/priorizable.py#L49-L65 | [
"def",
"log_prior",
"(",
"self",
")",
":",
"if",
"self",
".",
"priors",
".",
"size",
"==",
"0",
":",
"return",
"0.",
"x",
"=",
"self",
".",
"param_array",
"#evaluate the prior log densities",
"log_p",
"=",
"reduce",
"(",
"lambda",
"a",
",",
"b",
":",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | Priorizable._log_prior_gradients | evaluate the gradients of the priors | GPy/core/parameterization/priorizable.py | def _log_prior_gradients(self):
"""evaluate the gradients of the priors"""
if self.priors.size == 0:
return 0.
x = self.param_array
ret = np.zeros(x.size)
#compute derivate of prior density
[np.put(ret, ind, p.lnpdf_grad(x[ind])) for p, ind in self.priors.item... | def _log_prior_gradients(self):
"""evaluate the gradients of the priors"""
if self.priors.size == 0:
return 0.
x = self.param_array
ret = np.zeros(x.size)
#compute derivate of prior density
[np.put(ret, ind, p.lnpdf_grad(x[ind])) for p, ind in self.priors.item... | [
"evaluate",
"the",
"gradients",
"of",
"the",
"priors"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/parameterization/priorizable.py#L67-L82 | [
"def",
"_log_prior_gradients",
"(",
"self",
")",
":",
"if",
"self",
".",
"priors",
".",
"size",
"==",
"0",
":",
"return",
"0.",
"x",
"=",
"self",
".",
"param_array",
"ret",
"=",
"np",
".",
"zeros",
"(",
"x",
".",
"size",
")",
"#compute derivate of prio... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | RegressionMethod._preprocess | Zero-mean, unit-variance normalization by default | benchmarks/regression/methods.py | def _preprocess(self, data, train):
"""Zero-mean, unit-variance normalization by default"""
if train:
inputs, labels = data
self.data_mean = inputs.mean(axis=0)
self.data_std = inputs.std(axis=0)
self.labels_mean = labels.mean(axis=0)
self.lab... | def _preprocess(self, data, train):
"""Zero-mean, unit-variance normalization by default"""
if train:
inputs, labels = data
self.data_mean = inputs.mean(axis=0)
self.data_std = inputs.std(axis=0)
self.labels_mean = labels.mean(axis=0)
self.lab... | [
"Zero",
"-",
"mean",
"unit",
"-",
"variance",
"normalization",
"by",
"default"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/benchmarks/regression/methods.py#L14-L24 | [
"def",
"_preprocess",
"(",
"self",
",",
"data",
",",
"train",
")",
":",
"if",
"train",
":",
"inputs",
",",
"labels",
"=",
"data",
"self",
".",
"data_mean",
"=",
"inputs",
".",
"mean",
"(",
"axis",
"=",
"0",
")",
"self",
".",
"data_std",
"=",
"input... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | get_blocks_3d | Given a 3d matrix, make a block matrix, where the first and second dimensions are blocked according
to blocksizes, and the pages are blocked using pagesizes | GPy/util/block_matrices.py | def get_blocks_3d(A, blocksizes, pagesizes=None):
"""
Given a 3d matrix, make a block matrix, where the first and second dimensions are blocked according
to blocksizes, and the pages are blocked using pagesizes
"""
assert (A.shape[0]==A.shape[1]) and len(A.shape)==3, "can't blockify this non-square ... | def get_blocks_3d(A, blocksizes, pagesizes=None):
"""
Given a 3d matrix, make a block matrix, where the first and second dimensions are blocked according
to blocksizes, and the pages are blocked using pagesizes
"""
assert (A.shape[0]==A.shape[1]) and len(A.shape)==3, "can't blockify this non-square ... | [
"Given",
"a",
"3d",
"matrix",
"make",
"a",
"block",
"matrix",
"where",
"the",
"first",
"and",
"second",
"dimensions",
"are",
"blocked",
"according",
"to",
"blocksizes",
"and",
"the",
"pages",
"are",
"blocked",
"using",
"pagesizes"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/block_matrices.py#L5-L31 | [
"def",
"get_blocks_3d",
"(",
"A",
",",
"blocksizes",
",",
"pagesizes",
"=",
"None",
")",
":",
"assert",
"(",
"A",
".",
"shape",
"[",
"0",
"]",
"==",
"A",
".",
"shape",
"[",
"1",
"]",
")",
"and",
"len",
"(",
"A",
".",
"shape",
")",
"==",
"3",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | block_dot | Element wise dot product on block matricies
+------+------+ +------+------+ +-------+-------+
| | | | | | |A11.B11|B12.B12|
| A11 | A12 | | B11 | B12 | | | |
+------+------+ o +------+------| = +-------+-------+
| | | | | | ... | GPy/util/block_matrices.py | def block_dot(A, B, diagonal=False):
"""
Element wise dot product on block matricies
+------+------+ +------+------+ +-------+-------+
| | | | | | |A11.B11|B12.B12|
| A11 | A12 | | B11 | B12 | | | |
+------+------+ o +------+------| = +-------... | def block_dot(A, B, diagonal=False):
"""
Element wise dot product on block matricies
+------+------+ +------+------+ +-------+-------+
| | | | | | |A11.B11|B12.B12|
| A11 | A12 | | B11 | B12 | | | |
+------+------+ o +------+------| = +-------... | [
"Element",
"wise",
"dot",
"product",
"on",
"block",
"matricies"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/block_matrices.py#L71-L109 | [
"def",
"block_dot",
"(",
"A",
",",
"B",
",",
"diagonal",
"=",
"False",
")",
":",
"#Must have same number of blocks and be a block matrix",
"assert",
"A",
".",
"dtype",
"is",
"np",
".",
"dtype",
"(",
"'object'",
")",
",",
"\"Must be a block matrix\"",
"assert",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | oil | Run a Gaussian process classification on the three phase oil data. The demonstration calls the basic GP classification model and uses EP to approximate the likelihood. | GPy/examples/classification.py | def oil(num_inducing=50, max_iters=100, kernel=None, optimize=True, plot=True):
"""
Run a Gaussian process classification on the three phase oil data. The demonstration calls the basic GP classification model and uses EP to approximate the likelihood.
"""
try:import pods
except ImportError:raise Im... | def oil(num_inducing=50, max_iters=100, kernel=None, optimize=True, plot=True):
"""
Run a Gaussian process classification on the three phase oil data. The demonstration calls the basic GP classification model and uses EP to approximate the likelihood.
"""
try:import pods
except ImportError:raise Im... | [
"Run",
"a",
"Gaussian",
"process",
"classification",
"on",
"the",
"three",
"phase",
"oil",
"data",
".",
"The",
"demonstration",
"calls",
"the",
"basic",
"GP",
"classification",
"model",
"and",
"uses",
"EP",
"to",
"approximate",
"the",
"likelihood",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/classification.py#L10-L41 | [
"def",
"oil",
"(",
"num_inducing",
"=",
"50",
",",
"max_iters",
"=",
"100",
",",
"kernel",
"=",
"None",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"try",
":",
"import",
"pods",
"except",
"ImportError",
":",
"raise",
"ImportWarnin... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | toy_linear_1d_classification | Simple 1D classification example using EP approximation
:param seed: seed value for data generation (default is 4).
:type seed: int | GPy/examples/classification.py | def toy_linear_1d_classification(seed=default_seed, optimize=True, plot=True):
"""
Simple 1D classification example using EP approximation
:param seed: seed value for data generation (default is 4).
:type seed: int
"""
try:import pods
except ImportError:raise ImportWarning('Need pods for e... | def toy_linear_1d_classification(seed=default_seed, optimize=True, plot=True):
"""
Simple 1D classification example using EP approximation
:param seed: seed value for data generation (default is 4).
:type seed: int
"""
try:import pods
except ImportError:raise ImportWarning('Need pods for e... | [
"Simple",
"1D",
"classification",
"example",
"using",
"EP",
"approximation"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/classification.py#L43-L76 | [
"def",
"toy_linear_1d_classification",
"(",
"seed",
"=",
"default_seed",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"try",
":",
"import",
"pods",
"except",
"ImportError",
":",
"raise",
"ImportWarning",
"(",
"'Need pods for example datasets. ... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | toy_linear_1d_classification_laplace | Simple 1D classification example using Laplace approximation
:param seed: seed value for data generation (default is 4).
:type seed: int | GPy/examples/classification.py | def toy_linear_1d_classification_laplace(seed=default_seed, optimize=True, plot=True):
"""
Simple 1D classification example using Laplace approximation
:param seed: seed value for data generation (default is 4).
:type seed: int
"""
try:import pods
except ImportError:print('pods unavailabl... | def toy_linear_1d_classification_laplace(seed=default_seed, optimize=True, plot=True):
"""
Simple 1D classification example using Laplace approximation
:param seed: seed value for data generation (default is 4).
:type seed: int
"""
try:import pods
except ImportError:print('pods unavailabl... | [
"Simple",
"1D",
"classification",
"example",
"using",
"Laplace",
"approximation"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/classification.py#L78-L115 | [
"def",
"toy_linear_1d_classification_laplace",
"(",
"seed",
"=",
"default_seed",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"try",
":",
"import",
"pods",
"except",
"ImportError",
":",
"print",
"(",
"'pods unavailable, see https://github.com/so... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | sparse_toy_linear_1d_classification_uncertain_input | Sparse 1D classification example
:param seed: seed value for data generation (default is 4).
:type seed: int | GPy/examples/classification.py | def sparse_toy_linear_1d_classification_uncertain_input(num_inducing=10, seed=default_seed, optimize=True, plot=True):
"""
Sparse 1D classification example
:param seed: seed value for data generation (default is 4).
:type seed: int
"""
try:import pods
except ImportError:print('pods unavai... | def sparse_toy_linear_1d_classification_uncertain_input(num_inducing=10, seed=default_seed, optimize=True, plot=True):
"""
Sparse 1D classification example
:param seed: seed value for data generation (default is 4).
:type seed: int
"""
try:import pods
except ImportError:print('pods unavai... | [
"Sparse",
"1D",
"classification",
"example"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/classification.py#L150-L184 | [
"def",
"sparse_toy_linear_1d_classification_uncertain_input",
"(",
"num_inducing",
"=",
"10",
",",
"seed",
"=",
"default_seed",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"try",
":",
"import",
"pods",
"except",
"ImportError",
":",
"print",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | toy_heaviside | Simple 1D classification example using a heavy side gp transformation
:param seed: seed value for data generation (default is 4).
:type seed: int | GPy/examples/classification.py | def toy_heaviside(seed=default_seed, max_iters=100, optimize=True, plot=True):
"""
Simple 1D classification example using a heavy side gp transformation
:param seed: seed value for data generation (default is 4).
:type seed: int
"""
try:import pods
except ImportError:print('pods unavailab... | def toy_heaviside(seed=default_seed, max_iters=100, optimize=True, plot=True):
"""
Simple 1D classification example using a heavy side gp transformation
:param seed: seed value for data generation (default is 4).
:type seed: int
"""
try:import pods
except ImportError:print('pods unavailab... | [
"Simple",
"1D",
"classification",
"example",
"using",
"a",
"heavy",
"side",
"gp",
"transformation"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/classification.py#L186-L223 | [
"def",
"toy_heaviside",
"(",
"seed",
"=",
"default_seed",
",",
"max_iters",
"=",
"100",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"try",
":",
"import",
"pods",
"except",
"ImportError",
":",
"print",
"(",
"'pods unavailable, see https:... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | crescent_data | Run a Gaussian process classification on the crescent data. The demonstration calls the basic GP classification model and uses EP to approximate the likelihood.
:param model_type: type of model to fit ['Full', 'FITC', 'DTC'].
:param inducing: number of inducing variables (only used for 'FITC' or 'DTC').
:t... | GPy/examples/classification.py | def crescent_data(model_type='Full', num_inducing=10, seed=default_seed, kernel=None, optimize=True, plot=True):
"""
Run a Gaussian process classification on the crescent data. The demonstration calls the basic GP classification model and uses EP to approximate the likelihood.
:param model_type: type of mo... | def crescent_data(model_type='Full', num_inducing=10, seed=default_seed, kernel=None, optimize=True, plot=True):
"""
Run a Gaussian process classification on the crescent data. The demonstration calls the basic GP classification model and uses EP to approximate the likelihood.
:param model_type: type of mo... | [
"Run",
"a",
"Gaussian",
"process",
"classification",
"on",
"the",
"crescent",
"data",
".",
"The",
"demonstration",
"calls",
"the",
"basic",
"GP",
"classification",
"model",
"and",
"uses",
"EP",
"to",
"approximate",
"the",
"likelihood",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/classification.py#L225-L260 | [
"def",
"crescent_data",
"(",
"model_type",
"=",
"'Full'",
",",
"num_inducing",
"=",
"10",
",",
"seed",
"=",
"default_seed",
",",
"kernel",
"=",
"None",
",",
"optimize",
"=",
"True",
",",
"plot",
"=",
"True",
")",
":",
"try",
":",
"import",
"pods",
"exc... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | KumarWarping.f | Apply warping_function to some Input data
Parameters:
-----------
X : array_like, shape = (n_samples, n_features)
test_data: bool, optional
Default to False, should set to True when transforming test data
Returns
-------
X_warped : array_like, shape... | GPy/util/input_warping_functions.py | def f(self, X, test_data=False):
"""Apply warping_function to some Input data
Parameters:
-----------
X : array_like, shape = (n_samples, n_features)
test_data: bool, optional
Default to False, should set to True when transforming test data
Returns
... | def f(self, X, test_data=False):
"""Apply warping_function to some Input data
Parameters:
-----------
X : array_like, shape = (n_samples, n_features)
test_data: bool, optional
Default to False, should set to True when transforming test data
Returns
... | [
"Apply",
"warping_function",
"to",
"some",
"Input",
"data"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/input_warping_functions.py#L171-L199 | [
"def",
"f",
"(",
"self",
",",
"X",
",",
"test_data",
"=",
"False",
")",
":",
"X_warped",
"=",
"X",
".",
"copy",
"(",
")",
"if",
"test_data",
":",
"X_normalized",
"=",
"(",
"X",
"-",
"self",
".",
"Xmin",
")",
"/",
"(",
"self",
".",
"Xmax",
"-",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | KumarWarping.fgrad_X | Compute the gradient of warping function with respect to X
Parameters
----------
X : array_like, shape = (n_samples, n_features)
The location to compute gradient
Returns
-------
grad : array_like, shape = (n_samples, n_features)
The gradient for ... | GPy/util/input_warping_functions.py | def fgrad_X(self, X):
"""Compute the gradient of warping function with respect to X
Parameters
----------
X : array_like, shape = (n_samples, n_features)
The location to compute gradient
Returns
-------
grad : array_like, shape = (n_samples, n_featur... | def fgrad_X(self, X):
"""Compute the gradient of warping function with respect to X
Parameters
----------
X : array_like, shape = (n_samples, n_features)
The location to compute gradient
Returns
-------
grad : array_like, shape = (n_samples, n_featur... | [
"Compute",
"the",
"gradient",
"of",
"warping",
"function",
"with",
"respect",
"to",
"X"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/input_warping_functions.py#L201-L223 | [
"def",
"fgrad_X",
"(",
"self",
",",
"X",
")",
":",
"grad",
"=",
"np",
".",
"zeros",
"(",
"X",
".",
"shape",
")",
"for",
"i_seq",
",",
"i_fea",
"in",
"enumerate",
"(",
"self",
".",
"warping_indices",
")",
":",
"a",
",",
"b",
"=",
"self",
".",
"p... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | KumarWarping.update_grads | Update the gradients of marginal log likelihood with respect to the parameters of warping function
Parameters
----------
X : array_like, shape = (n_samples, n_features)
The input BEFORE warping
dL_dW : array_like, shape = (n_samples, n_features)
The gradient of ... | GPy/util/input_warping_functions.py | def update_grads(self, X, dL_dW):
"""Update the gradients of marginal log likelihood with respect to the parameters of warping function
Parameters
----------
X : array_like, shape = (n_samples, n_features)
The input BEFORE warping
dL_dW : array_like, shape = (n_samp... | def update_grads(self, X, dL_dW):
"""Update the gradients of marginal log likelihood with respect to the parameters of warping function
Parameters
----------
X : array_like, shape = (n_samples, n_features)
The input BEFORE warping
dL_dW : array_like, shape = (n_samp... | [
"Update",
"the",
"gradients",
"of",
"marginal",
"log",
"likelihood",
"with",
"respect",
"to",
"the",
"parameters",
"of",
"warping",
"function"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/input_warping_functions.py#L225-L258 | [
"def",
"update_grads",
"(",
"self",
",",
"X",
",",
"dL_dW",
")",
":",
"for",
"i_seq",
",",
"i_fea",
"in",
"enumerate",
"(",
"self",
".",
"warping_indices",
")",
":",
"ai",
",",
"bi",
"=",
"self",
".",
"params",
"[",
"i_seq",
"]",
"[",
"0",
"]",
"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | VarDTC_MD.inference | The first phase of inference:
Compute: log-likelihood, dL_dKmm
Cached intermediate results: Kmm, KmmInv, | GPy/inference/latent_function_inference/vardtc_md.py | def inference(self, kern, X, Z, likelihood, Y, indexD, output_dim, Y_metadata=None, Lm=None, dL_dKmm=None, Kuu_sigma=None):
"""
The first phase of inference:
Compute: log-likelihood, dL_dKmm
Cached intermediate results: Kmm, KmmInv,
"""
input_dim = Z.shape[0]
u... | def inference(self, kern, X, Z, likelihood, Y, indexD, output_dim, Y_metadata=None, Lm=None, dL_dKmm=None, Kuu_sigma=None):
"""
The first phase of inference:
Compute: log-likelihood, dL_dKmm
Cached intermediate results: Kmm, KmmInv,
"""
input_dim = Z.shape[0]
u... | [
"The",
"first",
"phase",
"of",
"inference",
":",
"Compute",
":",
"log",
"-",
"likelihood",
"dL_dKmm"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/vardtc_md.py#L32-L171 | [
"def",
"inference",
"(",
"self",
",",
"kern",
",",
"X",
",",
"Z",
",",
"likelihood",
",",
"Y",
",",
"indexD",
",",
"output_dim",
",",
"Y_metadata",
"=",
"None",
",",
"Lm",
"=",
"None",
",",
"dL_dKmm",
"=",
"None",
",",
"Kuu_sigma",
"=",
"None",
")"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot | Plot latent space X in 1D:
- if fig is given, create input_dim subplots in fig and plot in these
- if ax is given plot input_dim 1D latent space plots of X into each `axis`
- if neither fig nor ax is given create a figure with fignum and plot in there
colors:
colors of different la... | GPy/plotting/matplot_dep/variational_plots.py | def plot(parameterized, fignum=None, ax=None, colors=None, figsize=(12, 6)):
"""
Plot latent space X in 1D:
- if fig is given, create input_dim subplots in fig and plot in these
- if ax is given plot input_dim 1D latent space plots of X into each `axis`
- if neither fig nor ax is given ... | def plot(parameterized, fignum=None, ax=None, colors=None, figsize=(12, 6)):
"""
Plot latent space X in 1D:
- if fig is given, create input_dim subplots in fig and plot in these
- if ax is given plot input_dim 1D latent space plots of X into each `axis`
- if neither fig nor ax is given ... | [
"Plot",
"latent",
"space",
"X",
"in",
"1D",
":"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/variational_plots.py#L3-L49 | [
"def",
"plot",
"(",
"parameterized",
",",
"fignum",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"colors",
"=",
"None",
",",
"figsize",
"=",
"(",
"12",
",",
"6",
")",
")",
":",
"if",
"ax",
"is",
"None",
":",
"fig",
"=",
"pb",
".",
"figure",
"(",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_SpikeSlab | Plot latent space X in 1D:
- if fig is given, create input_dim subplots in fig and plot in these
- if ax is given plot input_dim 1D latent space plots of X into each `axis`
- if neither fig nor ax is given create a figure with fignum and plot in there
colors:
colors of different la... | GPy/plotting/matplot_dep/variational_plots.py | def plot_SpikeSlab(parameterized, fignum=None, ax=None, colors=None, side_by_side=True):
"""
Plot latent space X in 1D:
- if fig is given, create input_dim subplots in fig and plot in these
- if ax is given plot input_dim 1D latent space plots of X into each `axis`
- if neither fig nor ... | def plot_SpikeSlab(parameterized, fignum=None, ax=None, colors=None, side_by_side=True):
"""
Plot latent space X in 1D:
- if fig is given, create input_dim subplots in fig and plot in these
- if ax is given plot input_dim 1D latent space plots of X into each `axis`
- if neither fig nor ... | [
"Plot",
"latent",
"space",
"X",
"in",
"1D",
":"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/variational_plots.py#L51-L106 | [
"def",
"plot_SpikeSlab",
"(",
"parameterized",
",",
"fignum",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"colors",
"=",
"None",
",",
"side_by_side",
"=",
"True",
")",
":",
"if",
"ax",
"is",
"None",
":",
"if",
"side_by_side",
":",
"fig",
"=",
"pb",
"."... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | plot_mapping | Plots the mapping associated with the model.
- In one dimension, the function is plotted.
- In two dimsensions, a contour-plot shows the function
- In higher dimensions, we've not implemented this yet !TODO!
Can plot only part of the data and part of the posterior functions
using which_data a... | GPy/plotting/matplot_dep/mapping_plots.py | def plot_mapping(self, plot_limits=None, which_data='all', which_parts='all', resolution=None, levels=20, samples=0, fignum=None, ax=None, fixed_inputs=[], linecol=Tango.colorsHex['darkBlue']):
"""
Plots the mapping associated with the model.
- In one dimension, the function is plotted.
- In two dim... | def plot_mapping(self, plot_limits=None, which_data='all', which_parts='all', resolution=None, levels=20, samples=0, fignum=None, ax=None, fixed_inputs=[], linecol=Tango.colorsHex['darkBlue']):
"""
Plots the mapping associated with the model.
- In one dimension, the function is plotted.
- In two dim... | [
"Plots",
"the",
"mapping",
"associated",
"with",
"the",
"model",
".",
"-",
"In",
"one",
"dimension",
"the",
"function",
"is",
"plotted",
".",
"-",
"In",
"two",
"dimsensions",
"a",
"contour",
"-",
"plot",
"shows",
"the",
"function",
"-",
"In",
"higher",
"... | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/mapping_plots.py#L12-L84 | [
"def",
"plot_mapping",
"(",
"self",
",",
"plot_limits",
"=",
"None",
",",
"which_data",
"=",
"'all'",
",",
"which_parts",
"=",
"'all'",
",",
"resolution",
"=",
"None",
",",
"levels",
"=",
"20",
",",
"samples",
"=",
"0",
",",
"fignum",
"=",
"None",
",",... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | StateSpace.parameters_changed | Parameters have now changed | GPy/models/state_space_model.py | def parameters_changed(self):
"""
Parameters have now changed
"""
#np.set_printoptions(16)
#print(self.param_array)
# Get the model matrices from the kernel
(F,L,Qc,H,P_inf, P0, dFt,dQct,dP_inft, dP0t) = self.kern.sde()
# neces... | def parameters_changed(self):
"""
Parameters have now changed
"""
#np.set_printoptions(16)
#print(self.param_array)
# Get the model matrices from the kernel
(F,L,Qc,H,P_inf, P0, dFt,dQct,dP_inft, dP0t) = self.kern.sde()
# neces... | [
"Parameters",
"have",
"now",
"changed"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_model.py#L92-L169 | [
"def",
"parameters_changed",
"(",
"self",
")",
":",
"#np.set_printoptions(16)",
"#print(self.param_array)",
"# Get the model matrices from the kernel",
"(",
"F",
",",
"L",
",",
"Qc",
",",
"H",
",",
"P_inf",
",",
"P0",
",",
"dFt",
",",
"dQct",
",",
"dP_inft",
","... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | StateSpace._raw_predict | Performs the actual prediction for new X points.
Inner function. It is called only from inside this class.
Input:
---------------------
Xnews: vector or (n_points,1) matrix
New time points where to evaluate predictions.
Ynews: (n_train_points, ts_no) matrix
... | GPy/models/state_space_model.py | def _raw_predict(self, Xnew=None, Ynew=None, filteronly=False, p_balance=False, **kw):
"""
Performs the actual prediction for new X points.
Inner function. It is called only from inside this class.
Input:
---------------------
Xnews: vector or (n_points,1) matrix
... | def _raw_predict(self, Xnew=None, Ynew=None, filteronly=False, p_balance=False, **kw):
"""
Performs the actual prediction for new X points.
Inner function. It is called only from inside this class.
Input:
---------------------
Xnews: vector or (n_points,1) matrix
... | [
"Performs",
"the",
"actual",
"prediction",
"for",
"new",
"X",
"points",
".",
"Inner",
"function",
".",
"It",
"is",
"called",
"only",
"from",
"inside",
"this",
"class",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_model.py#L174-L282 | [
"def",
"_raw_predict",
"(",
"self",
",",
"Xnew",
"=",
"None",
",",
"Ynew",
"=",
"None",
",",
"filteronly",
"=",
"False",
",",
"p_balance",
"=",
"False",
",",
"*",
"*",
"kw",
")",
":",
"# Set defaults",
"if",
"Ynew",
"is",
"None",
":",
"Ynew",
"=",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | StateSpace.predict | Inputs:
------------------
balance: bool
Whether to balance or not the model as a whole | GPy/models/state_space_model.py | def predict(self, Xnew=None, filteronly=False, include_likelihood=True, balance=None, **kw):
"""
Inputs:
------------------
balance: bool
Whether to balance or not the model as a whole
"""
if balance is None:
p_balance = self... | def predict(self, Xnew=None, filteronly=False, include_likelihood=True, balance=None, **kw):
"""
Inputs:
------------------
balance: bool
Whether to balance or not the model as a whole
"""
if balance is None:
p_balance = self... | [
"Inputs",
":",
"------------------",
"balance",
":",
"bool",
"Whether",
"to",
"balance",
"or",
"not",
"the",
"model",
"as",
"a",
"whole"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_model.py#L284-L311 | [
"def",
"predict",
"(",
"self",
",",
"Xnew",
"=",
"None",
",",
"filteronly",
"=",
"False",
",",
"include_likelihood",
"=",
"True",
",",
"balance",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"if",
"balance",
"is",
"None",
":",
"p_balance",
"=",
"self"... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | StateSpace.predict_quantiles | Inputs:
------------------
balance: bool
Whether to balance or not the model as a whole | GPy/models/state_space_model.py | def predict_quantiles(self, Xnew=None, quantiles=(2.5, 97.5), balance=None, **kw):
"""
Inputs:
------------------
balance: bool
Whether to balance or not the model as a whole
"""
if balance is None:
p_balance = self.balance
el... | def predict_quantiles(self, Xnew=None, quantiles=(2.5, 97.5), balance=None, **kw):
"""
Inputs:
------------------
balance: bool
Whether to balance or not the model as a whole
"""
if balance is None:
p_balance = self.balance
el... | [
"Inputs",
":",
"------------------",
"balance",
":",
"bool",
"Whether",
"to",
"balance",
"or",
"not",
"the",
"model",
"as",
"a",
"whole"
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/state_space_model.py#L313-L330 | [
"def",
"predict_quantiles",
"(",
"self",
",",
"Xnew",
"=",
"None",
",",
"quantiles",
"=",
"(",
"2.5",
",",
"97.5",
")",
",",
"balance",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"if",
"balance",
"is",
"None",
":",
"p_balance",
"=",
"self",
".",
... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
train | data_play | Play a data set using the data_show object given.
:Y: the data set to be visualized.
:param visualizer: the data show objectwhether to display during optimisation
:type visualizer: data_show
Example usage:
This example loads in the CMU mocap database (http://mocap.cs.cmu.edu) subject number 35 mo... | GPy/plotting/matplot_dep/visualize.py | def data_play(Y, visualizer, frame_rate=30):
"""Play a data set using the data_show object given.
:Y: the data set to be visualized.
:param visualizer: the data show objectwhether to display during optimisation
:type visualizer: data_show
Example usage:
This example loads in the CMU mocap dat... | def data_play(Y, visualizer, frame_rate=30):
"""Play a data set using the data_show object given.
:Y: the data set to be visualized.
:param visualizer: the data show objectwhether to display during optimisation
:type visualizer: data_show
Example usage:
This example loads in the CMU mocap dat... | [
"Play",
"a",
"data",
"set",
"using",
"the",
"data_show",
"object",
"given",
"."
] | SheffieldML/GPy | python | https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/visualize.py#L547-L571 | [
"def",
"data_play",
"(",
"Y",
",",
"visualizer",
",",
"frame_rate",
"=",
"30",
")",
":",
"for",
"y",
"in",
"Y",
":",
"visualizer",
".",
"modify",
"(",
"y",
"[",
"None",
",",
":",
"]",
")",
"time",
".",
"sleep",
"(",
"1.",
"/",
"float",
"(",
"fr... | 54c32d79d289d622fb18b898aee65a2a431d90cf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.