mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-24 14:15:14 +02:00
adding back param_to_array
This commit is contained in:
parent
6e5d3d72de
commit
358cf71e01
1 changed files with 11 additions and 10 deletions
|
|
@ -174,13 +174,14 @@ def fast_array_equal(A, B):
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
### make a parameter to its corresponding array:
|
||||||
if __name__ == '__main__':
|
def param_to_array(*param):
|
||||||
import pylab as plt
|
"""
|
||||||
X = np.linspace(1,10, 100)[:, None]
|
Convert an arbitrary number of parameters to :class:ndarray class objects. This is for
|
||||||
X = X[np.random.permutation(X.shape[0])[:20]]
|
converting parameter objects to numpy arrays, when using scipy.weave.inline routine.
|
||||||
inducing = kmm_init(X, m = 5)
|
In scipy.weave.blitz there is no automatic array detection (even when the array inherits
|
||||||
plt.figure()
|
from :class:ndarray)"""
|
||||||
plt.plot(X.flatten(), np.ones((X.shape[0],)), 'x')
|
assert len(param) > 0, "At least one parameter needed"
|
||||||
plt.plot(inducing, 0.5* np.ones((len(inducing),)), 'o')
|
if len(param) == 1:
|
||||||
plt.ylim((0.0, 10.0))
|
return param[0].view(np.ndarray)
|
||||||
|
return map(lambda x: x.view(np.ndarray), param)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue