Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pykliep.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
import warnings

from future.utils import iteritems
class DensityRatioEstimator:
"""
Class to accomplish direct density estimation implementing the original KLIEP
Expand Down Expand Up @@ -83,7 +83,7 @@ def fit(self, X_train, X_test, alpha_0=None):
sigma=sigma)
j_scores[(num_param,sigma)] = np.mean(j_scores[(num_param,sigma)])

sorted_scores = sorted([x for x in j_scores.iteritems() if np.isfinite(x[1])], key=lambda x :x[1], reverse=True)
sorted_scores = sorted([x for x in iteritems(j_scores) if np.isfinite(x[1])], key=lambda x :x[1], reverse=True)
if len(sorted_scores) == 0:
warnings.warn('LCV failed to converge for all values of sigma.')
return self
Expand Down