mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-04-28 22:36:24 +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
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import pylab as plt
|
||||
X = np.linspace(1,10, 100)[:, None]
|
||||
X = X[np.random.permutation(X.shape[0])[:20]]
|
||||
inducing = kmm_init(X, m = 5)
|
||||
plt.figure()
|
||||
plt.plot(X.flatten(), np.ones((X.shape[0],)), 'x')
|
||||
plt.plot(inducing, 0.5* np.ones((len(inducing),)), 'o')
|
||||
plt.ylim((0.0, 10.0))
|
||||
### make a parameter to its corresponding array:
|
||||
def param_to_array(*param):
|
||||
"""
|
||||
Convert an arbitrary number of parameters to :class:ndarray class objects. This is for
|
||||
converting parameter objects to numpy arrays, when using scipy.weave.inline routine.
|
||||
In scipy.weave.blitz there is no automatic array detection (even when the array inherits
|
||||
from :class:ndarray)"""
|
||||
assert len(param) > 0, "At least one parameter needed"
|
||||
if len(param) == 1:
|
||||
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