Skip to content

Commit

Permalink
deprecate the remaining usage of np.matrix in dynamic component (#82)
Browse files Browse the repository at this point in the history
* deprecate the remaining usage of np.matrix in dynamic component

* remove useless info
  • Loading branch information
wwrechard authored Aug 30, 2024
1 parent d95da7c commit 704cfca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pydlm/modeler/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def updateEvaluation(self, step):
"""
if step < self.n:
self.evaluation = np.matrix([self.features[step]])
self.evaluation = np.array([self.features[step]])
self.step = step
else:
raise ValueError('The step is out of range')
Expand Down
1 change: 0 additions & 1 deletion pydlm/modeler/trends.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,3 @@ def checkDimensions(self):
"""
tl.checker.checkVectorDimension(self.meanPrior, self.covPrior)
print('The dimesnion looks good!')
8 changes: 4 additions & 4 deletions tests/modeler/testDynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class testDynamic(unittest.TestCase):


def setUp(self):
self.features = np.matrix(np.random.rand(10, 2)).tolist()
self.features2 = np.matrix(np.random.rand(10, 1)).tolist()
self.features = np.random.rand(10, 2).tolist()
self.features2 = np.random.rand(10, 1).tolist()
self.newDynamic = dynamic(features=self.features, w=1.0)
self.newDynamic2 = dynamic(features=self.features2, w=1.0)

Expand All @@ -33,12 +33,12 @@ def testUpdate(self):
for i in range(10):
self.newDynamic.updateEvaluation(i)
np.testing.assert_array_equal(
self.newDynamic.evaluation, np.matrix([self.features[i]]))
self.newDynamic.evaluation, np.array([self.features[i]]))

for i in range(10):
self.newDynamic2.updateEvaluation(i)
np.testing.assert_array_equal(
self.newDynamic2.evaluation, np.matrix([self.features2[i]]))
self.newDynamic2.evaluation, np.array([self.features2[i]]))


def testAppendNewData(self):
Expand Down

0 comments on commit 704cfca

Please sign in to comment.