orange / Orange / feature / selection.py

Diff from to

Orange/feature/selection.py

 
 from Orange.feature.scoring import score_all
 
+
 def top_rated(scores, n, highest_best=True):
     """Return n top-rated features from the list of scores.
 
-    :param scores: a list such as the one returned by
-      :obj:`~Orange.feature.scoring.score_all`
-    :type scores: list
-    :param n: number of features to select.
-    :type n: int
+    :param list scores:
+        A list such as the one returned by :func:`.score_all`
+    :param int n: Number of features to select.
+    :param bool highest_best:
+        If true, the features that are scored higher are preferred.
     :rtype: :obj:`list`
-    :param highest_best: if true, the features that are scored higher are preferred
-    :type highest_best: bool
+
     """
-    return [x[0] for x in \
-            sorted(scores, key=itemgetter(1), reverse=True)[:n]
-            ]
+    return [f for f, score in
+            sorted(scores, key=itemgetter(1), reverse=highest_best)[:n]]
 
 bestNAtts = top_rated
 
+
 def above_threshold(scores, threshold=0.0):
     """Return features (without scores) with scores above or
     equal to a specified threshold.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.