Skip to content

Commit

Permalink
Merge pull request #943 from VesnaT/rank_proj
Browse files Browse the repository at this point in the history
Rank projection: Consider missing values
  • Loading branch information
janezd committed Dec 23, 2015
2 parents a2b158e + ad67844 commit 11a4537
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Orange/widgets/visualize/owscatterplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,12 +561,12 @@ def run(self):
n_neighbors = min(self.k, len(X) - 1)
knn = NearestNeighbors(n_neighbors=n_neighbors).fit(X)
ind = knn.kneighbors(return_distance=False)
if isinstance(self.parent_widget.data.domain.class_var,
DiscreteVariable):
if self.parent_widget.data.domain.has_discrete_class:
score = np.sum(y[ind] == y.reshape(-1, 1)) / (
len(y_full) * n_neighbors)
else:
score = r2_score(y, np.mean(y[ind], axis=1))
score = r2_score(y, np.mean(y[ind], axis=1)) * (
len(y) / len(y_full))
pos = bisect_left(self.scores, score)
self.projectionTableModel.insertRow(
len(self.scores) - pos,
Expand Down

0 comments on commit 11a4537

Please sign in to comment.