Skip to content

Commit

Permalink
Update linear.py
Browse files Browse the repository at this point in the history
Simpler prediction using np.matmul
  • Loading branch information
Katze2664 authored May 28, 2024
1 parent 5c3170e commit e9451c3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions mushroom_rl/approximators/parametric/linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ def predict(self, x, **predict_params):
"""
phi = np.atleast_2d(self.phi(x))

prediction = np.ones((phi.shape[0], self._w.shape[0]))
for i, phi_i in enumerate(phi):
prediction[i] = phi_i.dot(self._w.T)
prediction = np.matmul(phi, self._w.T)

return prediction

Expand Down

0 comments on commit e9451c3

Please sign in to comment.