Changeset 4057:49cdc4a80171 in orange


Ignore:
Timestamp:
08/07/07 09:16:08 (7 years ago)
Author:
blaz <blaz.zupan@…>
Branch:
default
Convert:
4e0ccb491d2d34029faa6a31e25546fe48101171
Message:

changes in linear regression (now works fine with orngTest)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/orngRegression.py

    r3714 r4057  
    8989        self.beta = self.statistics['model']['estCoeff'] 
    9090 
    91     def __call__(self, example): 
     91    def __call__(self, example, resultType = orange.GetValue): 
    9292        ex = orange.Example(self.domain, example) 
    9393        ex = numpy.array(ex.native()) 
     
    9797        else: 
    9898            yhat = dot(self.beta, ex[:-1]) 
     99        yhat = orange.Value(yhat) 
    99100          
    100         return yhat 
     101        if resultType == orange.GetValue: 
     102            return yhat 
     103        if resultType == orange.GetProbabilities: 
     104            return orange.ContDistribution({1.0: yhat}) 
     105        return (yhat, orange.ContDistribution({1.0: yhat})) 
     106 
    101107 
    102108def printLinearRegression(lr): 
Note: See TracChangeset for help on using the changeset viewer.