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
lvm.modify
When latent values are modified update the latent representation and ulso update the output visualization.
GPy/plotting/matplot_dep/visualize.py
def modify(self, vals): """When latent values are modified update the latent representation and ulso update the output visualization.""" self.vals = vals.view(np.ndarray).copy() y = self.model.predict(self.vals)[0] self.data_visualize.modify(y) self.latent_handle.set_data(self.va...
def modify(self, vals): """When latent values are modified update the latent representation and ulso update the output visualization.""" self.vals = vals.view(np.ndarray).copy() y = self.model.predict(self.vals)[0] self.data_visualize.modify(y) self.latent_handle.set_data(self.va...
[ "When", "latent", "values", "are", "modified", "update", "the", "latent", "representation", "and", "ulso", "update", "the", "output", "visualization", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/visualize.py#L136-L142
[ "def", "modify", "(", "self", ",", "vals", ")", ":", "self", ".", "vals", "=", "vals", ".", "view", "(", "np", ".", "ndarray", ")", ".", "copy", "(", ")", "y", "=", "self", ".", "model", ".", "predict", "(", "self", ".", "vals", ")", "[", "0"...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
mocap_data_show.initialize_axes
Set up the axes with the right limits and scaling.
GPy/plotting/matplot_dep/visualize.py
def initialize_axes(self, boundary=0.05): """Set up the axes with the right limits and scaling.""" bs = [(self.vals[:, i].max()-self.vals[:, i].min())*boundary for i in range(3)] self.x_lim = np.array([self.vals[:, 0].min()-bs[0], self.vals[:, 0].max()+bs[0]]) self.y_lim = np.array([self...
def initialize_axes(self, boundary=0.05): """Set up the axes with the right limits and scaling.""" bs = [(self.vals[:, i].max()-self.vals[:, i].min())*boundary for i in range(3)] self.x_lim = np.array([self.vals[:, 0].min()-bs[0], self.vals[:, 0].max()+bs[0]]) self.y_lim = np.array([self...
[ "Set", "up", "the", "axes", "with", "the", "right", "limits", "and", "scaling", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/visualize.py#L461-L466
[ "def", "initialize_axes", "(", "self", ",", "boundary", "=", "0.05", ")", ":", "bs", "=", "[", "(", "self", ".", "vals", "[", ":", ",", "i", "]", ".", "max", "(", ")", "-", "self", ".", "vals", "[", ":", ",", "i", "]", ".", "min", "(", ")",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
skeleton_show.process_values
Takes a set of angles and converts them to the x,y,z coordinates in the internal prepresentation of the class, ready for plotting. :param vals: the values that are being modelled.
GPy/plotting/matplot_dep/visualize.py
def process_values(self): """Takes a set of angles and converts them to the x,y,z coordinates in the internal prepresentation of the class, ready for plotting. :param vals: the values that are being modelled.""" if self.padding>0: channels = np.zeros((self.vals.shape[0], self.vals....
def process_values(self): """Takes a set of angles and converts them to the x,y,z coordinates in the internal prepresentation of the class, ready for plotting. :param vals: the values that are being modelled.""" if self.padding>0: channels = np.zeros((self.vals.shape[0], self.vals....
[ "Takes", "a", "set", "of", "angles", "and", "converts", "them", "to", "the", "x", "y", "z", "coordinates", "in", "the", "internal", "prepresentation", "of", "the", "class", "ready", "for", "plotting", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/matplot_dep/visualize.py#L519-L534
[ "def", "process_values", "(", "self", ")", ":", "if", "self", ".", "padding", ">", "0", ":", "channels", "=", "np", ".", "zeros", "(", "(", "self", ".", "vals", ".", "shape", "[", "0", "]", ",", "self", ".", "vals", ".", "shape", "[", "1", "]",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
AbstractPlottingLibrary.new_canvas
Return a canvas, kwargupdate for your plotting library. if figure is not None, create a canvas in the figure at subplot position (col, row). This method does two things, it creates an empty canvas and updates the kwargs (deletes the unnecessary kwargs) for further usag...
GPy/plotting/abstract_plotting_library.py
def new_canvas(self, figure=None, col=1, row=1, projection='2d', xlabel=None, ylabel=None, zlabel=None, title=None, xlim=None, ylim=None, zlim=None, **kwargs): """ Return a canvas, kwargupdate for your plotting library. if figure is not None, create a canvas in the figure at subplot po...
def new_canvas(self, figure=None, col=1, row=1, projection='2d', xlabel=None, ylabel=None, zlabel=None, title=None, xlim=None, ylim=None, zlim=None, **kwargs): """ Return a canvas, kwargupdate for your plotting library. if figure is not None, create a canvas in the figure at subplot po...
[ "Return", "a", "canvas", "kwargupdate", "for", "your", "plotting", "library", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/abstract_plotting_library.py#L69-L96
[ "def", "new_canvas", "(", "self", ",", "figure", "=", "None", ",", "col", "=", "1", ",", "row", "=", "1", ",", "projection", "=", "'2d'", ",", "xlabel", "=", "None", ",", "ylabel", "=", "None", ",", "zlabel", "=", "None", ",", "title", "=", "None...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
AbstractPlottingLibrary.plot
Make a line plot from for Y on X (Y = f(X)) on the canvas. If Z is not None, plot in 3d! the kwargs are plotting library specific kwargs!
GPy/plotting/abstract_plotting_library.py
def plot(self, cavas, X, Y, Z=None, color=None, label=None, **kwargs): """ Make a line plot from for Y on X (Y = f(X)) on the canvas. If Z is not None, plot in 3d! the kwargs are plotting library specific kwargs! """ raise NotImplementedError("Implement all plot ...
def plot(self, cavas, X, Y, Z=None, color=None, label=None, **kwargs): """ Make a line plot from for Y on X (Y = f(X)) on the canvas. If Z is not None, plot in 3d! the kwargs are plotting library specific kwargs! """ raise NotImplementedError("Implement all plot ...
[ "Make", "a", "line", "plot", "from", "for", "Y", "on", "X", "(", "Y", "=", "f", "(", "X", "))", "on", "the", "canvas", ".", "If", "Z", "is", "not", "None", "plot", "in", "3d!", "the", "kwargs", "are", "plotting", "library", "specific", "kwargs!" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/abstract_plotting_library.py#L121-L128
[ "def", "plot", "(", "self", ",", "cavas", ",", "X", ",", "Y", ",", "Z", "=", "None", ",", "color", "=", "None", ",", "label", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"Implement all plot functions in Abstract...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
AbstractPlottingLibrary.surface
Plot a surface for 3d plotting for the inputs (X, Y, Z). the kwargs are plotting library specific kwargs!
GPy/plotting/abstract_plotting_library.py
def surface(self, canvas, X, Y, Z, color=None, label=None, **kwargs): """ Plot a surface for 3d plotting for the inputs (X, Y, Z). the kwargs are plotting library specific kwargs! """ raise NotImplementedError("Implement all plot functions in AbstractPlottingLibrary in o...
def surface(self, canvas, X, Y, Z, color=None, label=None, **kwargs): """ Plot a surface for 3d plotting for the inputs (X, Y, Z). the kwargs are plotting library specific kwargs! """ raise NotImplementedError("Implement all plot functions in AbstractPlottingLibrary in o...
[ "Plot", "a", "surface", "for", "3d", "plotting", "for", "the", "inputs", "(", "X", "Y", "Z", ")", ".", "the", "kwargs", "are", "plotting", "library", "specific", "kwargs!" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/abstract_plotting_library.py#L140-L146
[ "def", "surface", "(", "self", ",", "canvas", ",", "X", ",", "Y", ",", "Z", ",", "color", "=", "None", ",", "label", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"Implement all plot functions in AbstractPlottingLibra...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
AbstractPlottingLibrary.scatter
Make a scatter plot between X and Y on the canvas given. the kwargs are plotting library specific kwargs! :param canvas: the plotting librarys specific canvas to plot on. :param array-like X: the inputs to plot. :param array-like Y: the outputs to plot. :param a...
GPy/plotting/abstract_plotting_library.py
def scatter(self, canvas, X, Y, Z=None, color=None, vmin=None, vmax=None, label=None, **kwargs): """ Make a scatter plot between X and Y on the canvas given. the kwargs are plotting library specific kwargs! :param canvas: the plotting librarys specific canvas to plot on...
def scatter(self, canvas, X, Y, Z=None, color=None, vmin=None, vmax=None, label=None, **kwargs): """ Make a scatter plot between X and Y on the canvas given. the kwargs are plotting library specific kwargs! :param canvas: the plotting librarys specific canvas to plot on...
[ "Make", "a", "scatter", "plot", "between", "X", "and", "Y", "on", "the", "canvas", "given", ".", "the", "kwargs", "are", "plotting", "library", "specific", "kwargs!", ":", "param", "canvas", ":", "the", "plotting", "librarys", "specific", "canvas", "to", "...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/abstract_plotting_library.py#L148-L163
[ "def", "scatter", "(", "self", ",", "canvas", ",", "X", ",", "Y", ",", "Z", "=", "None", ",", "color", "=", "None", ",", "vmin", "=", "None", ",", "vmax", "=", "None", ",", "label", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "No...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
AbstractPlottingLibrary.barplot
Plot vertical bar plot centered at x with height and width of bars. The y level is at bottom. the kwargs are plotting library specific kwargs! :param array-like x: the center points of the bars :param array-like height: the height of the bars :param array-like width: t...
GPy/plotting/abstract_plotting_library.py
def barplot(self, canvas, x, height, width=0.8, bottom=0, color=None, label=None, **kwargs): """ Plot vertical bar plot centered at x with height and width of bars. The y level is at bottom. the kwargs are plotting library specific kwargs! :param array-like x: the cent...
def barplot(self, canvas, x, height, width=0.8, bottom=0, color=None, label=None, **kwargs): """ Plot vertical bar plot centered at x with height and width of bars. The y level is at bottom. the kwargs are plotting library specific kwargs! :param array-like x: the cent...
[ "Plot", "vertical", "bar", "plot", "centered", "at", "x", "with", "height", "and", "width", "of", "bars", ".", "The", "y", "level", "is", "at", "bottom", ".", "the", "kwargs", "are", "plotting", "library", "specific", "kwargs!" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/abstract_plotting_library.py#L165-L178
[ "def", "barplot", "(", "self", ",", "canvas", ",", "x", ",", "height", ",", "width", "=", "0.8", ",", "bottom", "=", "0", ",", "color", "=", "None", ",", "label", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
AbstractPlottingLibrary.xerrorbar
Make an errorbar along the xaxis for points at (X,Y) on the canvas. if error is two dimensional, the lower error is error[:,0] and the upper error is error[:,1] the kwargs are plotting library specific kwargs!
GPy/plotting/abstract_plotting_library.py
def xerrorbar(self, canvas, X, Y, error, color=None, label=None, **kwargs): """ Make an errorbar along the xaxis for points at (X,Y) on the canvas. if error is two dimensional, the lower error is error[:,0] and the upper error is error[:,1] the kwargs are plotting librar...
def xerrorbar(self, canvas, X, Y, error, color=None, label=None, **kwargs): """ Make an errorbar along the xaxis for points at (X,Y) on the canvas. if error is two dimensional, the lower error is error[:,0] and the upper error is error[:,1] the kwargs are plotting librar...
[ "Make", "an", "errorbar", "along", "the", "xaxis", "for", "points", "at", "(", "X", "Y", ")", "on", "the", "canvas", ".", "if", "error", "is", "two", "dimensional", "the", "lower", "error", "is", "error", "[", ":", "0", "]", "and", "the", "upper", ...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/abstract_plotting_library.py#L180-L188
[ "def", "xerrorbar", "(", "self", ",", "canvas", ",", "X", ",", "Y", ",", "error", ",", "color", "=", "None", ",", "label", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"Implement all plot functions in AbstractPlottin...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
AbstractPlottingLibrary.imshow
Show the image stored in X on the canvas. The origin of the image show is (0,0), such that X[0,0] gets plotted at [0,0] of the image! the kwargs are plotting library specific kwargs!
GPy/plotting/abstract_plotting_library.py
def imshow(self, canvas, X, extent=None, label=None, vmin=None, vmax=None, **kwargs): """ Show the image stored in X on the canvas. The origin of the image show is (0,0), such that X[0,0] gets plotted at [0,0] of the image! the kwargs are plotting library specific kwarg...
def imshow(self, canvas, X, extent=None, label=None, vmin=None, vmax=None, **kwargs): """ Show the image stored in X on the canvas. The origin of the image show is (0,0), such that X[0,0] gets plotted at [0,0] of the image! the kwargs are plotting library specific kwarg...
[ "Show", "the", "image", "stored", "in", "X", "on", "the", "canvas", ".", "The", "origin", "of", "the", "image", "show", "is", "(", "0", "0", ")", "such", "that", "X", "[", "0", "0", "]", "gets", "plotted", "at", "[", "0", "0", "]", "of", "the",...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/abstract_plotting_library.py#L200-L208
[ "def", "imshow", "(", "self", ",", "canvas", ",", "X", ",", "extent", "=", "None", ",", "label", "=", "None", ",", "vmin", "=", "None", ",", "vmax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"Implement all...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
AbstractPlottingLibrary.imshow_interact
This function is optional! Create an imshow controller to stream the image returned by the plot_function. There is an imshow controller written for mmatplotlib, which updates the imshow on changes in axis. The origin of the image show is (0,0), such that X[0,0] gets p...
GPy/plotting/abstract_plotting_library.py
def imshow_interact(self, canvas, plot_function, extent=None, label=None, vmin=None, vmax=None, **kwargs): """ This function is optional! Create an imshow controller to stream the image returned by the plot_function. There is an imshow controller written for mmatplotlib, which...
def imshow_interact(self, canvas, plot_function, extent=None, label=None, vmin=None, vmax=None, **kwargs): """ This function is optional! Create an imshow controller to stream the image returned by the plot_function. There is an imshow controller written for mmatplotlib, which...
[ "This", "function", "is", "optional!" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/abstract_plotting_library.py#L210-L222
[ "def", "imshow_interact", "(", "self", ",", "canvas", ",", "plot_function", ",", "extent", "=", "None", ",", "label", "=", "None", ",", "vmin", "=", "None", ",", "vmax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
AbstractPlottingLibrary.contour
Make a contour plot at (X, Y) with heights/colors stored in C on the canvas. if Z is not None: make 3d contour plot at (X, Y, Z) with heights/colors stored in C on the canvas. the kwargs are plotting library specific kwargs!
GPy/plotting/abstract_plotting_library.py
def contour(self, canvas, X, Y, C, Z=None, color=None, label=None, **kwargs): """ Make a contour plot at (X, Y) with heights/colors stored in C on the canvas. if Z is not None: make 3d contour plot at (X, Y, Z) with heights/colors stored in C on the canvas. the kwargs a...
def contour(self, canvas, X, Y, C, Z=None, color=None, label=None, **kwargs): """ Make a contour plot at (X, Y) with heights/colors stored in C on the canvas. if Z is not None: make 3d contour plot at (X, Y, Z) with heights/colors stored in C on the canvas. the kwargs a...
[ "Make", "a", "contour", "plot", "at", "(", "X", "Y", ")", "with", "heights", "/", "colors", "stored", "in", "C", "on", "the", "canvas", ".", "if", "Z", "is", "not", "None", ":", "make", "3d", "contour", "plot", "at", "(", "X", "Y", "Z", ")", "w...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/abstract_plotting_library.py#L258-L266
[ "def", "contour", "(", "self", ",", "canvas", ",", "X", ",", "Y", ",", "C", ",", "Z", "=", "None", ",", "color", "=", "None", ",", "label", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"Implement all plot fun...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
AbstractPlottingLibrary.fill_between
Fill along the xaxis between lower and upper. the kwargs are plotting library specific kwargs!
GPy/plotting/abstract_plotting_library.py
def fill_between(self, canvas, X, lower, upper, color=None, label=None, **kwargs): """ Fill along the xaxis between lower and upper. the kwargs are plotting library specific kwargs! """ raise NotImplementedError("Implement all plot functions in AbstractPlottingLibrary in...
def fill_between(self, canvas, X, lower, upper, color=None, label=None, **kwargs): """ Fill along the xaxis between lower and upper. the kwargs are plotting library specific kwargs! """ raise NotImplementedError("Implement all plot functions in AbstractPlottingLibrary in...
[ "Fill", "along", "the", "xaxis", "between", "lower", "and", "upper", ".", "the", "kwargs", "are", "plotting", "library", "specific", "kwargs!" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/plotting/abstract_plotting_library.py#L268-L274
[ "def", "fill_between", "(", "self", ",", "canvas", ",", "X", ",", "lower", ",", "upper", ",", "color", "=", "None", ",", "label", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"Implement all plot functions in Abstract...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
randomize
Randomize the model. Make this draw from the prior if one exists, else draw from given random generator :param rand_gen: np random number generator which takes args and kwargs :param flaot loc: loc parameter for random number generator :param float scale: scale parameter for random number generator ...
GPy/core/__init__.py
def randomize(self, rand_gen=None, *args, **kwargs): """ Randomize the model. Make this draw from the prior if one exists, else draw from given random generator :param rand_gen: np random number generator which takes args and kwargs :param flaot loc: loc parameter for random number generator :p...
def randomize(self, rand_gen=None, *args, **kwargs): """ Randomize the model. Make this draw from the prior if one exists, else draw from given random generator :param rand_gen: np random number generator which takes args and kwargs :param flaot loc: loc parameter for random number generator :p...
[ "Randomize", "the", "model", ".", "Make", "this", "draw", "from", "the", "prior", "if", "one", "exists", "else", "draw", "from", "given", "random", "generator" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/core/__init__.py#L19-L43
[ "def", "randomize", "(", "self", ",", "rand_gen", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "rand_gen", "is", "None", ":", "rand_gen", "=", "np", ".", "random", ".", "normal", "# first take care of all parameters (from N(0,1))",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Multidimensional_Integral_Limits.k_xx
Covariance between observed values. s and t are one domain of the integral (i.e. the integral between s and t) sprime and tprime are another domain of the integral (i.e. the integral between sprime and tprime) We're interested in how correlated these two integrals are. Note: We've not...
GPy/kern/src/multidimensional_integral_limits.py
def k_xx(self,t,tprime,s,sprime,l): """Covariance between observed values. s and t are one domain of the integral (i.e. the integral between s and t) sprime and tprime are another domain of the integral (i.e. the integral between sprime and tprime) We're interested in how correlated th...
def k_xx(self,t,tprime,s,sprime,l): """Covariance between observed values. s and t are one domain of the integral (i.e. the integral between s and t) sprime and tprime are another domain of the integral (i.e. the integral between sprime and tprime) We're interested in how correlated th...
[ "Covariance", "between", "observed", "values", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/multidimensional_integral_limits.py#L66-L75
[ "def", "k_xx", "(", "self", ",", "t", ",", "tprime", ",", "s", ",", "sprime", ",", "l", ")", ":", "return", "0.5", "*", "(", "l", "**", "2", ")", "*", "(", "self", ".", "g", "(", "(", "t", "-", "sprime", ")", "/", "l", ")", "+", "self", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Multidimensional_Integral_Limits.calc_K_xx_wo_variance
Calculates K_xx without the variance term
GPy/kern/src/multidimensional_integral_limits.py
def calc_K_xx_wo_variance(self,X): """Calculates K_xx without the variance term""" K_xx = np.ones([X.shape[0],X.shape[0]]) #ones now as a product occurs over each dimension for i,x in enumerate(X): for j,x2 in enumerate(X): for il,l in enumerate(self.lengthscale): ...
def calc_K_xx_wo_variance(self,X): """Calculates K_xx without the variance term""" K_xx = np.ones([X.shape[0],X.shape[0]]) #ones now as a product occurs over each dimension for i,x in enumerate(X): for j,x2 in enumerate(X): for il,l in enumerate(self.lengthscale): ...
[ "Calculates", "K_xx", "without", "the", "variance", "term" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/multidimensional_integral_limits.py#L88-L96
[ "def", "calc_K_xx_wo_variance", "(", "self", ",", "X", ")", ":", "K_xx", "=", "np", ".", "ones", "(", "[", "X", ".", "shape", "[", "0", "]", ",", "X", ".", "shape", "[", "0", "]", "]", ")", "#ones now as a product occurs over each dimension", "for", "i...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Multidimensional_Integral_Limits.Kdiag
I've used the fact that we call this method for K_ff when finding the covariance as a hack so I know if I should return K_ff or K_xx. In this case we're returning K_ff!! $K_{ff}^{post} = K_{ff} - K_{fx} K_{xx}^{-1} K_{xf}$
GPy/kern/src/multidimensional_integral_limits.py
def Kdiag(self, X): """I've used the fact that we call this method for K_ff when finding the covariance as a hack so I know if I should return K_ff or K_xx. In this case we're returning K_ff!! $K_{ff}^{post} = K_{ff} - K_{fx} K_{xx}^{-1} K_{xf}$""" K_ff = np.ones(X.shape[0]) for ...
def Kdiag(self, X): """I've used the fact that we call this method for K_ff when finding the covariance as a hack so I know if I should return K_ff or K_xx. In this case we're returning K_ff!! $K_{ff}^{post} = K_{ff} - K_{fx} K_{xx}^{-1} K_{xf}$""" K_ff = np.ones(X.shape[0]) for ...
[ "I", "ve", "used", "the", "fact", "that", "we", "call", "this", "method", "for", "K_ff", "when", "finding", "the", "covariance", "as", "a", "hack", "so", "I", "know", "if", "I", "should", "return", "K_ff", "or", "K_xx", ".", "In", "this", "case", "we...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/multidimensional_integral_limits.py#L111-L120
[ "def", "Kdiag", "(", "self", ",", "X", ")", ":", "K_ff", "=", "np", ".", "ones", "(", "X", ".", "shape", "[", "0", "]", ")", "for", "i", ",", "x", "in", "enumerate", "(", "X", ")", ":", "for", "il", ",", "l", "in", "enumerate", "(", "self",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
HessianChecker.checkgrad
Overwrite checkgrad method to check whole block instead of looping through Shows diagnostics using matshow instead :param verbose: If True, print a "full" checking of each parameter :type verbose: bool :param step: The size of the step around which to linearise the objective :t...
GPy/models/gradient_checker.py
def checkgrad(self, target_param=None, verbose=False, step=1e-6, tolerance=1e-3, block_indices=None, plot=False): """ Overwrite checkgrad method to check whole block instead of looping through Shows diagnostics using matshow instead :param verbose: If True, print a "full" checking of e...
def checkgrad(self, target_param=None, verbose=False, step=1e-6, tolerance=1e-3, block_indices=None, plot=False): """ Overwrite checkgrad method to check whole block instead of looping through Shows diagnostics using matshow instead :param verbose: If True, print a "full" checking of e...
[ "Overwrite", "checkgrad", "method", "to", "check", "whole", "block", "instead", "of", "looping", "through" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/gradient_checker.py#L143-L194
[ "def", "checkgrad", "(", "self", ",", "target_param", "=", "None", ",", "verbose", "=", "False", ",", "step", "=", "1e-6", ",", "tolerance", "=", "1e-3", ",", "block_indices", "=", "None", ",", "plot", "=", "False", ")", ":", "try", ":", "import", "n...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
HessianChecker.checkgrad_block
Checkgrad a block matrix
GPy/models/gradient_checker.py
def checkgrad_block(self, analytic_hess, numeric_hess, verbose=False, step=1e-6, tolerance=1e-3, block_indices=None, plot=False): """ Checkgrad a block matrix """ if analytic_hess.dtype is np.dtype('object'): #Make numeric hessian also into a block matrix real_siz...
def checkgrad_block(self, analytic_hess, numeric_hess, verbose=False, step=1e-6, tolerance=1e-3, block_indices=None, plot=False): """ Checkgrad a block matrix """ if analytic_hess.dtype is np.dtype('object'): #Make numeric hessian also into a block matrix real_siz...
[ "Checkgrad", "a", "block", "matrix" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/gradient_checker.py#L196-L289
[ "def", "checkgrad_block", "(", "self", ",", "analytic_hess", ",", "numeric_hess", ",", "verbose", "=", "False", ",", "step", "=", "1e-6", ",", "tolerance", "=", "1e-3", ",", "block_indices", "=", "None", ",", "plot", "=", "False", ")", ":", "if", "analyt...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
SkewChecker.checkgrad
Gradient checker that just checks each hessian individually super_plot will plot the hessian wrt every parameter, plot will just do the first one
GPy/models/gradient_checker.py
def checkgrad(self, target_param=None, verbose=False, step=1e-6, tolerance=1e-3, block_indices=None, plot=False, super_plot=False): """ Gradient checker that just checks each hessian individually super_plot will plot the hessian wrt every parameter, plot will just do the first one """ ...
def checkgrad(self, target_param=None, verbose=False, step=1e-6, tolerance=1e-3, block_indices=None, plot=False, super_plot=False): """ Gradient checker that just checks each hessian individually super_plot will plot the hessian wrt every parameter, plot will just do the first one """ ...
[ "Gradient", "checker", "that", "just", "checks", "each", "hessian", "individually" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/gradient_checker.py#L313-L372
[ "def", "checkgrad", "(", "self", ",", "target_param", "=", "None", ",", "verbose", "=", "False", ",", "step", "=", "1e-6", ",", "tolerance", "=", "1e-3", ",", "block_indices", "=", "None", ",", "plot", "=", "False", ",", "super_plot", "=", "False", ")"...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
GridKern.dKd_dVar
Derivative of Kernel function wrt variance applied on inputs X and X2. In the stationary case there is an inner function depending on the distances from X to X2, called r. dKd_dVar(X, X2) = dKdVar_of_r((X-X2)**2)
GPy/kern/src/grid_kerns.py
def dKd_dVar(self, X, X2=None): """ Derivative of Kernel function wrt variance applied on inputs X and X2. In the stationary case there is an inner function depending on the distances from X to X2, called r. dKd_dVar(X, X2) = dKdVar_of_r((X-X2)**2) """ r = self._scaled_dist(X, X2) return self.dKdVar_of...
def dKd_dVar(self, X, X2=None): """ Derivative of Kernel function wrt variance applied on inputs X and X2. In the stationary case there is an inner function depending on the distances from X to X2, called r. dKd_dVar(X, X2) = dKdVar_of_r((X-X2)**2) """ r = self._scaled_dist(X, X2) return self.dKdVar_of...
[ "Derivative", "of", "Kernel", "function", "wrt", "variance", "applied", "on", "inputs", "X", "and", "X2", ".", "In", "the", "stationary", "case", "there", "is", "an", "inner", "function", "depending", "on", "the", "distances", "from", "X", "to", "X2", "cal...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/grid_kerns.py#L18-L27
[ "def", "dKd_dVar", "(", "self", ",", "X", ",", "X2", "=", "None", ")", ":", "r", "=", "self", ".", "_scaled_dist", "(", "X", ",", "X2", ")", "return", "self", ".", "dKdVar_of_r", "(", "r", ")" ]
54c32d79d289d622fb18b898aee65a2a431d90cf
train
GridKern.dKd_dLen
Derivate of Kernel function wrt lengthscale applied on inputs X and X2. In the stationary case there is an inner function depending on the distances from X to X2, called r. dKd_dLen(X, X2) = dKdLen_of_r((X-X2)**2)
GPy/kern/src/grid_kerns.py
def dKd_dLen(self, X, dimension, lengthscale, X2=None): """ Derivate of Kernel function wrt lengthscale applied on inputs X and X2. In the stationary case there is an inner function depending on the distances from X to X2, called r. dKd_dLen(X, X2) = dKdLen_of_r((X-X2)**2) """ r = self._scaled_dist(X, X2...
def dKd_dLen(self, X, dimension, lengthscale, X2=None): """ Derivate of Kernel function wrt lengthscale applied on inputs X and X2. In the stationary case there is an inner function depending on the distances from X to X2, called r. dKd_dLen(X, X2) = dKdLen_of_r((X-X2)**2) """ r = self._scaled_dist(X, X2...
[ "Derivate", "of", "Kernel", "function", "wrt", "lengthscale", "applied", "on", "inputs", "X", "and", "X2", ".", "In", "the", "stationary", "case", "there", "is", "an", "inner", "function", "depending", "on", "the", "distances", "from", "X", "to", "X2", "ca...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/grid_kerns.py#L30-L39
[ "def", "dKd_dLen", "(", "self", ",", "X", ",", "dimension", ",", "lengthscale", ",", "X2", "=", "None", ")", ":", "r", "=", "self", ".", "_scaled_dist", "(", "X", ",", "X2", ")", "return", "self", ".", "dKdLen_of_r", "(", "r", ",", "dimension", ","...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
GridRBF.dKdLen_of_r
Compute derivative of kernel for dimension wrt lengthscale Computation of derivative changes when lengthscale corresponds to the dimension of the kernel whose derivate is being computed.
GPy/kern/src/grid_kerns.py
def dKdLen_of_r(self, r, dimCheck, lengthscale): """ Compute derivative of kernel for dimension wrt lengthscale Computation of derivative changes when lengthscale corresponds to the dimension of the kernel whose derivate is being computed. """ if (dimCheck == True): return (self.variance**(float(1)/self...
def dKdLen_of_r(self, r, dimCheck, lengthscale): """ Compute derivative of kernel for dimension wrt lengthscale Computation of derivative changes when lengthscale corresponds to the dimension of the kernel whose derivate is being computed. """ if (dimCheck == True): return (self.variance**(float(1)/self...
[ "Compute", "derivative", "of", "kernel", "for", "dimension", "wrt", "lengthscale", "Computation", "of", "derivative", "changes", "when", "lengthscale", "corresponds", "to", "the", "dimension", "of", "the", "kernel", "whose", "derivate", "is", "being", "computed", ...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/grid_kerns.py#L64-L73
[ "def", "dKdLen_of_r", "(", "self", ",", "r", ",", "dimCheck", ",", "lengthscale", ")", ":", "if", "(", "dimCheck", "==", "True", ")", ":", "return", "(", "self", ".", "variance", "**", "(", "float", "(", "1", ")", "/", "self", ".", "originalDimension...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.from_dict
Instantiate an object of a derived class using the information in input_dict (built by the to_dict method of the derived class). More specifically, after reading the derived class from input_dict, it calls the method _build_from_input_dict of the derived class. Note: This method should n...
GPy/likelihoods/likelihood.py
def from_dict(input_dict): """ Instantiate an object of a derived class using the information in input_dict (built by the to_dict method of the derived class). More specifically, after reading the derived class from input_dict, it calls the method _build_from_input_dict of the de...
def from_dict(input_dict): """ Instantiate an object of a derived class using the information in input_dict (built by the to_dict method of the derived class). More specifically, after reading the derived class from input_dict, it calls the method _build_from_input_dict of the de...
[ "Instantiate", "an", "object", "of", "a", "derived", "class", "using", "the", "information", "in", "input_dict", "(", "built", "by", "the", "to_dict", "method", "of", "the", "derived", "class", ")", ".", "More", "specifically", "after", "reading", "the", "de...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L59-L79
[ "def", "from_dict", "(", "input_dict", ")", ":", "import", "copy", "input_dict", "=", "copy", ".", "deepcopy", "(", "input_dict", ")", "likelihood_class", "=", "input_dict", ".", "pop", "(", "'class'", ")", "input_dict", "[", "\"name\"", "]", "=", "str", "...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.log_predictive_density
Calculation of the log predictive density .. math: p(y_{*}|D) = p(y_{*}|f_{*})p(f_{*}|\mu_{*}\\sigma^{2}_{*}) :param y_test: test observations (y_{*}) :type y_test: (Nx1) array :param mu_star: predictive mean of gaussian p(f_{*}|mu_{*}, var_{*}) :type mu_star: (Nx1)...
GPy/likelihoods/likelihood.py
def log_predictive_density(self, y_test, mu_star, var_star, Y_metadata=None): """ Calculation of the log predictive density .. math: p(y_{*}|D) = p(y_{*}|f_{*})p(f_{*}|\mu_{*}\\sigma^{2}_{*}) :param y_test: test observations (y_{*}) :type y_test: (Nx1) array ...
def log_predictive_density(self, y_test, mu_star, var_star, Y_metadata=None): """ Calculation of the log predictive density .. math: p(y_{*}|D) = p(y_{*}|f_{*})p(f_{*}|\mu_{*}\\sigma^{2}_{*}) :param y_test: test observations (y_{*}) :type y_test: (Nx1) array ...
[ "Calculation", "of", "the", "log", "predictive", "density" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L128-L194
[ "def", "log_predictive_density", "(", "self", ",", "y_test", ",", "mu_star", ",", "var_star", ",", "Y_metadata", "=", "None", ")", ":", "assert", "y_test", ".", "shape", "==", "mu_star", ".", "shape", "assert", "y_test", ".", "shape", "==", "var_star", "."...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.log_predictive_density_sampling
Calculation of the log predictive density via sampling .. math: log p(y_{*}|D) = log 1/num_samples prod^{S}_{s=1} p(y_{*}|f_{*s}) f_{*s} ~ p(f_{*}|\mu_{*}\\sigma^{2}_{*}) :param y_test: test observations (y_{*}) :type y_test: (Nx1) array :param mu_star: predicti...
GPy/likelihoods/likelihood.py
def log_predictive_density_sampling(self, y_test, mu_star, var_star, Y_metadata=None, num_samples=1000): """ Calculation of the log predictive density via sampling .. math: log p(y_{*}|D) = log 1/num_samples prod^{S}_{s=1} p(y_{*}|f_{*s}) f_{*s} ~ p(f_{*}|\mu_{*}\\sigma^...
def log_predictive_density_sampling(self, y_test, mu_star, var_star, Y_metadata=None, num_samples=1000): """ Calculation of the log predictive density via sampling .. math: log p(y_{*}|D) = log 1/num_samples prod^{S}_{s=1} p(y_{*}|f_{*s}) f_{*s} ~ p(f_{*}|\mu_{*}\\sigma^...
[ "Calculation", "of", "the", "log", "predictive", "density", "via", "sampling" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L196-L224
[ "def", "log_predictive_density_sampling", "(", "self", ",", "y_test", ",", "mu_star", ",", "var_star", ",", "Y_metadata", "=", "None", ",", "num_samples", "=", "1000", ")", ":", "assert", "y_test", ".", "shape", "==", "mu_star", ".", "shape", "assert", "y_te...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.moments_match_ep
Calculation of moments using quadrature :param obs: observed output :param tau: cavity distribution 1st natural parameter (precision) :param v: cavity distribution 2nd natural paramenter (mu*precision)
GPy/likelihoods/likelihood.py
def moments_match_ep(self,obs,tau,v,Y_metadata_i=None): """ Calculation of moments using quadrature :param obs: observed output :param tau: cavity distribution 1st natural parameter (precision) :param v: cavity distribution 2nd natural paramenter (mu*precision) """ ...
def moments_match_ep(self,obs,tau,v,Y_metadata_i=None): """ Calculation of moments using quadrature :param obs: observed output :param tau: cavity distribution 1st natural parameter (precision) :param v: cavity distribution 2nd natural paramenter (mu*precision) """ ...
[ "Calculation", "of", "moments", "using", "quadrature" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L226-L264
[ "def", "moments_match_ep", "(", "self", ",", "obs", ",", "tau", ",", "v", ",", "Y_metadata_i", "=", "None", ")", ":", "#Compute first integral for zeroth moment.", "#NOTE constant np.sqrt(2*pi/tau) added at the end of the function", "mu", "=", "v", "/", "tau", "sigma2",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.variational_expectations
Use Gauss-Hermite Quadrature to compute E_p(f) [ log p(y|f) ] d/dm E_p(f) [ log p(y|f) ] d/dv E_p(f) [ log p(y|f) ] where p(f) is a Gaussian with mean m and variance v. The shapes of Y, m and v should match. if no gh_points are passed, we construct them using defualt ...
GPy/likelihoods/likelihood.py
def variational_expectations(self, Y, m, v, gh_points=None, Y_metadata=None): """ Use Gauss-Hermite Quadrature to compute E_p(f) [ log p(y|f) ] d/dm E_p(f) [ log p(y|f) ] d/dv E_p(f) [ log p(y|f) ] where p(f) is a Gaussian with mean m and variance v. The shapes...
def variational_expectations(self, Y, m, v, gh_points=None, Y_metadata=None): """ Use Gauss-Hermite Quadrature to compute E_p(f) [ log p(y|f) ] d/dm E_p(f) [ log p(y|f) ] d/dv E_p(f) [ log p(y|f) ] where p(f) is a Gaussian with mean m and variance v. The shapes...
[ "Use", "Gauss", "-", "Hermite", "Quadrature", "to", "compute" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L358-L411
[ "def", "variational_expectations", "(", "self", ",", "Y", ",", "m", ",", "v", ",", "gh_points", "=", "None", ",", "Y_metadata", "=", "None", ")", ":", "if", "gh_points", "is", "None", ":", "gh_x", ",", "gh_w", "=", "self", ".", "_gh_points", "(", ")"...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.predictive_mean
Quadrature calculation of the predictive mean: E(Y_star|Y) = E( E(Y_star|f_star, Y) ) :param mu: mean of posterior :param sigma: standard deviation of posterior
GPy/likelihoods/likelihood.py
def predictive_mean(self, mu, variance, Y_metadata=None): """ Quadrature calculation of the predictive mean: E(Y_star|Y) = E( E(Y_star|f_star, Y) ) :param mu: mean of posterior :param sigma: standard deviation of posterior """ #conditional_mean: the edpected value of y ...
def predictive_mean(self, mu, variance, Y_metadata=None): """ Quadrature calculation of the predictive mean: E(Y_star|Y) = E( E(Y_star|f_star, Y) ) :param mu: mean of posterior :param sigma: standard deviation of posterior """ #conditional_mean: the edpected value of y ...
[ "Quadrature", "calculation", "of", "the", "predictive", "mean", ":", "E", "(", "Y_star|Y", ")", "=", "E", "(", "E", "(", "Y_star|f_star", "Y", ")", ")" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L413-L438
[ "def", "predictive_mean", "(", "self", ",", "mu", ",", "variance", ",", "Y_metadata", "=", "None", ")", ":", "#conditional_mean: the edpected value of y given some f, under this likelihood", "fmin", "=", "-", "np", ".", "inf", "fmax", "=", "np", ".", "inf", "def",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.predictive_variance
Approximation to the predictive variance: V(Y_star) The following variance decomposition is used: V(Y_star) = E( V(Y_star|f_star)**2 ) + V( E(Y_star|f_star) )**2 :param mu: mean of posterior :param sigma: standard deviation of posterior :predictive_mean: output's predictive mea...
GPy/likelihoods/likelihood.py
def predictive_variance(self, mu,variance, predictive_mean=None, Y_metadata=None): """ Approximation to the predictive variance: V(Y_star) The following variance decomposition is used: V(Y_star) = E( V(Y_star|f_star)**2 ) + V( E(Y_star|f_star) )**2 :param mu: mean of posterior ...
def predictive_variance(self, mu,variance, predictive_mean=None, Y_metadata=None): """ Approximation to the predictive variance: V(Y_star) The following variance decomposition is used: V(Y_star) = E( V(Y_star|f_star)**2 ) + V( E(Y_star|f_star) )**2 :param mu: mean of posterior ...
[ "Approximation", "to", "the", "predictive", "variance", ":", "V", "(", "Y_star", ")" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L440-L497
[ "def", "predictive_variance", "(", "self", ",", "mu", ",", "variance", ",", "predictive_mean", "=", "None", ",", "Y_metadata", "=", "None", ")", ":", "#sigma2 = sigma**2", "normalizer", "=", "np", ".", "sqrt", "(", "2", "*", "np", ".", "pi", "*", "varian...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.pdf
Evaluates the link function link(f) then computes the likelihood (pdf) using it .. math: p(y|\\lambda(f)) :param f: latent variables f :type f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: Y_metadata which is not used in student t distribut...
GPy/likelihoods/likelihood.py
def pdf(self, f, y, Y_metadata=None): """ Evaluates the link function link(f) then computes the likelihood (pdf) using it .. math: p(y|\\lambda(f)) :param f: latent variables f :type f: Nx1 array :param y: data :type y: Nx1 array :param Y_met...
def pdf(self, f, y, Y_metadata=None): """ Evaluates the link function link(f) then computes the likelihood (pdf) using it .. math: p(y|\\lambda(f)) :param f: latent variables f :type f: Nx1 array :param y: data :type y: Nx1 array :param Y_met...
[ "Evaluates", "the", "link", "function", "link", "(", "f", ")", "then", "computes", "the", "likelihood", "(", "pdf", ")", "using", "it" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L523-L542
[ "def", "pdf", "(", "self", ",", "f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "if", "isinstance", "(", "self", ".", "gp_link", ",", "link_functions", ".", "Identity", ")", ":", "return", "self", ".", "pdf_link", "(", "f", ",", "y", ",", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.logpdf_sum
Convenience function that can overridden for functions where this could be computed more efficiently
GPy/likelihoods/likelihood.py
def logpdf_sum(self, f, y, Y_metadata=None): """ Convenience function that can overridden for functions where this could be computed more efficiently """ return np.sum(self.logpdf(f, y, Y_metadata=Y_metadata))
def logpdf_sum(self, f, y, Y_metadata=None): """ Convenience function that can overridden for functions where this could be computed more efficiently """ return np.sum(self.logpdf(f, y, Y_metadata=Y_metadata))
[ "Convenience", "function", "that", "can", "overridden", "for", "functions", "where", "this", "could", "be", "computed", "more", "efficiently" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L544-L549
[ "def", "logpdf_sum", "(", "self", ",", "f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "return", "np", ".", "sum", "(", "self", ".", "logpdf", "(", "f", ",", "y", ",", "Y_metadata", "=", "Y_metadata", ")", ")" ]
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.logpdf
Evaluates the link function link(f) then computes the log likelihood (log pdf) using it .. math: \\log p(y|\\lambda(f)) :param f: latent variables f :type f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: Y_metadata which is not used in stude...
GPy/likelihoods/likelihood.py
def logpdf(self, f, y, Y_metadata=None): """ Evaluates the link function link(f) then computes the log likelihood (log pdf) using it .. math: \\log p(y|\\lambda(f)) :param f: latent variables f :type f: Nx1 array :param y: data :type y: Nx1 array ...
def logpdf(self, f, y, Y_metadata=None): """ Evaluates the link function link(f) then computes the log likelihood (log pdf) using it .. math: \\log p(y|\\lambda(f)) :param f: latent variables f :type f: Nx1 array :param y: data :type y: Nx1 array ...
[ "Evaluates", "the", "link", "function", "link", "(", "f", ")", "then", "computes", "the", "log", "likelihood", "(", "log", "pdf", ")", "using", "it" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L551-L570
[ "def", "logpdf", "(", "self", ",", "f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "if", "isinstance", "(", "self", ".", "gp_link", ",", "link_functions", ".", "Identity", ")", ":", "return", "self", ".", "logpdf_link", "(", "f", ",", "y", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.dlogpdf_df
Evaluates the link function link(f) then computes the derivative of log likelihood using it Uses the Faa di Bruno's formula for the chain rule .. math:: \\frac{d\\log p(y|\\lambda(f))}{df} = \\frac{d\\log p(y|\\lambda(f))}{d\\lambda(f)}\\frac{d\\lambda(f)}{df} :param f: latent vari...
GPy/likelihoods/likelihood.py
def dlogpdf_df(self, f, y, Y_metadata=None): """ Evaluates the link function link(f) then computes the derivative of log likelihood using it Uses the Faa di Bruno's formula for the chain rule .. math:: \\frac{d\\log p(y|\\lambda(f))}{df} = \\frac{d\\log p(y|\\lambda(f))}{d\\...
def dlogpdf_df(self, f, y, Y_metadata=None): """ Evaluates the link function link(f) then computes the derivative of log likelihood using it Uses the Faa di Bruno's formula for the chain rule .. math:: \\frac{d\\log p(y|\\lambda(f))}{df} = \\frac{d\\log p(y|\\lambda(f))}{d\\...
[ "Evaluates", "the", "link", "function", "link", "(", "f", ")", "then", "computes", "the", "derivative", "of", "log", "likelihood", "using", "it", "Uses", "the", "Faa", "di", "Bruno", "s", "formula", "for", "the", "chain", "rule" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L572-L594
[ "def", "dlogpdf_df", "(", "self", ",", "f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "if", "isinstance", "(", "self", ".", "gp_link", ",", "link_functions", ".", "Identity", ")", ":", "return", "self", ".", "dlogpdf_dlink", "(", "f", ",", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.d2logpdf_df2
Evaluates the link function link(f) then computes the second derivative of log likelihood using it Uses the Faa di Bruno's formula for the chain rule .. math:: \\frac{d^{2}\\log p(y|\\lambda(f))}{df^{2}} = \\frac{d^{2}\\log p(y|\\lambda(f))}{d^{2}\\lambda(f)}\\left(\\frac{d\\lambda(f)}{df}\...
GPy/likelihoods/likelihood.py
def d2logpdf_df2(self, f, y, Y_metadata=None): """ Evaluates the link function link(f) then computes the second derivative of log likelihood using it Uses the Faa di Bruno's formula for the chain rule .. math:: \\frac{d^{2}\\log p(y|\\lambda(f))}{df^{2}} = \\frac{d^{2}\\log ...
def d2logpdf_df2(self, f, y, Y_metadata=None): """ Evaluates the link function link(f) then computes the second derivative of log likelihood using it Uses the Faa di Bruno's formula for the chain rule .. math:: \\frac{d^{2}\\log p(y|\\lambda(f))}{df^{2}} = \\frac{d^{2}\\log ...
[ "Evaluates", "the", "link", "function", "link", "(", "f", ")", "then", "computes", "the", "second", "derivative", "of", "log", "likelihood", "using", "it", "Uses", "the", "Faa", "di", "Bruno", "s", "formula", "for", "the", "chain", "rule" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L597-L622
[ "def", "d2logpdf_df2", "(", "self", ",", "f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "if", "isinstance", "(", "self", ".", "gp_link", ",", "link_functions", ".", "Identity", ")", ":", "d2logpdf_df2", "=", "self", ".", "d2logpdf_dlink2", "(",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.d3logpdf_df3
Evaluates the link function link(f) then computes the third derivative of log likelihood using it Uses the Faa di Bruno's formula for the chain rule .. math:: \\frac{d^{3}\\log p(y|\\lambda(f))}{df^{3}} = \\frac{d^{3}\\log p(y|\\lambda(f)}{d\\lambda(f)^{3}}\\left(\\frac{d\\lambda(f)}{df}\\r...
GPy/likelihoods/likelihood.py
def d3logpdf_df3(self, f, y, Y_metadata=None): """ Evaluates the link function link(f) then computes the third derivative of log likelihood using it Uses the Faa di Bruno's formula for the chain rule .. math:: \\frac{d^{3}\\log p(y|\\lambda(f))}{df^{3}} = \\frac{d^{3}\\log p...
def d3logpdf_df3(self, f, y, Y_metadata=None): """ Evaluates the link function link(f) then computes the third derivative of log likelihood using it Uses the Faa di Bruno's formula for the chain rule .. math:: \\frac{d^{3}\\log p(y|\\lambda(f))}{df^{3}} = \\frac{d^{3}\\log p...
[ "Evaluates", "the", "link", "function", "link", "(", "f", ")", "then", "computes", "the", "third", "derivative", "of", "log", "likelihood", "using", "it", "Uses", "the", "Faa", "di", "Bruno", "s", "formula", "for", "the", "chain", "rule" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L625-L652
[ "def", "d3logpdf_df3", "(", "self", ",", "f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "if", "isinstance", "(", "self", ".", "gp_link", ",", "link_functions", ".", "Identity", ")", ":", "d3logpdf_df3", "=", "self", ".", "d3logpdf_dlink3", "(",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.dlogpdf_dtheta
TODO: Doc strings
GPy/likelihoods/likelihood.py
def dlogpdf_dtheta(self, f, y, Y_metadata=None): """ TODO: Doc strings """ if self.size > 0: if self.not_block_really: raise NotImplementedError("Need to make a decorator for this!") if isinstance(self.gp_link, link_functions.Identity): ...
def dlogpdf_dtheta(self, f, y, Y_metadata=None): """ TODO: Doc strings """ if self.size > 0: if self.not_block_really: raise NotImplementedError("Need to make a decorator for this!") if isinstance(self.gp_link, link_functions.Identity): ...
[ "TODO", ":", "Doc", "strings" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L655-L669
[ "def", "dlogpdf_dtheta", "(", "self", ",", "f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "if", "self", ".", "size", ">", "0", ":", "if", "self", ".", "not_block_really", ":", "raise", "NotImplementedError", "(", "\"Need to make a decorator for thi...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.dlogpdf_df_dtheta
TODO: Doc strings
GPy/likelihoods/likelihood.py
def dlogpdf_df_dtheta(self, f, y, Y_metadata=None): """ TODO: Doc strings """ if self.size > 0: if self.not_block_really: raise NotImplementedError("Need to make a decorator for this!") if isinstance(self.gp_link, link_functions.Identity): ...
def dlogpdf_df_dtheta(self, f, y, Y_metadata=None): """ TODO: Doc strings """ if self.size > 0: if self.not_block_really: raise NotImplementedError("Need to make a decorator for this!") if isinstance(self.gp_link, link_functions.Identity): ...
[ "TODO", ":", "Doc", "strings" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L671-L693
[ "def", "dlogpdf_df_dtheta", "(", "self", ",", "f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "if", "self", ".", "size", ">", "0", ":", "if", "self", ".", "not_block_really", ":", "raise", "NotImplementedError", "(", "\"Need to make a decorator for ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.d2logpdf_df2_dtheta
TODO: Doc strings
GPy/likelihoods/likelihood.py
def d2logpdf_df2_dtheta(self, f, y, Y_metadata=None): """ TODO: Doc strings """ if self.size > 0: if self.not_block_really: raise NotImplementedError("Need to make a decorator for this!") if isinstance(self.gp_link, link_functions.Identity): ...
def d2logpdf_df2_dtheta(self, f, y, Y_metadata=None): """ TODO: Doc strings """ if self.size > 0: if self.not_block_really: raise NotImplementedError("Need to make a decorator for this!") if isinstance(self.gp_link, link_functions.Identity): ...
[ "TODO", ":", "Doc", "strings" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L695-L719
[ "def", "d2logpdf_df2_dtheta", "(", "self", ",", "f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "if", "self", ".", "size", ">", "0", ":", "if", "self", ".", "not_block_really", ":", "raise", "NotImplementedError", "(", "\"Need to make a decorator fo...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.predictive_values
Compute mean, variance of the predictive distibution. :param mu: mean of the latent variable, f, of posterior :param var: variance of the latent variable, f, of posterior :param full_cov: whether to use the full covariance or just the diagonal :type full_cov: Boolean
GPy/likelihoods/likelihood.py
def predictive_values(self, mu, var, full_cov=False, Y_metadata=None): """ Compute mean, variance of the predictive distibution. :param mu: mean of the latent variable, f, of posterior :param var: variance of the latent variable, f, of posterior :param full_cov: whether to use...
def predictive_values(self, mu, var, full_cov=False, Y_metadata=None): """ Compute mean, variance of the predictive distibution. :param mu: mean of the latent variable, f, of posterior :param var: variance of the latent variable, f, of posterior :param full_cov: whether to use...
[ "Compute", "mean", "variance", "of", "the", "predictive", "distibution", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L734-L755
[ "def", "predictive_values", "(", "self", ",", "mu", ",", "var", ",", "full_cov", "=", "False", ",", "Y_metadata", "=", "None", ")", ":", "try", ":", "pred_mean", "=", "self", ".", "predictive_mean", "(", "mu", ",", "var", ",", "Y_metadata", "=", "Y_met...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Likelihood.MCMC_pdf_samples
Simple implementation of Metropolis sampling algorithm Will run a parallel chain for each input dimension (treats each f independently) Thus assumes f*_1 independant of f*_2 etc. :param num_samples: Number of samples to take :param fNew: f at which to sample around :param start...
GPy/likelihoods/likelihood.py
def MCMC_pdf_samples(self, fNew, num_samples=1000, starting_loc=None, stepsize=0.1, burn_in=1000, Y_metadata=None): """ Simple implementation of Metropolis sampling algorithm Will run a parallel chain for each input dimension (treats each f independently) Thus assumes f*_1 independant o...
def MCMC_pdf_samples(self, fNew, num_samples=1000, starting_loc=None, stepsize=0.1, burn_in=1000, Y_metadata=None): """ Simple implementation of Metropolis sampling algorithm Will run a parallel chain for each input dimension (treats each f independently) Thus assumes f*_1 independant o...
[ "Simple", "implementation", "of", "Metropolis", "sampling", "algorithm" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/likelihood.py#L780-L852
[ "def", "MCMC_pdf_samples", "(", "self", ",", "fNew", ",", "num_samples", "=", "1000", ",", "starting_loc", "=", "None", ",", "stepsize", "=", "0.1", ",", "burn_in", "=", "1000", ",", "Y_metadata", "=", "None", ")", ":", "print", "(", "\"Warning, using MCMC...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
psicomputations
Compute psi-statistics for ss-linear kernel
GPy/kern/src/psi_comp/sslinear_psi_comp.py
def psicomputations(variance, Z, variational_posterior, return_psi2_n=False): """ Compute psi-statistics for ss-linear kernel """ # here are the "statistics" for psi0, psi1 and psi2 # Produced intermediate results: # psi0 N # psi1 NxM # psi2 MxM mu = variational_posterior.me...
def psicomputations(variance, Z, variational_posterior, return_psi2_n=False): """ Compute psi-statistics for ss-linear kernel """ # here are the "statistics" for psi0, psi1 and psi2 # Produced intermediate results: # psi0 N # psi1 NxM # psi2 MxM mu = variational_posterior.me...
[ "Compute", "psi", "-", "statistics", "for", "ss", "-", "linear", "kernel" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/psi_comp/sslinear_psi_comp.py#L12-L29
[ "def", "psicomputations", "(", "variance", ",", "Z", ",", "variational_posterior", ",", "return_psi2_n", "=", "False", ")", ":", "# here are the \"statistics\" for psi0, psi1 and psi2", "# Produced intermediate results:", "# psi0 N", "# psi1 NxM", "# psi2 MxM", "mu", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
_psi2computations
Z - MxQ mu - NxQ S - NxQ gamma - NxQ
GPy/kern/src/psi_comp/sslinear_psi_comp.py
def _psi2computations(dL_dpsi2, variance, Z, mu, S, gamma): """ Z - MxQ mu - NxQ S - NxQ gamma - NxQ """ # here are the "statistics" for psi1 and psi2 # Produced intermediate results: # _psi2_dvariance Q # _psi2_dZ MxQ # _psi2_dgamma NxQ # _psi2_d...
def _psi2computations(dL_dpsi2, variance, Z, mu, S, gamma): """ Z - MxQ mu - NxQ S - NxQ gamma - NxQ """ # here are the "statistics" for psi1 and psi2 # Produced intermediate results: # _psi2_dvariance Q # _psi2_dZ MxQ # _psi2_dgamma NxQ # _psi2_d...
[ "Z", "-", "MxQ", "mu", "-", "NxQ", "S", "-", "NxQ", "gamma", "-", "NxQ" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/psi_comp/sslinear_psi_comp.py#L48-L86
[ "def", "_psi2computations", "(", "dL_dpsi2", ",", "variance", ",", "Z", ",", "mu", ",", "S", ",", "gamma", ")", ":", "# here are the \"statistics\" for psi1 and psi2", "# Produced intermediate results:", "# _psi2_dvariance Q", "# _psi2_dZ MxQ", "# _psi2_dgamm...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Posterior.mean
Posterior mean $$ K_{xx}v v := \texttt{Woodbury vector} $$
GPy/inference/latent_function_inference/posterior.py
def mean(self): """ Posterior mean $$ K_{xx}v v := \texttt{Woodbury vector} $$ """ if self._mean is None: self._mean = np.dot(self._K, self.woodbury_vector) return self._mean
def mean(self): """ Posterior mean $$ K_{xx}v v := \texttt{Woodbury vector} $$ """ if self._mean is None: self._mean = np.dot(self._K, self.woodbury_vector) return self._mean
[ "Posterior", "mean", "$$", "K_", "{", "xx", "}", "v", "v", ":", "=", "\\", "texttt", "{", "Woodbury", "vector", "}", "$$" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/posterior.py#L80-L90
[ "def", "mean", "(", "self", ")", ":", "if", "self", ".", "_mean", "is", "None", ":", "self", ".", "_mean", "=", "np", ".", "dot", "(", "self", ".", "_K", ",", "self", ".", "woodbury_vector", ")", "return", "self", ".", "_mean" ]
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Posterior.covariance
Posterior covariance $$ K_{xx} - K_{xx}W_{xx}^{-1}K_{xx} W_{xx} := \texttt{Woodbury inv} $$
GPy/inference/latent_function_inference/posterior.py
def covariance(self): """ Posterior covariance $$ K_{xx} - K_{xx}W_{xx}^{-1}K_{xx} W_{xx} := \texttt{Woodbury inv} $$ """ if self._covariance is None: # LiK, _ = dtrtrs(self.woodbury_chol, self._K, lower=1) self._covariance = ( ...
def covariance(self): """ Posterior covariance $$ K_{xx} - K_{xx}W_{xx}^{-1}K_{xx} W_{xx} := \texttt{Woodbury inv} $$ """ if self._covariance is None: # LiK, _ = dtrtrs(self.woodbury_chol, self._K, lower=1) self._covariance = ( ...
[ "Posterior", "covariance", "$$", "K_", "{", "xx", "}", "-", "K_", "{", "xx", "}", "W_", "{", "xx", "}", "^", "{", "-", "1", "}", "K_", "{", "xx", "}", "W_", "{", "xx", "}", ":", "=", "\\", "texttt", "{", "Woodbury", "inv", "}", "$$" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/posterior.py#L93-L107
[ "def", "covariance", "(", "self", ")", ":", "if", "self", ".", "_covariance", "is", "None", ":", "# LiK, _ = dtrtrs(self.woodbury_chol, self._K, lower=1)", "self", ".", "_covariance", "=", "(", "np", ".", "atleast_3d", "(", "self", ".", "_K", ")", "-", "np", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Posterior.covariance_between_points
Computes the posterior covariance between points. :param kern: GP kernel :param X: current input observations :param X1: some input observations :param X2: other input observations
GPy/inference/latent_function_inference/posterior.py
def covariance_between_points(self, kern, X, X1, X2): """ Computes the posterior covariance between points. :param kern: GP kernel :param X: current input observations :param X1: some input observations :param X2: other input observations """ # ndim == 3 ...
def covariance_between_points(self, kern, X, X1, X2): """ Computes the posterior covariance between points. :param kern: GP kernel :param X: current input observations :param X1: some input observations :param X2: other input observations """ # ndim == 3 ...
[ "Computes", "the", "posterior", "covariance", "between", "points", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/posterior.py#L109-L130
[ "def", "covariance_between_points", "(", "self", ",", "kern", ",", "X", ",", "X1", ",", "X2", ")", ":", "# ndim == 3 is a model for missing data", "if", "self", ".", "woodbury_chol", ".", "ndim", "!=", "2", ":", "raise", "RuntimeError", "(", "\"This method does ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Posterior.precision
Inverse of posterior covariance
GPy/inference/latent_function_inference/posterior.py
def precision(self): """ Inverse of posterior covariance """ if self._precision is None: cov = np.atleast_3d(self.covariance) self._precision = np.zeros(cov.shape) # if one covariance per dimension for p in range(cov.shape[-1]): self._...
def precision(self): """ Inverse of posterior covariance """ if self._precision is None: cov = np.atleast_3d(self.covariance) self._precision = np.zeros(cov.shape) # if one covariance per dimension for p in range(cov.shape[-1]): self._...
[ "Inverse", "of", "posterior", "covariance" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/posterior.py#L133-L142
[ "def", "precision", "(", "self", ")", ":", "if", "self", ".", "_precision", "is", "None", ":", "cov", "=", "np", ".", "atleast_3d", "(", "self", ".", "covariance", ")", "self", ".", "_precision", "=", "np", ".", "zeros", "(", "cov", ".", "shape", "...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Posterior.woodbury_chol
return $L_{W}$ where L is the lower triangular Cholesky decomposition of the Woodbury matrix $$ L_{W}L_{W}^{\top} = W^{-1} W^{-1} := \texttt{Woodbury inv} $$
GPy/inference/latent_function_inference/posterior.py
def woodbury_chol(self): """ return $L_{W}$ where L is the lower triangular Cholesky decomposition of the Woodbury matrix $$ L_{W}L_{W}^{\top} = W^{-1} W^{-1} := \texttt{Woodbury inv} $$ """ if self._woodbury_chol is None: # compute woodbury ch...
def woodbury_chol(self): """ return $L_{W}$ where L is the lower triangular Cholesky decomposition of the Woodbury matrix $$ L_{W}L_{W}^{\top} = W^{-1} W^{-1} := \texttt{Woodbury inv} $$ """ if self._woodbury_chol is None: # compute woodbury ch...
[ "return", "$L_", "{", "W", "}", "$", "where", "L", "is", "the", "lower", "triangular", "Cholesky", "decomposition", "of", "the", "Woodbury", "matrix", "$$", "L_", "{", "W", "}", "L_", "{", "W", "}", "^", "{", "\\", "top", "}", "=", "W^", "{", "-"...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/posterior.py#L145-L174
[ "def", "woodbury_chol", "(", "self", ")", ":", "if", "self", ".", "_woodbury_chol", "is", "None", ":", "# compute woodbury chol from", "if", "self", ".", "_woodbury_inv", "is", "not", "None", ":", "winv", "=", "np", ".", "atleast_3d", "(", "self", ".", "_w...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Posterior.woodbury_inv
The inverse of the woodbury matrix, in the gaussian likelihood case it is defined as $$ (K_{xx} + \Sigma_{xx})^{-1} \Sigma_{xx} := \texttt{Likelihood.variance / Approximate likelihood covariance} $$
GPy/inference/latent_function_inference/posterior.py
def woodbury_inv(self): """ The inverse of the woodbury matrix, in the gaussian likelihood case it is defined as $$ (K_{xx} + \Sigma_{xx})^{-1} \Sigma_{xx} := \texttt{Likelihood.variance / Approximate likelihood covariance} $$ """ if self._woodbury_inv is ...
def woodbury_inv(self): """ The inverse of the woodbury matrix, in the gaussian likelihood case it is defined as $$ (K_{xx} + \Sigma_{xx})^{-1} \Sigma_{xx} := \texttt{Likelihood.variance / Approximate likelihood covariance} $$ """ if self._woodbury_inv is ...
[ "The", "inverse", "of", "the", "woodbury", "matrix", "in", "the", "gaussian", "likelihood", "case", "it", "is", "defined", "as", "$$", "(", "K_", "{", "xx", "}", "+", "\\", "Sigma_", "{", "xx", "}", ")", "^", "{", "-", "1", "}", "\\", "Sigma_", "...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/posterior.py#L177-L196
[ "def", "woodbury_inv", "(", "self", ")", ":", "if", "self", ".", "_woodbury_inv", "is", "None", ":", "if", "self", ".", "_woodbury_chol", "is", "not", "None", ":", "self", ".", "_woodbury_inv", ",", "_", "=", "dpotri", "(", "self", ".", "_woodbury_chol",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Posterior.woodbury_vector
Woodbury vector in the gaussian likelihood case only is defined as $$ (K_{xx} + \Sigma)^{-1}Y \Sigma := \texttt{Likelihood.variance / Approximate likelihood covariance} $$
GPy/inference/latent_function_inference/posterior.py
def woodbury_vector(self): """ Woodbury vector in the gaussian likelihood case only is defined as $$ (K_{xx} + \Sigma)^{-1}Y \Sigma := \texttt{Likelihood.variance / Approximate likelihood covariance} $$ """ if self._woodbury_vector is None: sel...
def woodbury_vector(self): """ Woodbury vector in the gaussian likelihood case only is defined as $$ (K_{xx} + \Sigma)^{-1}Y \Sigma := \texttt{Likelihood.variance / Approximate likelihood covariance} $$ """ if self._woodbury_vector is None: sel...
[ "Woodbury", "vector", "in", "the", "gaussian", "likelihood", "case", "only", "is", "defined", "as", "$$", "(", "K_", "{", "xx", "}", "+", "\\", "Sigma", ")", "^", "{", "-", "1", "}", "Y", "\\", "Sigma", ":", "=", "\\", "texttt", "{", "Likelihood", ...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/posterior.py#L199-L209
[ "def", "woodbury_vector", "(", "self", ")", ":", "if", "self", ".", "_woodbury_vector", "is", "None", ":", "self", ".", "_woodbury_vector", ",", "_", "=", "dpotrs", "(", "self", ".", "K_chol", ",", "self", ".", "mean", "-", "self", ".", "_prior_mean", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Posterior.K_chol
Cholesky of the prior covariance K
GPy/inference/latent_function_inference/posterior.py
def K_chol(self): """ Cholesky of the prior covariance K """ if self._K_chol is None: self._K_chol = jitchol(self._K) return self._K_chol
def K_chol(self): """ Cholesky of the prior covariance K """ if self._K_chol is None: self._K_chol = jitchol(self._K) return self._K_chol
[ "Cholesky", "of", "the", "prior", "covariance", "K" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/posterior.py#L212-L218
[ "def", "K_chol", "(", "self", ")", ":", "if", "self", ".", "_K_chol", "is", "None", ":", "self", ".", "_K_chol", "=", "jitchol", "(", "self", ".", "_K", ")", "return", "self", ".", "_K_chol" ]
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Gibbs.Kdiag
Compute the diagonal of the covariance matrix for X.
GPy/kern/src/todo/gibbs.py
def Kdiag(self, X, target): """Compute the diagonal of the covariance matrix for X.""" np.add(target, self.variance, target)
def Kdiag(self, X, target): """Compute the diagonal of the covariance matrix for X.""" np.add(target, self.variance, target)
[ "Compute", "the", "diagonal", "of", "the", "covariance", "matrix", "for", "X", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/gibbs.py#L84-L86
[ "def", "Kdiag", "(", "self", ",", "X", ",", "target", ")", ":", "np", ".", "add", "(", "target", ",", "self", ".", "variance", ",", "target", ")" ]
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Gibbs._param_grad_helper
Derivative of the covariance with respect to the parameters.
GPy/kern/src/todo/gibbs.py
def _param_grad_helper(self, dL_dK, X, X2, target): """Derivative of the covariance with respect to the parameters.""" self._K_computations(X, X2) self._dK_computations(dL_dK) if X2==None: gmapping = self.mapping.df_dtheta(2*self._dL_dl[:, None], X) else: ...
def _param_grad_helper(self, dL_dK, X, X2, target): """Derivative of the covariance with respect to the parameters.""" self._K_computations(X, X2) self._dK_computations(dL_dK) if X2==None: gmapping = self.mapping.df_dtheta(2*self._dL_dl[:, None], X) else: ...
[ "Derivative", "of", "the", "covariance", "with", "respect", "to", "the", "parameters", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/gibbs.py#L88-L98
[ "def", "_param_grad_helper", "(", "self", ",", "dL_dK", ",", "X", ",", "X2", ",", "target", ")", ":", "self", ".", "_K_computations", "(", "X", ",", "X2", ")", "self", ".", "_dK_computations", "(", "dL_dK", ")", "if", "X2", "==", "None", ":", "gmappi...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Gibbs.gradients_X
Derivative of the covariance matrix with respect to X.
GPy/kern/src/todo/gibbs.py
def gradients_X(self, dL_dK, X, X2, target): """Derivative of the covariance matrix with respect to X.""" # First account for gradients arising from presence of X in exponent. self._K_computations(X, X2) if X2 is None: _K_dist = 2*(X[:, None, :] - X[None, :, :]) else:...
def gradients_X(self, dL_dK, X, X2, target): """Derivative of the covariance matrix with respect to X.""" # First account for gradients arising from presence of X in exponent. self._K_computations(X, X2) if X2 is None: _K_dist = 2*(X[:, None, :] - X[None, :, :]) else:...
[ "Derivative", "of", "the", "covariance", "matrix", "with", "respect", "to", "X", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/gibbs.py#L100-L115
[ "def", "gradients_X", "(", "self", ",", "dL_dK", ",", "X", ",", "X2", ",", "target", ")", ":", "# First account for gradients arising from presence of X in exponent.", "self", ".", "_K_computations", "(", "X", ",", "X2", ")", "if", "X2", "is", "None", ":", "_K...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Gibbs._K_computations
Pre-computations for the covariance function (used both when computing the covariance and its gradients). Here self._dK_dvar and self._K_dist2 are updated.
GPy/kern/src/todo/gibbs.py
def _K_computations(self, X, X2=None): """Pre-computations for the covariance function (used both when computing the covariance and its gradients). Here self._dK_dvar and self._K_dist2 are updated.""" self._lengthscales=self.mapping.f(X) self._lengthscales2=np.square(self._lengthscales) ...
def _K_computations(self, X, X2=None): """Pre-computations for the covariance function (used both when computing the covariance and its gradients). Here self._dK_dvar and self._K_dist2 are updated.""" self._lengthscales=self.mapping.f(X) self._lengthscales2=np.square(self._lengthscales) ...
[ "Pre", "-", "computations", "for", "the", "covariance", "function", "(", "used", "both", "when", "computing", "the", "covariance", "and", "its", "gradients", ")", ".", "Here", "self", ".", "_dK_dvar", "and", "self", ".", "_K_dist2", "are", "updated", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/gibbs.py#L127-L143
[ "def", "_K_computations", "(", "self", ",", "X", ",", "X2", "=", "None", ")", ":", "self", ".", "_lengthscales", "=", "self", ".", "mapping", ".", "f", "(", "X", ")", "self", ".", "_lengthscales2", "=", "np", ".", "square", "(", "self", ".", "_leng...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Gibbs._dK_computations
Pre-computations for the gradients of the covaraince function. Here the gradient of the covariance with respect to all the individual lengthscales is computed. :param dL_dK: the gradient of the objective with respect to the covariance function. :type dL_dK: ndarray
GPy/kern/src/todo/gibbs.py
def _dK_computations(self, dL_dK): """Pre-computations for the gradients of the covaraince function. Here the gradient of the covariance with respect to all the individual lengthscales is computed. :param dL_dK: the gradient of the objective with respect to the covariance function. :type dL_dK: ...
def _dK_computations(self, dL_dK): """Pre-computations for the gradients of the covaraince function. Here the gradient of the covariance with respect to all the individual lengthscales is computed. :param dL_dK: the gradient of the objective with respect to the covariance function. :type dL_dK: ...
[ "Pre", "-", "computations", "for", "the", "gradients", "of", "the", "covaraince", "function", ".", "Here", "the", "gradient", "of", "the", "covariance", "with", "respect", "to", "all", "the", "individual", "lengthscales", "is", "computed", ".", ":", "param", ...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/gibbs.py#L145-L154
[ "def", "_dK_computations", "(", "self", ",", "dL_dK", ")", ":", "self", ".", "_dL_dl", "=", "(", "dL_dK", "*", "self", ".", "variance", "*", "self", ".", "_K_dvar", "*", "(", "self", ".", "input_dim", "/", "2.", "*", "(", "self", ".", "_lengthscales_...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
CombinationKernel.input_sensitivity
If summize is true, we want to get the summerized view of the sensitivities, otherwise put everything into an array with shape (#kernels, input_dim) in the order of appearance of the kernels in the parameterized object.
GPy/kern/src/kern.py
def input_sensitivity(self, summarize=True): """ If summize is true, we want to get the summerized view of the sensitivities, otherwise put everything into an array with shape (#kernels, input_dim) in the order of appearance of the kernels in the parameterized object. """ ...
def input_sensitivity(self, summarize=True): """ If summize is true, we want to get the summerized view of the sensitivities, otherwise put everything into an array with shape (#kernels, input_dim) in the order of appearance of the kernels in the parameterized object. """ ...
[ "If", "summize", "is", "true", "we", "want", "to", "get", "the", "summerized", "view", "of", "the", "sensitivities", "otherwise", "put", "everything", "into", "an", "array", "with", "shape", "(", "#kernels", "input_dim", ")", "in", "the", "order", "of", "a...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/kern.py#L412-L431
[ "def", "input_sensitivity", "(", "self", ",", "summarize", "=", "True", ")", ":", "if", "not", "summarize", ":", "num_params", "=", "[", "0", "]", "parts", "=", "[", "]", "def", "sum_params", "(", "x", ")", ":", "if", "(", "not", "isinstance", "(", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
_simulate_matern
Simulate some data drawn from a matern covariance and a periodic exponential for use in MRD demos.
GPy/examples/dimensionality_reduction.py
def _simulate_matern(D1, D2, D3, N, num_inducing, plot_sim=False): """Simulate some data drawn from a matern covariance and a periodic exponential for use in MRD demos.""" Q_signal = 4 import GPy import numpy as np np.random.seed(3000) k = GPy.kern.Matern32(Q_signal, 1., lengthscale=(np.random....
def _simulate_matern(D1, D2, D3, N, num_inducing, plot_sim=False): """Simulate some data drawn from a matern covariance and a periodic exponential for use in MRD demos.""" Q_signal = 4 import GPy import numpy as np np.random.seed(3000) k = GPy.kern.Matern32(Q_signal, 1., lengthscale=(np.random....
[ "Simulate", "some", "data", "drawn", "from", "a", "matern", "covariance", "and", "a", "periodic", "exponential", "for", "use", "in", "MRD", "demos", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/dimensionality_reduction.py#L217-L255
[ "def", "_simulate_matern", "(", "D1", ",", "D2", ",", "D3", ",", "N", ",", "num_inducing", ",", "plot_sim", "=", "False", ")", ":", "Q_signal", "=", "4", "import", "GPy", "import", "numpy", "as", "np", "np", ".", "random", ".", "seed", "(", "3000", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
_simulate_sincos
Simulate some data drawn from sine and cosine for use in demos of MRD
GPy/examples/dimensionality_reduction.py
def _simulate_sincos(D1, D2, D3, N, num_inducing, plot_sim=False): """Simulate some data drawn from sine and cosine for use in demos of MRD""" _np.random.seed(1234) x = _np.linspace(0, 4 * _np.pi, N)[:, None] s1 = _np.vectorize(lambda x: _np.sin(x)) s2 = _np.vectorize(lambda x: _np.cos(x)) s3 =...
def _simulate_sincos(D1, D2, D3, N, num_inducing, plot_sim=False): """Simulate some data drawn from sine and cosine for use in demos of MRD""" _np.random.seed(1234) x = _np.linspace(0, 4 * _np.pi, N)[:, None] s1 = _np.vectorize(lambda x: _np.sin(x)) s2 = _np.vectorize(lambda x: _np.cos(x)) s3 =...
[ "Simulate", "some", "data", "drawn", "from", "sine", "and", "cosine", "for", "use", "in", "demos", "of", "MRD" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/dimensionality_reduction.py#L257-L301
[ "def", "_simulate_sincos", "(", "D1", ",", "D2", ",", "D3", ",", "N", ",", "num_inducing", ",", "plot_sim", "=", "False", ")", ":", "_np", ".", "random", ".", "seed", "(", "1234", ")", "x", "=", "_np", ".", "linspace", "(", "0", ",", "4", "*", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
stick_bgplvm
Interactive visualisation of the Stick Man data from Ohio State University with the Bayesian GPLVM.
GPy/examples/dimensionality_reduction.py
def stick_bgplvm(model=None, optimize=True, verbose=True, plot=True): """Interactive visualisation of the Stick Man data from Ohio State University with the Bayesian GPLVM.""" from GPy.models import BayesianGPLVM from matplotlib import pyplot as plt import numpy as np import GPy import pods ...
def stick_bgplvm(model=None, optimize=True, verbose=True, plot=True): """Interactive visualisation of the Stick Man data from Ohio State University with the Bayesian GPLVM.""" from GPy.models import BayesianGPLVM from matplotlib import pyplot as plt import numpy as np import GPy import pods ...
[ "Interactive", "visualisation", "of", "the", "Stick", "Man", "data", "from", "Ohio", "State", "University", "with", "the", "Bayesian", "GPLVM", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/examples/dimensionality_reduction.py#L640-L674
[ "def", "stick_bgplvm", "(", "model", "=", "None", ",", "optimize", "=", "True", ",", "verbose", "=", "True", ",", "plot", "=", "True", ")", ":", "from", "GPy", ".", "models", "import", "BayesianGPLVM", "from", "matplotlib", "import", "pyplot", "as", "plt...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
get_log_likelihood
Get the LL of a combined set of clusters, ignoring time series offsets. Get the log likelihood of a cluster without worrying about the fact different time series are offset. We're using it here really for those cases in which we only have one cluster to get the loglikelihood of. arguments: ...
GPy/util/cluster_with_offset.py
def get_log_likelihood(inputs,data,clust): """Get the LL of a combined set of clusters, ignoring time series offsets. Get the log likelihood of a cluster without worrying about the fact different time series are offset. We're using it here really for those cases in which we only have one cluster to...
def get_log_likelihood(inputs,data,clust): """Get the LL of a combined set of clusters, ignoring time series offsets. Get the log likelihood of a cluster without worrying about the fact different time series are offset. We're using it here really for those cases in which we only have one cluster to...
[ "Get", "the", "LL", "of", "a", "combined", "set", "of", "clusters", "ignoring", "time", "series", "offsets", ".", "Get", "the", "log", "likelihood", "of", "a", "cluster", "without", "worrying", "about", "the", "fact", "different", "time", "series", "are", ...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/cluster_with_offset.py#L8-L46
[ "def", "get_log_likelihood", "(", "inputs", ",", "data", ",", "clust", ")", ":", "S", "=", "data", "[", "0", "]", ".", "shape", "[", "0", "]", "#number of time series", "#build a new dataset from the clusters, by combining all clusters together", "X", "=", "np", "...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
get_log_likelihood_offset
Get the log likelihood of a combined set of clusters, fitting the offsets arguments: inputs -- the 'X's in a list, one item per cluster data -- the 'Y's in a list, one item per cluster clust -- list of clusters to use returns a tuple: log likelihood and the offset
GPy/util/cluster_with_offset.py
def get_log_likelihood_offset(inputs,data,clust): """Get the log likelihood of a combined set of clusters, fitting the offsets arguments: inputs -- the 'X's in a list, one item per cluster data -- the 'Y's in a list, one item per cluster clust -- list of clusters to use returns a tuple...
def get_log_likelihood_offset(inputs,data,clust): """Get the log likelihood of a combined set of clusters, fitting the offsets arguments: inputs -- the 'X's in a list, one item per cluster data -- the 'Y's in a list, one item per cluster clust -- list of clusters to use returns a tuple...
[ "Get", "the", "log", "likelihood", "of", "a", "combined", "set", "of", "clusters", "fitting", "the", "offsets", "arguments", ":", "inputs", "--", "the", "X", "s", "in", "a", "list", "one", "item", "per", "cluster", "data", "--", "the", "Y", "s", "in", ...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/cluster_with_offset.py#L48-L89
[ "def", "get_log_likelihood_offset", "(", "inputs", ",", "data", ",", "clust", ")", ":", "#if we've only got one cluster, the model has an error, so we want to just", "#use normal GPRegression.", "if", "len", "(", "clust", ")", "==", "1", ":", "return", "get_log_likelihood",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
cluster
Clusters data Using the new offset model, this method uses a greedy algorithm to cluster the data. It starts with all the data points in separate clusters and tests whether combining them increases the overall log-likelihood (LL). It then iteratively joins pairs of clusters which cause the greatest...
GPy/util/cluster_with_offset.py
def cluster(data,inputs,verbose=False): """Clusters data Using the new offset model, this method uses a greedy algorithm to cluster the data. It starts with all the data points in separate clusters and tests whether combining them increases the overall log-likelihood (LL). It then iteratively j...
def cluster(data,inputs,verbose=False): """Clusters data Using the new offset model, this method uses a greedy algorithm to cluster the data. It starts with all the data points in separate clusters and tests whether combining them increases the overall log-likelihood (LL). It then iteratively j...
[ "Clusters", "data", "Using", "the", "new", "offset", "model", "this", "method", "uses", "a", "greedy", "algorithm", "to", "cluster", "the", "data", ".", "It", "starts", "with", "all", "the", "data", "points", "in", "separate", "clusters", "and", "tests", "...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/cluster_with_offset.py#L91-L179
[ "def", "cluster", "(", "data", ",", "inputs", ",", "verbose", "=", "False", ")", ":", "N", "=", "len", "(", "data", ")", "#Define a set of N active cluster", "active", "=", "[", "]", "for", "p", "in", "range", "(", "0", ",", "N", ")", ":", "active", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Hetero.K
Return covariance between X and X2.
GPy/kern/src/todo/hetero.py
def K(self, X, X2, target): """Return covariance between X and X2.""" if (X2 is None) or (X2 is X): target[np.diag_indices_from(target)] += self._Kdiag(X)
def K(self, X, X2, target): """Return covariance between X and X2.""" if (X2 is None) or (X2 is X): target[np.diag_indices_from(target)] += self._Kdiag(X)
[ "Return", "covariance", "between", "X", "and", "X2", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/hetero.py#L70-L73
[ "def", "K", "(", "self", ",", "X", ",", "X2", ",", "target", ")", ":", "if", "(", "X2", "is", "None", ")", "or", "(", "X2", "is", "X", ")", ":", "target", "[", "np", ".", "diag_indices_from", "(", "target", ")", "]", "+=", "self", ".", "_Kdia...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Hetero._param_grad_helper
Derivative of the covariance with respect to the parameters.
GPy/kern/src/todo/hetero.py
def _param_grad_helper(self, dL_dK, X, X2, target): """Derivative of the covariance with respect to the parameters.""" if (X2 is None) or (X2 is X): dL_dKdiag = dL_dK.flat[::dL_dK.shape[0]+1] self.dKdiag_dtheta(dL_dKdiag, X, target)
def _param_grad_helper(self, dL_dK, X, X2, target): """Derivative of the covariance with respect to the parameters.""" if (X2 is None) or (X2 is X): dL_dKdiag = dL_dK.flat[::dL_dK.shape[0]+1] self.dKdiag_dtheta(dL_dKdiag, X, target)
[ "Derivative", "of", "the", "covariance", "with", "respect", "to", "the", "parameters", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/hetero.py#L83-L87
[ "def", "_param_grad_helper", "(", "self", ",", "dL_dK", ",", "X", ",", "X2", ",", "target", ")", ":", "if", "(", "X2", "is", "None", ")", "or", "(", "X2", "is", "X", ")", ":", "dL_dKdiag", "=", "dL_dK", ".", "flat", "[", ":", ":", "dL_dK", ".",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Hetero.dKdiag_dtheta
Gradient of diagonal of covariance with respect to parameters.
GPy/kern/src/todo/hetero.py
def dKdiag_dtheta(self, dL_dKdiag, X, target): """Gradient of diagonal of covariance with respect to parameters.""" target += 2.*self.mapping.df_dtheta(dL_dKdiag[:, None]*self.mapping.f(X), X)
def dKdiag_dtheta(self, dL_dKdiag, X, target): """Gradient of diagonal of covariance with respect to parameters.""" target += 2.*self.mapping.df_dtheta(dL_dKdiag[:, None]*self.mapping.f(X), X)
[ "Gradient", "of", "diagonal", "of", "covariance", "with", "respect", "to", "parameters", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/hetero.py#L89-L91
[ "def", "dKdiag_dtheta", "(", "self", ",", "dL_dKdiag", ",", "X", ",", "target", ")", ":", "target", "+=", "2.", "*", "self", ".", "mapping", ".", "df_dtheta", "(", "dL_dKdiag", "[", ":", ",", "None", "]", "*", "self", ".", "mapping", ".", "f", "(",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Hetero.gradients_X
Derivative of the covariance matrix with respect to X.
GPy/kern/src/todo/hetero.py
def gradients_X(self, dL_dK, X, X2, target): """Derivative of the covariance matrix with respect to X.""" if X2==None or X2 is X: dL_dKdiag = dL_dK.flat[::dL_dK.shape[0]+1] self.dKdiag_dX(dL_dKdiag, X, target)
def gradients_X(self, dL_dK, X, X2, target): """Derivative of the covariance matrix with respect to X.""" if X2==None or X2 is X: dL_dKdiag = dL_dK.flat[::dL_dK.shape[0]+1] self.dKdiag_dX(dL_dKdiag, X, target)
[ "Derivative", "of", "the", "covariance", "matrix", "with", "respect", "to", "X", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/hetero.py#L93-L97
[ "def", "gradients_X", "(", "self", ",", "dL_dK", ",", "X", ",", "X2", ",", "target", ")", ":", "if", "X2", "==", "None", "or", "X2", "is", "X", ":", "dL_dKdiag", "=", "dL_dK", ".", "flat", "[", ":", ":", "dL_dK", ".", "shape", "[", "0", "]", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Hetero.dKdiag_dX
Gradient of diagonal of covariance with respect to X.
GPy/kern/src/todo/hetero.py
def dKdiag_dX(self, dL_dKdiag, X, target): """Gradient of diagonal of covariance with respect to X.""" target += 2.*self.mapping.df_dX(dL_dKdiag[:, None], X)*self.mapping.f(X)
def dKdiag_dX(self, dL_dKdiag, X, target): """Gradient of diagonal of covariance with respect to X.""" target += 2.*self.mapping.df_dX(dL_dKdiag[:, None], X)*self.mapping.f(X)
[ "Gradient", "of", "diagonal", "of", "covariance", "with", "respect", "to", "X", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/kern/src/todo/hetero.py#L99-L101
[ "def", "dKdiag_dX", "(", "self", ",", "dL_dKdiag", ",", "X", ",", "target", ")", ":", "target", "+=", "2.", "*", "self", ".", "mapping", ".", "df_dX", "(", "dL_dKdiag", "[", ":", ",", "None", "]", ",", "X", ")", "*", "self", ".", "mapping", ".", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
LogLogistic.logpdf_link
Log Likelihood Function given link(f) .. math:: :param link_f: latent variables (link(f)) :type link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: includes censoring information in dictionary key 'censored' :returns: likelihood evaluated for...
GPy/likelihoods/loglogistic.py
def logpdf_link(self, link_f, y, Y_metadata=None): """ Log Likelihood Function given link(f) .. math:: :param link_f: latent variables (link(f)) :type link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: includes censoring information ...
def logpdf_link(self, link_f, y, Y_metadata=None): """ Log Likelihood Function given link(f) .. math:: :param link_f: latent variables (link(f)) :type link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: includes censoring information ...
[ "Log", "Likelihood", "Function", "given", "link", "(", "f", ")" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loglogistic.py#L52-L88
[ "def", "logpdf_link", "(", "self", ",", "link_f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "# c = np.zeros((y.shape[0],))", "c", "=", "np", ".", "zeros_like", "(", "link_f", ")", "if", "Y_metadata", "is", "not", "None", "and", "'censored'", "in"...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
LogLogistic.dlogpdf_dlink
Gradient of the log likelihood function at y, given link(f) w.r.t link(f) .. math:: :param link_f: latent variables (f) :type link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: includes censoring information in dictionary key 'censored' :retu...
GPy/likelihoods/loglogistic.py
def dlogpdf_dlink(self, link_f, y, Y_metadata=None): """ Gradient of the log likelihood function at y, given link(f) w.r.t link(f) .. math:: :param link_f: latent variables (f) :type link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: ...
def dlogpdf_dlink(self, link_f, y, Y_metadata=None): """ Gradient of the log likelihood function at y, given link(f) w.r.t link(f) .. math:: :param link_f: latent variables (f) :type link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: ...
[ "Gradient", "of", "the", "log", "likelihood", "function", "at", "y", "given", "link", "(", "f", ")", "w", ".", "r", ".", "t", "link", "(", "f", ")" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loglogistic.py#L91-L122
[ "def", "dlogpdf_dlink", "(", "self", ",", "link_f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "# c = Y_metadata['censored']", "# for debugging", "# c = np.zeros((y.shape[0],))", "c", "=", "np", ".", "zeros_like", "(", "link_f", ")", "if", "Y_metadata", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
LogLogistic.d2logpdf_dlink2
Hessian at y, given link(f), w.r.t link(f) i.e. second derivative logpdf at y given link(f_i) and link(f_j) w.r.t link(f_i) and link(f_j) The hessian will be 0 unless i == j .. math:: :param link_f: latent variables link(f) :type link_f: Nx1 array :param y: data ...
GPy/likelihoods/loglogistic.py
def d2logpdf_dlink2(self, link_f, y, Y_metadata=None): """ Hessian at y, given link(f), w.r.t link(f) i.e. second derivative logpdf at y given link(f_i) and link(f_j) w.r.t link(f_i) and link(f_j) The hessian will be 0 unless i == j .. math:: :param link_f: latent var...
def d2logpdf_dlink2(self, link_f, y, Y_metadata=None): """ Hessian at y, given link(f), w.r.t link(f) i.e. second derivative logpdf at y given link(f_i) and link(f_j) w.r.t link(f_i) and link(f_j) The hessian will be 0 unless i == j .. math:: :param link_f: latent var...
[ "Hessian", "at", "y", "given", "link", "(", "f", ")", "w", ".", "r", ".", "t", "link", "(", "f", ")", "i", ".", "e", ".", "second", "derivative", "logpdf", "at", "y", "given", "link", "(", "f_i", ")", "and", "link", "(", "f_j", ")", "w", ".",...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loglogistic.py#L125-L160
[ "def", "d2logpdf_dlink2", "(", "self", ",", "link_f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "# c = Y_metadata['censored']", "# c = np.zeros((y.shape[0],))", "c", "=", "np", ".", "zeros_like", "(", "link_f", ")", "if", "Y_metadata", "is", "not", "...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
LogLogistic.d3logpdf_dlink3
Third order derivative log-likelihood function at y given link(f) w.r.t link(f) .. math:: :param link_f: latent variables link(f) :type link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: includes censoring information in dictionary key 'censored' ...
GPy/likelihoods/loglogistic.py
def d3logpdf_dlink3(self, link_f, y, Y_metadata=None): """ Third order derivative log-likelihood function at y given link(f) w.r.t link(f) .. math:: :param link_f: latent variables link(f) :type link_f: Nx1 array :param y: data :type y: Nx1 array :param...
def d3logpdf_dlink3(self, link_f, y, Y_metadata=None): """ Third order derivative log-likelihood function at y given link(f) w.r.t link(f) .. math:: :param link_f: latent variables link(f) :type link_f: Nx1 array :param y: data :type y: Nx1 array :param...
[ "Third", "order", "derivative", "log", "-", "likelihood", "function", "at", "y", "given", "link", "(", "f", ")", "w", ".", "r", ".", "t", "link", "(", "f", ")" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loglogistic.py#L162-L194
[ "def", "d3logpdf_dlink3", "(", "self", ",", "link_f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "# c = Y_metadata['censored']", "# for debugging", "# c = np.zeros((y.shape[0],))", "c", "=", "np", ".", "zeros_like", "(", "link_f", ")", "if", "Y_metadata"...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
LogLogistic.dlogpdf_link_dr
Gradient of the log-likelihood function at y given f, w.r.t shape parameter .. math:: :param inv_link_f: latent variables link(f) :type inv_link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: includes censoring information in dictionary key 'censored'...
GPy/likelihoods/loglogistic.py
def dlogpdf_link_dr(self, inv_link_f, y, Y_metadata=None): """ Gradient of the log-likelihood function at y given f, w.r.t shape parameter .. math:: :param inv_link_f: latent variables link(f) :type inv_link_f: Nx1 array :param y: data :type y: Nx1 array ...
def dlogpdf_link_dr(self, inv_link_f, y, Y_metadata=None): """ Gradient of the log-likelihood function at y given f, w.r.t shape parameter .. math:: :param inv_link_f: latent variables link(f) :type inv_link_f: Nx1 array :param y: data :type y: Nx1 array ...
[ "Gradient", "of", "the", "log", "-", "likelihood", "function", "at", "y", "given", "f", "w", ".", "r", ".", "t", "shape", "parameter" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loglogistic.py#L196-L226
[ "def", "dlogpdf_link_dr", "(", "self", ",", "inv_link_f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "# c = Y_metadata['censored']", "# c = np.zeros((y.shape[0],))", "c", "=", "np", ".", "zeros_like", "(", "y", ")", "if", "Y_metadata", "is", "not", "N...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
LogLogistic.d2logpdf_dlink2_dr
Gradient of the hessian (d2logpdf_dlink2) w.r.t shape parameter .. math:: :param inv_link_f: latent variables link(f) :type inv_link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadata: includes censoring information in dictionary key 'censored' :re...
GPy/likelihoods/loglogistic.py
def d2logpdf_dlink2_dr(self, inv_link_f, y, Y_metadata=None): """ Gradient of the hessian (d2logpdf_dlink2) w.r.t shape parameter .. math:: :param inv_link_f: latent variables link(f) :type inv_link_f: Nx1 array :param y: data :type y: Nx1 array :param Y...
def d2logpdf_dlink2_dr(self, inv_link_f, y, Y_metadata=None): """ Gradient of the hessian (d2logpdf_dlink2) w.r.t shape parameter .. math:: :param inv_link_f: latent variables link(f) :type inv_link_f: Nx1 array :param y: data :type y: Nx1 array :param Y...
[ "Gradient", "of", "the", "hessian", "(", "d2logpdf_dlink2", ")", "w", ".", "r", ".", "t", "shape", "parameter" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/loglogistic.py#L259-L301
[ "def", "d2logpdf_dlink2_dr", "(", "self", ",", "inv_link_f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "# c = Y_metadata['censored']", "# c = np.zeros((y.shape[0],))", "c", "=", "np", ".", "zeros_like", "(", "y", ")", "if", "Y_metadata", "is", "not", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
GPMultioutRegression.optimize_auto
Optimize the model parameters through a pre-defined protocol. :param int max_iters: the maximum number of iterations. :param boolean verbose: print the progress of optimization or not.
GPy/models/gp_multiout_regression.py
def optimize_auto(self,max_iters=10000,verbose=True): """ Optimize the model parameters through a pre-defined protocol. :param int max_iters: the maximum number of iterations. :param boolean verbose: print the progress of optimization or not. """ self.Z.fix(warning=False...
def optimize_auto(self,max_iters=10000,verbose=True): """ Optimize the model parameters through a pre-defined protocol. :param int max_iters: the maximum number of iterations. :param boolean verbose: print the progress of optimization or not. """ self.Z.fix(warning=False...
[ "Optimize", "the", "model", "parameters", "through", "a", "pre", "-", "defined", "protocol", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/models/gp_multiout_regression.py#L178-L192
[ "def", "optimize_auto", "(", "self", ",", "max_iters", "=", "10000", ",", "verbose", "=", "True", ")", ":", "self", ".", "Z", ".", "fix", "(", "warning", "=", "False", ")", "self", ".", "kern", ".", "fix", "(", "warning", "=", "False", ")", "self",...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
ln_diff_erfs
Function for stably computing the log of difference of two erfs in a numerically stable manner. :param x1 : argument of the positive erf :type x1: ndarray :param x2 : argument of the negative erf :type x2: ndarray :return: tuple containing (log(abs(erf(x1) - erf(x2))), sign(erf(x1) - erf(x2))) ...
GPy/util/ln_diff_erfs.py
def ln_diff_erfs(x1, x2, return_sign=False): """Function for stably computing the log of difference of two erfs in a numerically stable manner. :param x1 : argument of the positive erf :type x1: ndarray :param x2 : argument of the negative erf :type x2: ndarray :return: tuple containing (log(abs...
def ln_diff_erfs(x1, x2, return_sign=False): """Function for stably computing the log of difference of two erfs in a numerically stable manner. :param x1 : argument of the positive erf :type x1: ndarray :param x2 : argument of the negative erf :type x2: ndarray :return: tuple containing (log(abs...
[ "Function", "for", "stably", "computing", "the", "log", "of", "difference", "of", "two", "erfs", "in", "a", "numerically", "stable", "manner", ".", ":", "param", "x1", ":", "argument", "of", "the", "positive", "erf", ":", "type", "x1", ":", "ndarray", ":...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/ln_diff_erfs.py#L8-L105
[ "def", "ln_diff_erfs", "(", "x1", ",", "x2", ",", "return_sign", "=", "False", ")", ":", "x1", "=", "np", ".", "require", "(", "x1", ")", ".", "real", "x2", "=", "np", ".", "require", "(", "x2", ")", ".", "real", "if", "x1", ".", "size", "==", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
ExactGaussianInference.inference
Returns a Posterior class containing essential quantities of the posterior
GPy/inference/latent_function_inference/exact_gaussian_inference.py
def inference(self, kern, X, likelihood, Y, mean_function=None, Y_metadata=None, K=None, variance=None, Z_tilde=None): """ Returns a Posterior class containing essential quantities of the posterior """ if mean_function is None: m = 0 else: m = mean_functi...
def inference(self, kern, X, likelihood, Y, mean_function=None, Y_metadata=None, K=None, variance=None, Z_tilde=None): """ Returns a Posterior class containing essential quantities of the posterior """ if mean_function is None: m = 0 else: m = mean_functi...
[ "Returns", "a", "Posterior", "class", "containing", "essential", "quantities", "of", "the", "posterior" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/exact_gaussian_inference.py#L37-L74
[ "def", "inference", "(", "self", ",", "kern", ",", "X", ",", "likelihood", ",", "Y", ",", "mean_function", "=", "None", ",", "Y_metadata", "=", "None", ",", "K", "=", "None", ",", "variance", "=", "None", ",", "Z_tilde", "=", "None", ")", ":", "if"...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
ExactGaussianInference.LOO
Leave one out error as found in "Bayesian leave-one-out cross-validation approximations for Gaussian latent variable models" Vehtari et al. 2014.
GPy/inference/latent_function_inference/exact_gaussian_inference.py
def LOO(self, kern, X, Y, likelihood, posterior, Y_metadata=None, K=None): """ Leave one out error as found in "Bayesian leave-one-out cross-validation approximations for Gaussian latent variable models" Vehtari et al. 2014. """ g = posterior.woodbury_vector c = p...
def LOO(self, kern, X, Y, likelihood, posterior, Y_metadata=None, K=None): """ Leave one out error as found in "Bayesian leave-one-out cross-validation approximations for Gaussian latent variable models" Vehtari et al. 2014. """ g = posterior.woodbury_vector c = p...
[ "Leave", "one", "out", "error", "as", "found", "in", "Bayesian", "leave", "-", "one", "-", "out", "cross", "-", "validation", "approximations", "for", "Gaussian", "latent", "variable", "models", "Vehtari", "et", "al", ".", "2014", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/exact_gaussian_inference.py#L76-L88
[ "def", "LOO", "(", "self", ",", "kern", ",", "X", ",", "Y", ",", "likelihood", ",", "posterior", ",", "Y_metadata", "=", "None", ",", "K", "=", "None", ")", ":", "g", "=", "posterior", ".", "woodbury_vector", "c", "=", "posterior", ".", "woodbury_inv...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Laplace.LOO
Leave one out log predictive density as found in "Bayesian leave-one-out cross-validation approximations for Gaussian latent variable models" Vehtari et al. 2014.
GPy/inference/latent_function_inference/laplace.py
def LOO(self, kern, X, Y, likelihood, posterior, Y_metadata=None, K=None, f_hat=None, W=None, Ki_W_i=None): """ Leave one out log predictive density as found in "Bayesian leave-one-out cross-validation approximations for Gaussian latent variable models" Vehtari et al. 2014. """ ...
def LOO(self, kern, X, Y, likelihood, posterior, Y_metadata=None, K=None, f_hat=None, W=None, Ki_W_i=None): """ Leave one out log predictive density as found in "Bayesian leave-one-out cross-validation approximations for Gaussian latent variable models" Vehtari et al. 2014. """ ...
[ "Leave", "one", "out", "log", "predictive", "density", "as", "found", "in", "Bayesian", "leave", "-", "one", "-", "out", "cross", "-", "validation", "approximations", "for", "Gaussian", "latent", "variable", "models", "Vehtari", "et", "al", ".", "2014", "." ...
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/laplace.py#L43-L120
[ "def", "LOO", "(", "self", ",", "kern", ",", "X", ",", "Y", ",", "likelihood", ",", "posterior", ",", "Y_metadata", "=", "None", ",", "K", "=", "None", ",", "f_hat", "=", "None", ",", "W", "=", "None", ",", "Ki_W_i", "=", "None", ")", ":", "Ki_...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Laplace.inference
Returns a Posterior class containing essential quantities of the posterior
GPy/inference/latent_function_inference/laplace.py
def inference(self, kern, X, likelihood, Y, mean_function=None, Y_metadata=None): """ Returns a Posterior class containing essential quantities of the posterior """ assert mean_function is None, "inference with a mean function not implemented" # Compute K K = kern.K(X) ...
def inference(self, kern, X, likelihood, Y, mean_function=None, Y_metadata=None): """ Returns a Posterior class containing essential quantities of the posterior """ assert mean_function is None, "inference with a mean function not implemented" # Compute K K = kern.K(X) ...
[ "Returns", "a", "Posterior", "class", "containing", "essential", "quantities", "of", "the", "posterior" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/laplace.py#L122-L146
[ "def", "inference", "(", "self", ",", "kern", ",", "X", ",", "likelihood", ",", "Y", ",", "mean_function", "=", "None", ",", "Y_metadata", "=", "None", ")", ":", "assert", "mean_function", "is", "None", ",", "\"inference with a mean function not implemented\"", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Laplace.rasm_mode
Rasmussen's numerically stable mode finding For nomenclature see Rasmussen & Williams 2006 Influenced by GPML (BSD) code, all errors are our own :param K: Covariance matrix evaluated at locations X :type K: NxD matrix :param Y: The data :type Y: np.ndarray :param...
GPy/inference/latent_function_inference/laplace.py
def rasm_mode(self, K, Y, likelihood, Ki_f_init, Y_metadata=None, *args, **kwargs): """ Rasmussen's numerically stable mode finding For nomenclature see Rasmussen & Williams 2006 Influenced by GPML (BSD) code, all errors are our own :param K: Covariance matrix evaluated at locat...
def rasm_mode(self, K, Y, likelihood, Ki_f_init, Y_metadata=None, *args, **kwargs): """ Rasmussen's numerically stable mode finding For nomenclature see Rasmussen & Williams 2006 Influenced by GPML (BSD) code, all errors are our own :param K: Covariance matrix evaluated at locat...
[ "Rasmussen", "s", "numerically", "stable", "mode", "finding", "For", "nomenclature", "see", "Rasmussen", "&", "Williams", "2006", "Influenced", "by", "GPML", "(", "BSD", ")", "code", "all", "errors", "are", "our", "own" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/laplace.py#L148-L231
[ "def", "rasm_mode", "(", "self", ",", "K", ",", "Y", ",", "likelihood", ",", "Ki_f_init", ",", "Y_metadata", "=", "None", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "Ki_f", "=", "Ki_f_init", ".", "copy", "(", ")", "f", "=", "np", ".", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Laplace.mode_computations
At the mode, compute the hessian and effective covariance matrix. returns: logZ : approximation to the marginal likelihood woodbury_inv : variable required for calculating the approximation to the covariance matrix dL_dthetaL : array of derivatives (1 x num_kernel_params) ...
GPy/inference/latent_function_inference/laplace.py
def mode_computations(self, f_hat, Ki_f, K, Y, likelihood, kern, Y_metadata): """ At the mode, compute the hessian and effective covariance matrix. returns: logZ : approximation to the marginal likelihood woodbury_inv : variable required for calculating the approximation to the...
def mode_computations(self, f_hat, Ki_f, K, Y, likelihood, kern, Y_metadata): """ At the mode, compute the hessian and effective covariance matrix. returns: logZ : approximation to the marginal likelihood woodbury_inv : variable required for calculating the approximation to the...
[ "At", "the", "mode", "compute", "the", "hessian", "and", "effective", "covariance", "matrix", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/laplace.py#L233-L306
[ "def", "mode_computations", "(", "self", ",", "f_hat", ",", "Ki_f", ",", "K", ",", "Y", ",", "likelihood", ",", "kern", ",", "Y_metadata", ")", ":", "#At this point get the hessian matrix (or vector as W is diagonal)", "W", "=", "-", "likelihood", ".", "d2logpdf_d...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Laplace._compute_B_statistics
Rasmussen suggests the use of a numerically stable positive definite matrix B Which has a positive diagonal elements and can be easily inverted :param K: Prior Covariance matrix evaluated at locations X :type K: NxN matrix :param W: Negative hessian at a point (diagonal matrix) ...
GPy/inference/latent_function_inference/laplace.py
def _compute_B_statistics(self, K, W, log_concave, *args, **kwargs): """ Rasmussen suggests the use of a numerically stable positive definite matrix B Which has a positive diagonal elements and can be easily inverted :param K: Prior Covariance matrix evaluated at locations X :ty...
def _compute_B_statistics(self, K, W, log_concave, *args, **kwargs): """ Rasmussen suggests the use of a numerically stable positive definite matrix B Which has a positive diagonal elements and can be easily inverted :param K: Prior Covariance matrix evaluated at locations X :ty...
[ "Rasmussen", "suggests", "the", "use", "of", "a", "numerically", "stable", "positive", "definite", "matrix", "B", "Which", "has", "a", "positive", "diagonal", "elements", "and", "can", "be", "easily", "inverted" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/laplace.py#L308-L353
[ "def", "_compute_B_statistics", "(", "self", ",", "K", ",", "W", ",", "log_concave", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "log_concave", ":", "#print \"Under 1e-10: {}\".format(np.sum(W < 1e-6))", "W", "=", "np", ".", "clip", "("...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
LaplaceBlock._compute_B_statistics
Rasmussen suggests the use of a numerically stable positive definite matrix B Which has a positive diagonal element and can be easyily inverted :param K: Prior Covariance matrix evaluated at locations X :type K: NxN matrix :param W: Negative hessian at a point (diagonal matrix) ...
GPy/inference/latent_function_inference/laplace.py
def _compute_B_statistics(self, K, W, log_concave, *args, **kwargs): """ Rasmussen suggests the use of a numerically stable positive definite matrix B Which has a positive diagonal element and can be easyily inverted :param K: Prior Covariance matrix evaluated at locations X :ty...
def _compute_B_statistics(self, K, W, log_concave, *args, **kwargs): """ Rasmussen suggests the use of a numerically stable positive definite matrix B Which has a positive diagonal element and can be easyily inverted :param K: Prior Covariance matrix evaluated at locations X :ty...
[ "Rasmussen", "suggests", "the", "use", "of", "a", "numerically", "stable", "positive", "definite", "matrix", "B", "Which", "has", "a", "positive", "diagonal", "element", "and", "can", "be", "easyily", "inverted" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/inference/latent_function_inference/laplace.py#L474-L502
[ "def", "_compute_B_statistics", "(", "self", ",", "K", ",", "W", ",", "log_concave", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "#w = GPy.util.diag.view(W)", "#W[:] = np.where(w<1e-6, 1e-6, w)", "#B = I + KW", "B", "=", "np", ".", "eye", "(", "K", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
_backprop_gradient_pure
Given the derivative of an objective fn with respect to the cholesky L, compute the derivate with respect to the original matrix K, defined as K = LL^T where L was obtained by Cholesky decomposition
GPy/util/choleskies.py
def _backprop_gradient_pure(dL, L): """ Given the derivative of an objective fn with respect to the cholesky L, compute the derivate with respect to the original matrix K, defined as K = LL^T where L was obtained by Cholesky decomposition """ dL_dK = np.tril(dL).copy() N = L.shape[...
def _backprop_gradient_pure(dL, L): """ Given the derivative of an objective fn with respect to the cholesky L, compute the derivate with respect to the original matrix K, defined as K = LL^T where L was obtained by Cholesky decomposition """ dL_dK = np.tril(dL).copy() N = L.shape[...
[ "Given", "the", "derivative", "of", "an", "objective", "fn", "with", "respect", "to", "the", "cholesky", "L", "compute", "the", "derivate", "with", "respect", "to", "the", "original", "matrix", "K", "defined", "as" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/choleskies.py#L57-L77
[ "def", "_backprop_gradient_pure", "(", "dL", ",", "L", ")", ":", "dL_dK", "=", "np", ".", "tril", "(", "dL", ")", ".", "copy", "(", ")", "N", "=", "L", ".", "shape", "[", "0", "]", "for", "k", "in", "range", "(", "N", "-", "1", ",", "-", "1...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
indexes_to_fix_for_low_rank
Work out which indexes of the flatteneed array should be fixed if we want the cholesky to represent a low rank matrix
GPy/util/choleskies.py
def indexes_to_fix_for_low_rank(rank, size): """ Work out which indexes of the flatteneed array should be fixed if we want the cholesky to represent a low rank matrix """ #first we'll work out what to keep, and the do the set difference. #here are the indexes of the first column, which are the ...
def indexes_to_fix_for_low_rank(rank, size): """ Work out which indexes of the flatteneed array should be fixed if we want the cholesky to represent a low rank matrix """ #first we'll work out what to keep, and the do the set difference. #here are the indexes of the first column, which are the ...
[ "Work", "out", "which", "indexes", "of", "the", "flatteneed", "array", "should", "be", "fixed", "if", "we", "want", "the", "cholesky", "to", "represent", "a", "low", "rank", "matrix" ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/choleskies.py#L85-L103
[ "def", "indexes_to_fix_for_low_rank", "(", "rank", ",", "size", ")", ":", "#first we'll work out what to keep, and the do the set difference.", "#here are the indexes of the first column, which are the triangular numbers", "n", "=", "np", ".", "arange", "(", "size", ")", "triangu...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Binomial.pdf_link
Likelihood function given inverse link of f. .. math:: p(y_{i}|\\lambda(f_{i})) = \\lambda(f_{i})^{y_{i}}(1-f_{i})^{1-y_{i}} :param inv_link_f: latent variables inverse link of f. :type inv_link_f: Nx1 array :param y: data :type y: Nx1 array :param Y_metadat...
GPy/likelihoods/binomial.py
def pdf_link(self, inv_link_f, y, Y_metadata): """ Likelihood function given inverse link of f. .. math:: p(y_{i}|\\lambda(f_{i})) = \\lambda(f_{i})^{y_{i}}(1-f_{i})^{1-y_{i}} :param inv_link_f: latent variables inverse link of f. :type inv_link_f: Nx1 array ...
def pdf_link(self, inv_link_f, y, Y_metadata): """ Likelihood function given inverse link of f. .. math:: p(y_{i}|\\lambda(f_{i})) = \\lambda(f_{i})^{y_{i}}(1-f_{i})^{1-y_{i}} :param inv_link_f: latent variables inverse link of f. :type inv_link_f: Nx1 array ...
[ "Likelihood", "function", "given", "inverse", "link", "of", "f", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/binomial.py#L30-L48
[ "def", "pdf_link", "(", "self", ",", "inv_link_f", ",", "y", ",", "Y_metadata", ")", ":", "return", "np", ".", "exp", "(", "self", ".", "logpdf_link", "(", "inv_link_f", ",", "y", ",", "Y_metadata", ")", ")" ]
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Binomial.logpdf_link
Log Likelihood function given inverse link of f. .. math:: \\ln p(y_{i}|\\lambda(f_{i})) = y_{i}\\log\\lambda(f_{i}) + (1-y_{i})\\log (1-f_{i}) :param inv_link_f: latent variables inverse link of f. :type inv_link_f: Nx1 array :param y: data :type y: Nx1 array ...
GPy/likelihoods/binomial.py
def logpdf_link(self, inv_link_f, y, Y_metadata=None): """ Log Likelihood function given inverse link of f. .. math:: \\ln p(y_{i}|\\lambda(f_{i})) = y_{i}\\log\\lambda(f_{i}) + (1-y_{i})\\log (1-f_{i}) :param inv_link_f: latent variables inverse link of f. :type in...
def logpdf_link(self, inv_link_f, y, Y_metadata=None): """ Log Likelihood function given inverse link of f. .. math:: \\ln p(y_{i}|\\lambda(f_{i})) = y_{i}\\log\\lambda(f_{i}) + (1-y_{i})\\log (1-f_{i}) :param inv_link_f: latent variables inverse link of f. :type in...
[ "Log", "Likelihood", "function", "given", "inverse", "link", "of", "f", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/binomial.py#L50-L76
[ "def", "logpdf_link", "(", "self", ",", "inv_link_f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "N", "=", "Y_metadata", "[", "'trials'", "]", "np", ".", "testing", ".", "assert_array_equal", "(", "N", ".", "shape", ",", "y", ".", "shape", "...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Binomial.dlogpdf_dlink
Gradient of the pdf at y, given inverse link of f w.r.t inverse link of f. .. math:: \\frac{d^{2}\\ln p(y_{i}|\\lambda(f_{i}))}{d\\lambda(f)^{2}} = \\frac{y_{i}}{\\lambda(f)} - \\frac{(N-y_{i})}{(1-\\lambda(f))} :param inv_link_f: latent variables inverse link of f. :type inv_link_...
GPy/likelihoods/binomial.py
def dlogpdf_dlink(self, inv_link_f, y, Y_metadata=None): """ Gradient of the pdf at y, given inverse link of f w.r.t inverse link of f. .. math:: \\frac{d^{2}\\ln p(y_{i}|\\lambda(f_{i}))}{d\\lambda(f)^{2}} = \\frac{y_{i}}{\\lambda(f)} - \\frac{(N-y_{i})}{(1-\\lambda(f))} :...
def dlogpdf_dlink(self, inv_link_f, y, Y_metadata=None): """ Gradient of the pdf at y, given inverse link of f w.r.t inverse link of f. .. math:: \\frac{d^{2}\\ln p(y_{i}|\\lambda(f_{i}))}{d\\lambda(f)^{2}} = \\frac{y_{i}}{\\lambda(f)} - \\frac{(N-y_{i})}{(1-\\lambda(f))} :...
[ "Gradient", "of", "the", "pdf", "at", "y", "given", "inverse", "link", "of", "f", "w", ".", "r", ".", "t", "inverse", "link", "of", "f", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/binomial.py#L78-L102
[ "def", "dlogpdf_dlink", "(", "self", ",", "inv_link_f", ",", "y", ",", "Y_metadata", "=", "None", ")", ":", "N", "=", "Y_metadata", "[", "'trials'", "]", "np", ".", "testing", ".", "assert_array_equal", "(", "N", ".", "shape", ",", "y", ".", "shape", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
Binomial.samples
Returns a set of samples of observations based on a given value of the latent variable. :param gp: latent variable
GPy/likelihoods/binomial.py
def samples(self, gp, Y_metadata=None, **kw): """ Returns a set of samples of observations based on a given value of the latent variable. :param gp: latent variable """ orig_shape = gp.shape gp = gp.flatten() N = Y_metadata['trials'] Ysim = np.random.bino...
def samples(self, gp, Y_metadata=None, **kw): """ Returns a set of samples of observations based on a given value of the latent variable. :param gp: latent variable """ orig_shape = gp.shape gp = gp.flatten() N = Y_metadata['trials'] Ysim = np.random.bino...
[ "Returns", "a", "set", "of", "samples", "of", "observations", "based", "on", "a", "given", "value", "of", "the", "latent", "variable", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/likelihoods/binomial.py#L166-L176
[ "def", "samples", "(", "self", ",", "gp", ",", "Y_metadata", "=", "None", ",", "*", "*", "kw", ")", ":", "orig_shape", "=", "gp", ".", "shape", "gp", "=", "gp", ".", "flatten", "(", ")", "N", "=", "Y_metadata", "[", "'trials'", "]", "Ysim", "=", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
imread
Return image data from Netpbm file as numpy array. `args` and `kwargs` are arguments to NetpbmFile.asarray(). Examples -------- >>> image = imread('_tmp.pgm')
GPy/util/netpbmfile.py
def imread(filename, *args, **kwargs): """Return image data from Netpbm file as numpy array. `args` and `kwargs` are arguments to NetpbmFile.asarray(). Examples -------- >>> image = imread('_tmp.pgm') """ try: netpbm = NetpbmFile(filename) image = netpbm.asarray() fina...
def imread(filename, *args, **kwargs): """Return image data from Netpbm file as numpy array. `args` and `kwargs` are arguments to NetpbmFile.asarray(). Examples -------- >>> image = imread('_tmp.pgm') """ try: netpbm = NetpbmFile(filename) image = netpbm.asarray() fina...
[ "Return", "image", "data", "from", "Netpbm", "file", "as", "numpy", "array", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/netpbmfile.py#L79-L94
[ "def", "imread", "(", "filename", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "netpbm", "=", "NetpbmFile", "(", "filename", ")", "image", "=", "netpbm", ".", "asarray", "(", ")", "finally", ":", "netpbm", ".", "close", "(", ")"...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
imsave
Write image data to Netpbm file. Examples -------- >>> image = numpy.array([[0, 1],[65534, 65535]], dtype=numpy.uint16) >>> imsave('_tmp.pgm', image)
GPy/util/netpbmfile.py
def imsave(filename, data, maxval=None, pam=False): """Write image data to Netpbm file. Examples -------- >>> image = numpy.array([[0, 1],[65534, 65535]], dtype=numpy.uint16) >>> imsave('_tmp.pgm', image) """ try: netpbm = NetpbmFile(data, maxval=maxval) netpbm.write(filena...
def imsave(filename, data, maxval=None, pam=False): """Write image data to Netpbm file. Examples -------- >>> image = numpy.array([[0, 1],[65534, 65535]], dtype=numpy.uint16) >>> imsave('_tmp.pgm', image) """ try: netpbm = NetpbmFile(data, maxval=maxval) netpbm.write(filena...
[ "Write", "image", "data", "to", "Netpbm", "file", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/netpbmfile.py#L97-L110
[ "def", "imsave", "(", "filename", ",", "data", ",", "maxval", "=", "None", ",", "pam", "=", "False", ")", ":", "try", ":", "netpbm", "=", "NetpbmFile", "(", "data", ",", "maxval", "=", "maxval", ")", "netpbm", ".", "write", "(", "filename", ",", "p...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
NetpbmFile.asarray
Return image data from file as numpy array.
GPy/util/netpbmfile.py
def asarray(self, copy=True, cache=False, **kwargs): """Return image data from file as numpy array.""" data = self._data if data is None: data = self._read_data(self._fh, **kwargs) if cache: self._data = data else: return data ...
def asarray(self, copy=True, cache=False, **kwargs): """Return image data from file as numpy array.""" data = self._data if data is None: data = self._read_data(self._fh, **kwargs) if cache: self._data = data else: return data ...
[ "Return", "image", "data", "from", "file", "as", "numpy", "array", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/netpbmfile.py#L137-L146
[ "def", "asarray", "(", "self", ",", "copy", "=", "True", ",", "cache", "=", "False", ",", "*", "*", "kwargs", ")", ":", "data", "=", "self", ".", "_data", "if", "data", "is", "None", ":", "data", "=", "self", ".", "_read_data", "(", "self", ".", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
NetpbmFile.write
Write instance to file.
GPy/util/netpbmfile.py
def write(self, arg, **kwargs): """Write instance to file.""" if hasattr(arg, 'seek'): self._tofile(arg, **kwargs) else: with open(arg, 'wb') as fid: self._tofile(fid, **kwargs)
def write(self, arg, **kwargs): """Write instance to file.""" if hasattr(arg, 'seek'): self._tofile(arg, **kwargs) else: with open(arg, 'wb') as fid: self._tofile(fid, **kwargs)
[ "Write", "instance", "to", "file", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/netpbmfile.py#L148-L154
[ "def", "write", "(", "self", ",", "arg", ",", "*", "*", "kwargs", ")", ":", "if", "hasattr", "(", "arg", ",", "'seek'", ")", ":", "self", ".", "_tofile", "(", "arg", ",", "*", "*", "kwargs", ")", "else", ":", "with", "open", "(", "arg", ",", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
NetpbmFile.close
Close open file. Future asarray calls might fail.
GPy/util/netpbmfile.py
def close(self): """Close open file. Future asarray calls might fail.""" if self._filename and self._fh: self._fh.close() self._fh = None
def close(self): """Close open file. Future asarray calls might fail.""" if self._filename and self._fh: self._fh.close() self._fh = None
[ "Close", "open", "file", ".", "Future", "asarray", "calls", "might", "fail", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/netpbmfile.py#L156-L160
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_filename", "and", "self", ".", "_fh", ":", "self", ".", "_fh", ".", "close", "(", ")", "self", ".", "_fh", "=", "None" ]
54c32d79d289d622fb18b898aee65a2a431d90cf
train
NetpbmFile._fromfile
Initialize instance from open file.
GPy/util/netpbmfile.py
def _fromfile(self, fh): """Initialize instance from open file.""" fh.seek(0) data = fh.read(4096) if (len(data) < 7) or not (b'0' < data[1:2] < b'8'): raise ValueError("Not a Netpbm file:\n%s" % data[:32]) try: self._read_pam_header(data) except E...
def _fromfile(self, fh): """Initialize instance from open file.""" fh.seek(0) data = fh.read(4096) if (len(data) < 7) or not (b'0' < data[1:2] < b'8'): raise ValueError("Not a Netpbm file:\n%s" % data[:32]) try: self._read_pam_header(data) except E...
[ "Initialize", "instance", "from", "open", "file", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/netpbmfile.py#L165-L177
[ "def", "_fromfile", "(", "self", ",", "fh", ")", ":", "fh", ".", "seek", "(", "0", ")", "data", "=", "fh", ".", "read", "(", "4096", ")", "if", "(", "len", "(", "data", ")", "<", "7", ")", "or", "not", "(", "b'0'", "<", "data", "[", "1", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
NetpbmFile._read_pam_header
Read PAM header and initialize instance.
GPy/util/netpbmfile.py
def _read_pam_header(self, data): """Read PAM header and initialize instance.""" regroups = re.search( b"(^P7[\n\r]+(?:(?:[\n\r]+)|(?:#.*)|" b"(HEIGHT\s+\d+)|(WIDTH\s+\d+)|(DEPTH\s+\d+)|(MAXVAL\s+\d+)|" b"(?:TUPLTYPE\s+\w+))*ENDHDR\n)", data).groups() self.hea...
def _read_pam_header(self, data): """Read PAM header and initialize instance.""" regroups = re.search( b"(^P7[\n\r]+(?:(?:[\n\r]+)|(?:#.*)|" b"(HEIGHT\s+\d+)|(WIDTH\s+\d+)|(DEPTH\s+\d+)|(MAXVAL\s+\d+)|" b"(?:TUPLTYPE\s+\w+))*ENDHDR\n)", data).groups() self.hea...
[ "Read", "PAM", "header", "and", "initialize", "instance", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/netpbmfile.py#L179-L191
[ "def", "_read_pam_header", "(", "self", ",", "data", ")", ":", "regroups", "=", "re", ".", "search", "(", "b\"(^P7[\\n\\r]+(?:(?:[\\n\\r]+)|(?:#.*)|\"", "b\"(HEIGHT\\s+\\d+)|(WIDTH\\s+\\d+)|(DEPTH\\s+\\d+)|(MAXVAL\\s+\\d+)|\"", "b\"(?:TUPLTYPE\\s+\\w+))*ENDHDR\\n)\"", ",", "data"...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
NetpbmFile._read_pnm_header
Read PNM header and initialize instance.
GPy/util/netpbmfile.py
def _read_pnm_header(self, data): """Read PNM header and initialize instance.""" bpm = data[1:2] in b"14" regroups = re.search(b"".join(( b"(^(P[123456]|P7 332)\s+(?:#.*[\r\n])*", b"\s*(\d+)\s+(?:#.*[\r\n])*", b"\s*(\d+)\s+(?:#.*[\r\n])*" * (not bpm), ...
def _read_pnm_header(self, data): """Read PNM header and initialize instance.""" bpm = data[1:2] in b"14" regroups = re.search(b"".join(( b"(^(P[123456]|P7 332)\s+(?:#.*[\r\n])*", b"\s*(\d+)\s+(?:#.*[\r\n])*", b"\s*(\d+)\s+(?:#.*[\r\n])*" * (not bpm), ...
[ "Read", "PNM", "header", "and", "initialize", "instance", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/netpbmfile.py#L193-L207
[ "def", "_read_pnm_header", "(", "self", ",", "data", ")", ":", "bpm", "=", "data", "[", "1", ":", "2", "]", "in", "b\"14\"", "regroups", "=", "re", ".", "search", "(", "b\"\"", ".", "join", "(", "(", "b\"(^(P[123456]|P7 332)\\s+(?:#.*[\\r\\n])*\"", ",", ...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
NetpbmFile._read_data
Return image data from open file as numpy array.
GPy/util/netpbmfile.py
def _read_data(self, fh, byteorder='>'): """Return image data from open file as numpy array.""" fh.seek(len(self.header)) data = fh.read() dtype = 'u1' if self.maxval < 256 else byteorder + 'u2' depth = 1 if self.magicnum == b"P7 332" else self.depth shape = [-1, self.hei...
def _read_data(self, fh, byteorder='>'): """Return image data from open file as numpy array.""" fh.seek(len(self.header)) data = fh.read() dtype = 'u1' if self.maxval < 256 else byteorder + 'u2' depth = 1 if self.magicnum == b"P7 332" else self.depth shape = [-1, self.hei...
[ "Return", "image", "data", "from", "open", "file", "as", "numpy", "array", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/netpbmfile.py#L209-L235
[ "def", "_read_data", "(", "self", ",", "fh", ",", "byteorder", "=", "'>'", ")", ":", "fh", ".", "seek", "(", "len", "(", "self", ".", "header", ")", ")", "data", "=", "fh", ".", "read", "(", ")", "dtype", "=", "'u1'", "if", "self", ".", "maxval...
54c32d79d289d622fb18b898aee65a2a431d90cf
train
NetpbmFile._fromdata
Initialize instance from numpy array.
GPy/util/netpbmfile.py
def _fromdata(self, data, maxval=None): """Initialize instance from numpy array.""" data = numpy.array(data, ndmin=2, copy=True) if data.dtype.kind not in "uib": raise ValueError("not an integer type: %s" % data.dtype) if data.dtype.kind == 'i' and numpy.min(data) < 0: ...
def _fromdata(self, data, maxval=None): """Initialize instance from numpy array.""" data = numpy.array(data, ndmin=2, copy=True) if data.dtype.kind not in "uib": raise ValueError("not an integer type: %s" % data.dtype) if data.dtype.kind == 'i' and numpy.min(data) < 0: ...
[ "Initialize", "instance", "from", "numpy", "array", "." ]
SheffieldML/GPy
python
https://github.com/SheffieldML/GPy/blob/54c32d79d289d622fb18b898aee65a2a431d90cf/GPy/util/netpbmfile.py#L237-L263
[ "def", "_fromdata", "(", "self", ",", "data", ",", "maxval", "=", "None", ")", ":", "data", "=", "numpy", ".", "array", "(", "data", ",", "ndmin", "=", "2", ",", "copy", "=", "True", ")", "if", "data", ".", "dtype", ".", "kind", "not", "in", "\...
54c32d79d289d622fb18b898aee65a2a431d90cf