mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-05 14:55:15 +02:00
Bug fix for single output sympy kernel.
This commit is contained in:
parent
2af48254ce
commit
f46c72b79b
3 changed files with 25 additions and 7 deletions
|
|
@ -14,7 +14,7 @@ import Matern32
|
|||
import Matern52
|
||||
import mlp
|
||||
import ODE_1
|
||||
import ODE_UY
|
||||
#import ODE_UY
|
||||
import periodic_exponential
|
||||
import periodic_Matern32
|
||||
import periodic_Matern52
|
||||
|
|
|
|||
|
|
@ -177,8 +177,15 @@ class spkern(Kernpart):
|
|||
# Code to compute argument string when only diagonal is required.
|
||||
diag_arg_string = re.sub('int jj','//int jj',X_arg_string)
|
||||
diag_arg_string = re.sub('j','i',diag_arg_string)
|
||||
diag_precompute_string = precompute_list[0]
|
||||
|
||||
if precompute_string == '':
|
||||
# if it's not multioutput, the precompute strings are set to zero
|
||||
diag_precompute_string = ''
|
||||
diag_precompute_replace = ''
|
||||
else:
|
||||
# for multioutput we need to extract the index of the output form the input.
|
||||
diag_precompute_string = precompute_list[0]
|
||||
diag_precompute_replace = precompute_list[1]
|
||||
|
||||
|
||||
# Here's the code to do the looping for K
|
||||
self._K_code =\
|
||||
|
|
@ -215,13 +222,13 @@ class spkern(Kernpart):
|
|||
TARGET2(i, i) += k(%s);
|
||||
for (j=0;j<i;j++){
|
||||
%s //int jj=(int)X2(j, 1);
|
||||
double kval = k(%s); //double kval = k(X2(i, 0), X2(j, 0), shared_lengthscale, LENGTHSCALE1(ii), SCALE1(ii), LENGTHSCALE1(jj), SCALE1(jj));
|
||||
double kval = k(%s); //double kval = k(X2(i, 0), shared_lengthscale, LENGTHSCALE1(ii), SCALE1(ii));
|
||||
TARGET2(i, j) += kval;
|
||||
TARGET2(j, i) += kval;
|
||||
}
|
||||
}
|
||||
/*%s*/
|
||||
"""%(diag_precompute_string, diag_arg_string, re.sub('Z2', 'X2', precompute_list[1]), X_arg_string,str(self._sp_k)) #adding a string representation forces recompile when needed
|
||||
"""%(diag_precompute_string, diag_arg_string, re.sub('Z2', 'X2', diag_precompute_replace), X_arg_string,str(self._sp_k)) #adding a string representation forces recompile when needed
|
||||
|
||||
# Code to do the looping for Kdiag
|
||||
self._Kdiag_code =\
|
||||
|
|
|
|||
|
|
@ -689,7 +689,7 @@ def olympic_marathon_men(data_set='olympic_marathon_men'):
|
|||
Y = olympics[:, 1:2]
|
||||
return data_details_return({'X': X, 'Y': Y}, data_set)
|
||||
|
||||
def olympics():
|
||||
def olympic_sprints(data_set='rogers_girolami_data'):
|
||||
"""All olympics sprint winning times for multiple output prediction."""
|
||||
X = np.zeros((0, 2))
|
||||
Y = np.zeros((0, 1))
|
||||
|
|
@ -707,7 +707,18 @@ def olympics():
|
|||
data['X'] = X
|
||||
data['Y'] = Y
|
||||
data['info'] = "Olympics sprint event winning for men and women to 2008. Data is from Rogers and Girolami's First Course in Machine Learning."
|
||||
return data
|
||||
return data_details_return({
|
||||
'X': X,
|
||||
'Y': Y,
|
||||
'info': "Olympics sprint event winning for men and women to 2008. Data is from Rogers and Girolami's First Course in Machine Learning.",
|
||||
'output_info': {
|
||||
0:'100m Men',
|
||||
1:'100m Women',
|
||||
2:'200m Men',
|
||||
3:'200m Women',
|
||||
4:'400m Men',
|
||||
5:'400m Women'}
|
||||
}, data_set)
|
||||
|
||||
# def movielens_small(partNo=1,seed=default_seed):
|
||||
# np.random.seed(seed=seed)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue