Changeset 9274:a3cee9ea0ad1 in orange


Ignore:
Timestamp:
11/25/11 15:35:10 (2 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
6d7c2602091aabdc8ed70c2b4441332538f63f44
Message:

Fixed subsets_selection_xtx_numpy for multi-response problems.

File:
1 edited

Legend:

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

    r9205 r9274  
    434434      
    435435    """ 
    436     return  rss / (n * (1 - n_effective_params / n) ** 2) 
     436    return  rss / (n * (1. - n_effective_params / n) ** 2) 
    437437 
    438438""" 
     
    635635        XtX = numpy.dot(X_work.T, X_work) 
    636636        iXtX = numpy.linalg.pinv(XtX) 
    637         diag = numpy.diag(iXtX) 
     637        diag = numpy.diag(iXtX).reshape((-1, 1)) 
    638638         
    639639        if subset_size == 0: 
     
    641641         
    642642        delta_rss = b ** 2 / diag 
     643        delta_rss = numpy.sum(delta_rss, axis=1) 
    643644        delete_i = numpy.argmin(delta_rss[1:]) + 1 # Keep the intercept 
    644645        del working_set[delete_i] 
     
    659660    if k < col_count: 
    660661        # remove jpvt[k:] from the work set. Will have zero  
    661         # entries in the subsets matrix 
    662         for i in jpvt[k:]: 
     662        # entries in the subsets matrix, and inf rss 
     663        for i in sorted(jpvt[k:], reverse=True): 
    663664            del working_set[i] 
     665            rss_vec[len(working_set)] = float("inf") 
    664666        col_count = len(working_set) 
    665667         
Note: See TracChangeset for help on using the changeset viewer.