Changeset 7897:cf17253387f8 in orange


Ignore:
Timestamp:
05/09/11 11:33:47 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
04f23346c9079a340a25d6f2ad83550c0dcde119
Message:

Fixing a wrong commit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/ensemble/boosting.py

    r7896 r7897  
    147147            return (value, votes) 
    148148     
    149 from Orange.misc import _orange__new__     
    150 class StohasticGradientBoostingLearner(Orange.core.Learner): 
    151     """ An implementation of the Stochastic Gradient Boosting. 
    152     """ 
    153     def __new__(cls, learner, data=None, weightId=None, **kwargs): 
    154         self = Orange.core.Learner.__new__(cls) 
    155         if data is not None: 
    156             self.__init__(learner, **kwargs) 
    157             return self.__call__(data, weightId) 
    158         else: 
    159             return self 
    160          
    161     def __init__(self, learner, iterations=100, p=0.5, alpha=0.1, **kwargs): 
    162         self.learner = learner 
    163         self.iterations = iterations 
    164         self.p = p  
    165         self.alpha = alpha 
    166         self.__dict__.update(kwargs) 
    167          
    168     def __call__(self, data, weightId=None): 
    169         original_targets = [ex.getclass() for ex in data] 
    170         subset_generator = Orange.sample.SubsetIndices2(p0=self.p) 
    171         subset_generator.randomGenerator = orange.RandomGenerator(42) 
    172          
    173         for i in range(self.iterations): 
    174             indices = subset(data) 
    175             data_subset = data.select(indices) 
    176             model = self.learner(data, weightId) 
    177              
    178              
    179          
Note: See TracChangeset for help on using the changeset viewer.