Skip to content

Commit

Permalink
Fixed an issue with IcpRegressor caused by conditional ICP.
Browse files Browse the repository at this point in the history
  • Loading branch information
donlnz committed May 19, 2015
1 parent 703e3ff commit c25180f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nonconformist/icp.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@ def predict(self, x, significance=None):
n_significance = (99 if significance is None
else np.array(significance).size)

prediction = np.zeros((x.shape[0], 2, n_significance))
if n_significance > 1:
prediction = np.zeros((x.shape[0], 2, n_significance))
else:
prediction = np.zeros((x.shape[0], 2))

condition_map = np.array([self.condition((x[i, :], None))
for i in range(x.shape[0])])
Expand All @@ -322,6 +325,9 @@ def predict(self, x, significance=None):
p = self.nc_function.predict(x[idx, :],
self.cal_scores[condition],
significance)
prediction[idx, :, :] = p
if n_significance > 1:
prediction[idx, :, :] = p
else:
prediction[idx, :] = p

return prediction

0 comments on commit c25180f

Please sign in to comment.