Skip to content

Commit

Permalink
Added compatibility with pre-0.5 nipals objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredrik Wallner committed Jun 4, 2019
1 parent 62a421b commit afda577
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

0.5.2 (2019-06-04)
------------------

* Added compatibility with Nipals objects saved from pre-0.5 versions

0.5.1 (2019-05-23)
------------------

Expand Down
12 changes: 8 additions & 4 deletions src/nipals/nipals.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,10 +866,14 @@ def plot(

def predict(self, new_x):
self.new_x = new_x
if self.center:
self.new_x -= self.x_mean
if self.scale:
self.new_x /= self.x_std
try:
if self.center:
self.new_x -= self.x_mean
if self.scale:
self.new_x /= self.x_std
except AttributeError:
# Compatibility with saved objects from pre-0.5.0 versions.
self.new_x = (new_x - self.x_mean) / self.x_std
self.new_x = self.new_x.fillna(0)
self.pred = self.new_x.dot(self.loadings)
if self.eigsweep:
Expand Down

0 comments on commit afda577

Please sign in to comment.