mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-08 19:42:39 +02:00
deleted listarray
This commit is contained in:
parent
f2e04f138d
commit
a29cf87e53
2 changed files with 2 additions and 17 deletions
|
|
@ -6,19 +6,6 @@ __updated__ = '2013-12-16'
|
|||
import numpy as np
|
||||
from parameter_core import Observable
|
||||
|
||||
class ListArray(np.ndarray):
|
||||
"""
|
||||
ndarray which can be stored in lists and checked if it is in.
|
||||
WARNING: This overrides the functionality of x==y!!!
|
||||
Use numpy.equal(x,y) for element-wise equality testing.
|
||||
"""
|
||||
|
||||
def __new__(cls, input_array):
|
||||
obj = np.asanyarray(input_array).view(cls)
|
||||
return obj
|
||||
#def __eq__(self, other):
|
||||
# return other is self
|
||||
|
||||
class ParamList(list):
|
||||
|
||||
def __contains__(self, other):
|
||||
|
|
@ -29,7 +16,7 @@ class ParamList(list):
|
|||
|
||||
pass
|
||||
|
||||
class ObservableArray(ListArray, Observable):
|
||||
class ObservableArray(np.ndarray, Observable):
|
||||
"""
|
||||
An ndarray which reports changes to its observers.
|
||||
The observers can add themselves with a callable, which
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ class Param(ObservableArray, Constrainable, Gradcheckable):
|
|||
"""
|
||||
__array_priority__ = -1 # Never give back Param
|
||||
_fixes_ = None
|
||||
_parameters_ = []
|
||||
def __new__(cls, name, input_array, default_constraint=None):
|
||||
obj = numpy.atleast_1d(super(Param, cls).__new__(cls, input_array=input_array))
|
||||
obj._current_slice_ = (slice(obj.shape[0]),)
|
||||
|
|
@ -144,9 +145,6 @@ class Param(ObservableArray, Constrainable, Gradcheckable):
|
|||
# from_name = self.name
|
||||
# self.name = new_name
|
||||
# self._direct_parent_._name_changed(self, from_name)
|
||||
@property
|
||||
def _parameters_(self):
|
||||
return []
|
||||
def _collect_gradient(self, target):
|
||||
target[:] = self.gradient.flat
|
||||
#===========================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue