mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-21 14:05:14 +02:00
Minor changes to sympy kernel (removing un-needed comments).
This commit is contained in:
parent
d2c4c10573
commit
8b2ba52a8f
1 changed files with 4 additions and 7 deletions
|
|
@ -76,34 +76,32 @@ class Sympykern(Kern):
|
|||
|
||||
self.num_split_params = len(self._sp_theta_i)
|
||||
self._split_theta_names = ["%s"%theta.name[:-2] for theta in self._sp_theta_i]
|
||||
# Add split parameters to the model.
|
||||
for theta in self._split_theta_names:
|
||||
# TODO: what if user has passed a parameter vector, how should that be stored and interpreted?
|
||||
setattr(self, theta, Param(theta, np.ones(self.output_dim), None))
|
||||
self.add_parameters(getattr(self, theta))
|
||||
self.add_parameter(getattr(self, theta))
|
||||
|
||||
#setattr(self, theta, np.ones(self.output_dim))
|
||||
|
||||
self.num_shared_params = len(self._sp_theta)
|
||||
for theta_i, theta_j in zip(self._sp_theta_i, self._sp_theta_j):
|
||||
self._sp_kdiag = self._sp_kdiag.subs(theta_j, theta_i)
|
||||
#self.num_params = self.num_shared_params+self.num_split_params*self.output_dim
|
||||
|
||||
else:
|
||||
self.num_split_params = 0
|
||||
self._split_theta_names = []
|
||||
self._sp_theta = thetas
|
||||
self.num_shared_params = len(self._sp_theta)
|
||||
#self.num_params = self.num_shared_params
|
||||
|
||||
# Add parameters to the model.
|
||||
for theta in self._sp_theta:
|
||||
val = 1.0
|
||||
# TODO: what if user has passed a parameter vector, how should that be stored and interpreted? This is the old way before params class.
|
||||
if param is not None:
|
||||
if param.has_key(theta):
|
||||
val = param[theta]
|
||||
setattr(self, theta.name, Param(theta.name, val, None))
|
||||
self.add_parameters(getattr(self, theta.name))
|
||||
#deal with param
|
||||
#self._set_params(self._get_params())
|
||||
|
||||
# Differentiate with respect to parameters.
|
||||
derivative_arguments = self._sp_x + self._sp_theta
|
||||
|
|
@ -113,7 +111,6 @@ class Sympykern(Kern):
|
|||
self.derivatives = {theta.name : sp.diff(self._sp_k,theta).simplify() for theta in derivative_arguments}
|
||||
self.diag_derivatives = {theta.name : sp.diff(self._sp_kdiag,theta).simplify() for theta in derivative_arguments}
|
||||
|
||||
|
||||
# This gives the parameters for the arg list.
|
||||
self.arg_list = self._sp_x + self._sp_z + self._sp_theta
|
||||
self.diag_arg_list = self._sp_x + self._sp_theta
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue