Changeset 8884:490fbfa811d7 in orange


Ignore:
Timestamp:
09/02/11 10:23:53 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
5ab0a0cb94562d87e1756de21e62ce508ec88e00
Message:

Actually pass the 't' parameter to BaggedLearner in ScoreEarthImportance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/regression/earth.py

    r8764 r8884  
    908908""" 
    909909from Orange.feature import scoring 
    910 from Orange.misc import _orange__new__ 
    911910             
    912911class ScoreEarthImportance(scoring.Score): 
     
    921920    GCV = 2 
    922921     
    923     __new__ = _orange__new__(scoring.Score) 
    924922    handles_discrete = True 
    925923    handles_continuous = True 
    926924    computes_thresholds = False 
     925    needs = scoring.Score.Generator 
     926     
     927    def __new__(cls, attr=None, data=None, weight_id=None, **kwargs): 
     928        self = scoring.Score.__new__(cls) 
     929        if attr is not None and data is not None: 
     930            self.__init__(**kwargs) 
     931            # TODO: Should raise a warning, about caching 
     932            return self.__call__(attr, data, weight_id) 
     933        elif not attr and not data: 
     934            return self 
     935        else: 
     936            raise ValueError("Both 'attr' and 'data' arguments expected.") 
    927937         
    928938    def __init__(self, t=10, degree=2, terms=10, score_what="nsubsets", cached=True): 
     
    957967            from Orange.ensemble.bagging import BaggedLearner 
    958968            bc = BaggedLearner(EarthLearner(degree=self.degree, 
    959                             terms=self.terms))(data, weight_id) 
     969                            terms=self.terms), t=self.t)(data, weight_id) 
    960970            evimp = bagged_evimp(bc, used_only=False) 
    961971            self._cache_ref = data 
     
    975985        else: 
    976986            return score[self.score_what] 
    977      
    978987     
    979988#class ScoreRSS(scoring.Score): 
Note: See TracChangeset for help on using the changeset viewer.