Changeset 10599:36a9d76cb125 in orange


Ignore:
Timestamp:
03/21/12 15:38:49 (2 years ago)
Author:
Lan Zagar <lan.zagar@…>
Branch:
default
Message:

Updated linear regression for the improved to_numpy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/regression/linear.py

    r10580 r10599  
    229229        # convertion to numpy 
    230230        A, y, w = table.to_numpy() 
    231         if A is None: 
    232             n, m = len(table), 0 
    233         else: 
    234             n, m = numpy.shape(A) 
     231        n, m = numpy.shape(A) 
    235232      
    236233        if self.intercept: 
    237             if A is None: 
    238                 X = numpy.ones([n, 1]) 
    239             else: 
    240                 X = numpy.insert(A, 0, 1, axis=1) # adds a column of ones 
     234            X = numpy.insert(A, 0, 1, axis=1) # adds a column of ones 
    241235        else: 
    242236            X = A 
     
    261255 
    262256        mu_y, sigma_y = numpy.mean(y), numpy.std(y) 
    263         if A is not None: 
     257        if m > 0: 
    264258            cov_x = numpy.cov(X, rowvar=0) 
    265259 
Note: See TracChangeset for help on using the changeset viewer.