def __call__(self, data): """Return data table features that have scores above given threshold. :param data: data table :type data: Orange.data.Table """ ma = score_all(data, self.measure) return select_above_threshold(data, ma, self.threshold)
def __call__(self, data): """Return data table features that have scores above given threshold. :param data: data table :type data: Orange.data.Table """ ma = score_all(data, self.measure) return select_above_threshold(data, ma, self.threshold)
def select_relief(data, measure=Orange.feature.scoring.Relief(k=20, m=50), margin=0): """Iteratively remove the worst scored feature until no feature has a score below the margin. The filter procedure was originally designed for measures such as Relief, which are context dependent, i.e., removal of features may change the scores of other remaining features. The score is thus recomputed in each iteration. :param data: a data table :type data: :obj:`Orange.data.Table` :param measure: a feature scorer :type measure: :obj:`Orange.feature.scoring.Score` :param margin: margin for removal :type margin: float """ measl = score_all(data, measure) while len(data.domain.attributes) > 0 and measl[-1][1] < margin: data = select(data, measl, len(data.domain.attributes) - 1) measl = score_all(data, measure) return data
def print_feature_scores(instances, methods): for method in methods: print method log.info("Starting scoring") scores = score_all(instances, method) log.info("Finished scoring") i = 0 scores = [s for s in scores if not str(s[1])=='nan'] for attribute_name, score in sorted(scores, key=lambda s: abs(s[1]), reverse=True): i += 1 print "%5.3f\t%s" % (score, attribute_name)
def select_relief(data, measure=Orange.feature.scoring.Relief(k=20, m=50), margin=0): """Iteratively remove the worst scored feature until no feature has a score below the margin. The filter procedure was originally designed for measures such as Relief, which are context dependent, i.e., removal of features may change the scores of other remaining features. The score is thus recomputed in each iteration. :param data: a data table :type data: :obj:`Orange.data.Table` :param measure: a feature scorer :type measure: :obj:`Orange.feature.scoring.Score` :param margin: margin for removal :type margin: float """ measl = score_all(data, measure) while len(data.domain.attributes) > 0 and measl[-1][1] < margin: data = select(data, measl, len(data.domain.attributes) - 1) measl = score_all(data, measure) return data
def __call__(self, data): ma = score_all(data, self.measure) self.n = min(self.n, len(data.domain.attributes)) return select(data, ma, self.n)
def __call__(self, data): ma = score_all(data, self.measure) self.n = min(self.n, len(data.domain.attributes)) return select(data, ma, self.n)
def test_score_all(self, dataset): scoring.score_all(dataset, score=scoring.Relief())
def setUp(self): self.score = Orange.feature.scoring.Gini() self.data = Orange.data.Table("lenses") self.scores = scoring.score_all(self.data, self.score)
def setUp(self): self.score = Orange.feature.scoring.Gini() self.data = Orange.data.Table("lenses") self.scores = scoring.score_all(self.data, self.score)