diff --git a/GPy/core/__init__.py b/GPy/core/__init__.py index f2dc4904..08659add 100644 --- a/GPy/core/__init__.py +++ b/GPy/core/__init__.py @@ -5,23 +5,40 @@ Introduction ^^^^^^^^^^^^ -This module contains the fundamental classes of GPy - classes that are inherited by objects in other parts of GPy in order to provide a consistent interface to major functionality. +This module contains the fundamental classes of GPy - classes that are +inherited by objects in other parts of GPy in order to provide a +consistent interface to major functionality. .. inheritance-diagram:: GPy.core.gp.GP :top-classes: paramz.core.parameter_core.Parameterizable -:py:class:`GPy.core.model` is inherited by :py:class:`GPy.core.gp.GP`. And :py:class:`GPy.core.model` itself inherits :py:class:`paramz.model.Model` from the `paramz` package. `paramz` essentially provides an inherited set of properties and functions used to manage state (and state changes) of the model. +:py:class:`GPy.core.model` is inherited by +:py:class:`GPy.core.gp.GP`. And :py:class:`GPy.core.model` itself +inherits :py:class:`paramz.model.Model` from the `paramz` +package. `paramz` essentially provides an inherited set of properties +and functions used to manage state (and state changes) of the model. -:py:class:`GPy.core.gp.GP` represents a GP model. Such an entity is typically passed variables representing known (x) and observed (y) data, along with a kernel and other information needed to create the specific model. It exposes functions which return information derived from the inputs to the model, for example predicting unobserved variables based on new known variables, or the log marginal likelihood of the current state of the model. +:py:class:`GPy.core.gp.GP` represents a GP model. Such an entity is +typically passed variables representing known (x) and observed (y) +data, along with a kernel and other information needed to create the +specific model. It exposes functions which return information derived +from the inputs to the model, for example predicting unobserved +variables based on new known variables, or the log marginal likelihood +of the current state of the model. -:py:func:`~GPy.core.gp.GP.optimize` is called to optimize hyperparameters of the model. The optimizer argument takes a string which is used to specify non-default optimization schemes. +:py:func:`~GPy.core.gp.GP.optimize` is called to optimize +hyperparameters of the model. The optimizer argument takes a string +which is used to specify non-default optimization schemes. Various plotting functions can be called against :py:class:`GPy.core.gp.GP`. .. inheritance-diagram:: GPy.core.gp_grid.GpGrid GPy.core.sparse_gp.SparseGP GPy.core.sparse_gp_mpi.SparseGP_MPI GPy.core.svgp.SVGP :top-classes: GPy.core.gp.GP -:py:class:`GPy.core.gp.GP` is used as the basis for classes supporting more specialized types of Gaussian Process model. These are however generally still not specific enough to be called by the user and are inhereted by members of the :py:class:`GPy.models` package. +:py:class:`GPy.core.gp.GP` is used as the basis for classes supporting +more specialized types of Gaussian Process model. These are however +generally still not specific enough to be called by the user and are +inhereted by members of the :py:class:`GPy.models` package. """ diff --git a/GPy/kern/__init__.py b/GPy/kern/__init__.py index 33301817..178e4019 100644 --- a/GPy/kern/__init__.py +++ b/GPy/kern/__init__.py @@ -3,9 +3,20 @@ Introduction ^^^^^^^^^^^^ -In terms of Gaussian Processes, a kernel is a function that specifies the degree of similarity between variables given their relative positions in parameter space. If known variables *x* and *x'* are close together then observed variables *y* and *y'* may also be similar, depending on the kernel function and its parameters. *Note: this may be too simple a definition for the broad range of kernels available in :py:class:`GPy`.* +In terms of Gaussian Processes, a kernel is a function that specifies +the degree of similarity between variables given their relative +positions in parameter space. If known variables *x* and *x'* are +close together then observed variables *y* and *y'* may also be +similar, depending on the kernel function and its parameters. *Note: +this may be too simple a definition for the broad range of kernels +available in :py:class:`GPy`.* -:py:class:`GPy.kern.src.kern.Kern` is a generic kernel object inherited by more specific, end-user kernels used in models. It provides methods that specific kernels should generally have such as :py:class:`GPy.kern.src.kern.Kern.K` to compute the value of the kernel, :py:class:`GPy.kern.src.kern.Kern.add` to combine kernels and numerous functions providing information on kernel gradients. +:py:class:`GPy.kern.src.kern.Kern` is a generic kernel object +inherited by more specific, end-user kernels used in models. It +provides methods that specific kernels should generally have such as +:py:class:`GPy.kern.src.kern.Kern.K` to compute the value of the +kernel, :py:class:`GPy.kern.src.kern.Kern.add` to combine kernels and +numerous functions providing information on kernel gradients. There are several inherited types of kernel that provide a basis for specific end user kernels: @@ -20,7 +31,6 @@ e.g. the archetype :py:class:`GPy.kern.RBF` does not inherit directly from :py:c """ - from .src.kern import Kern from .src.add import Add from .src.prod import Prod @@ -61,4 +71,4 @@ from .src.sde_stationary import sde_RBF,sde_Exponential,sde_RatQuad from .src.sde_brownian import sde_Brownian from .src.multioutput_kern import MultioutputKern from .src.multioutput_derivative_kern import MultioutputDerivativeKern -from .src.diff_kern import DiffKern \ No newline at end of file +from .src.diff_kern import DiffKern diff --git a/GPy/kern/src/psi_comp/ssrbf_psi_gpucomp.py b/GPy/kern/src/psi_comp/ssrbf_psi_gpucomp.py index 488e9e22..f626c2d5 100644 --- a/GPy/kern/src/psi_comp/ssrbf_psi_gpucomp.py +++ b/GPy/kern/src/psi_comp/ssrbf_psi_gpucomp.py @@ -448,12 +448,34 @@ class PSICOMP_SSRBF_GPU(PSICOMP_RBF): dL_dpsi0_sum = dL_dpsi0.sum() self.reset_derivative() - # t=self.g_psi1compDer(dvar_gpu,dl_gpu,dZ_gpu,dmu_gpu,dS_gpu,dL_dpsi1_gpu,psi1_gpu, np.float64(variance),l_gpu,Z_gpu,mu_gpu,S_gpu, np.int32(N), np.int32(M), np.int32(Q), block=(self.threadnum,1,1), grid=(self.blocknum,1),time_kernel=True) + # t=self.g_psi1compDer(dvar_gpu,dl_gpu,dZ_gpu,dmu_gpu,dS_gpu,dL_dpsi1_gpu,psi1_gpu, + # np.float64(variance),l_gpu,Z_gpu,mu_gpu,S_gpu, np.int32(N), + # np.int32(M), np.int32(Q), block=(self.threadnum,1,1), + # grid=(self.blocknum,1),time_kernel=True) # print 'g_psi1compDer '+str(t) - # t=self.g_psi2compDer(dvar_gpu,dl_gpu,dZ_gpu,dmu_gpu,dS_gpu,dL_dpsi2_gpu,psi2n_gpu, np.float64(variance),l_gpu,Z_gpu,mu_gpu,S_gpu, np.int32(N), np.int32(M), np.int32(Q), block=(self.threadnum,1,1), grid=(self.blocknum,1),time_kernel=True) + # t=self.g_psi2compDer(dvar_gpu,dl_gpu,dZ_gpu,dmu_gpu,dS_gpu,dL_dpsi2_gpu,psi2n_gpu, + # np.float64(variance),l_gpu,Z_gpu,mu_gpu,S_gpu, np.int32(N), + # np.int32(M), np.int32(Q), block=(self.threadnum,1,1), + # grid=(self.blocknum,1),time_kernel=True) # print 'g_psi2compDer '+str(t) - self.g_psi1compDer.prepared_call((self.blocknum,1),(self.threadnum,1,1),dvar_gpu.gpudata,dl_gpu.gpudata,dZ_gpu.gpudata,dmu_gpu.gpudata,dS_gpu.gpudata,dgamma_gpu.gpudata,dL_dpsi1_gpu.gpudata,psi1_gpu.gpudata, log_denom1_gpu.gpudata, log_gamma_gpu.gpudata, log_gamma1_gpu.gpudata, np.float64(variance),l_gpu.gpudata,Z_gpu.gpudata,mu_gpu.gpudata,S_gpu.gpudata,gamma_gpu.gpudata,np.int32(N), np.int32(M), np.int32(Q)) - self.g_psi2compDer.prepared_call((self.blocknum,1),(self.threadnum,1,1),dvar_gpu.gpudata,dl_gpu.gpudata,dZ_gpu.gpudata,dmu_gpu.gpudata,dS_gpu.gpudata,dgamma_gpu.gpudata,dL_dpsi2_gpu.gpudata,psi2n_gpu.gpudata, log_denom2_gpu.gpudata, log_gamma_gpu.gpudata, log_gamma1_gpu.gpudata, np.float64(variance),l_gpu.gpudata,Z_gpu.gpudata,mu_gpu.gpudata,S_gpu.gpudata,gamma_gpu.gpudata,np.int32(N), np.int32(M), np.int32(Q)) + self.g_psi1compDer.prepared_call((self.blocknum,1), (self.threadnum,1,1), + dvar_gpu.gpudata, dl_gpu.gpudata, dZ_gpu.gpudata, + dmu_gpu.gpudata, dS_gpu.gpudata, dgamma_gpu.gpudata, + dL_dpsi1_gpu.gpudata, psi1_gpu.gpudata, + log_denom1_gpu.gpudata, log_gamma_gpu.gpudata, + log_gamma1_gpu.gpudata, np.float64(variance), + l_gpu.gpudata, Z_gpu.gpudata, mu_gpu.gpudata, + S_gpu.gpudata, gamma_gpu.gpudata, np.int32(N), + np.int32(M), np.int32(Q)) + self.g_psi2compDer.prepared_call((self.blocknum,1), (self.threadnum,1,1), + dvar_gpu.gpudata, dl_gpu.gpudata, dZ_gpu.gpudata, + dmu_gpu.gpudata, dS_gpu.gpudata, dgamma_gpu.gpudata, + dL_dpsi2_gpu.gpudata, psi2n_gpu.gpudata, + log_denom2_gpu.gpudata, log_gamma_gpu.gpudata, + log_gamma1_gpu.gpudata, np.float64(variance), + l_gpu.gpudata, Z_gpu.gpudata, mu_gpu.gpudata, + S_gpu.gpudata, gamma_gpu.gpudata, np.int32(N), + np.int32(M), np.int32(Q)) dL_dvar = dL_dpsi0_sum + gpuarray.sum(dvar_gpu).get() sum_axis(grad_mu_gpu,dmu_gpu,N*Q,self.blocknum) @@ -468,7 +490,6 @@ class PSICOMP_SSRBF_GPU(PSICOMP_RBF): dL_dlengscale = grad_l_gpu.get() else: dL_dlengscale = gpuarray.sum(dl_gpu).get() - - return dL_dvar, dL_dlengscale, dL_dZ, dL_dmu, dL_dS, dL_dgamma - + + return dL_dvar, dL_dlengscale, dL_dZ, dL_dmu, dL_dS, dL_dgamma diff --git a/GPy/util/datasets.py b/GPy/util/datasets.py index 035f7b75..c406ed7b 100644 --- a/GPy/util/datasets.py +++ b/GPy/util/datasets.py @@ -500,7 +500,15 @@ def drosophila_knirps(data_set='drosophila_protein'): # This will be for downloading google trends data. def google_trends(query_terms=['big data', 'machine learning', 'data science'], data_set='google_trends', refresh_data=False): - """Data downloaded from Google trends for given query terms. Warning, if you use this function multiple times in a row you get blocked due to terms of service violations. The function will cache the result of your query, if you wish to refresh an old query set refresh_data to True. The function is inspired by this notebook: http://nbviewer.ipython.org/github/sahuguet/notebooks/blob/master/GoogleTrends%20meet%20Notebook.ipynb""" + """Data downloaded from Google trends for given query terms. + +Warning, if you use this function multiple times in a row you get +blocked due to terms of service violations. The function will cache +the result of your query, if you wish to refresh an old query set +refresh_data to True. + +The function is inspired by this notebook: +http://nbviewer.ipython.org/github/sahuguet/notebooks/blob/master/GoogleTrends%20meet%20Notebook.ipynb""" query_terms.sort() import pandas