Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/Unsupervised/OWPCA.py

    r11217 r11454  
    109109        cutoff = curve_data[0][0] 
    110110        return x1 < cutoff and cutoff < x2 
     111 
    111112 
    112113class CutoffCurve(OWCurve): 
     
    297298 
    298299    def apply(self): 
    299         """Apply PCA on input data, caching the full projection, 
    300         then updating the selected components. 
    301          
     300        """ 
     301        Apply PCA on input data, caching the full projection and 
     302        updating the selected components. 
     303 
    302304        """ 
    303305        pca = self.construct_pca_all_comp() 
     
    347349                                         variance_sum=variance_sum) 
    348350        projected_data = projector(self.data) 
     351 
     352        append_metas(projected_data, self.data) 
     353 
    349354        eigenvectors = self.eigenvectors_as_table(components) 
    350355 
     
    448453 
    449454 
     455def append_metas(dest, source): 
     456    """ 
     457    Append all meta attributes from the `source` table to `dest` table. 
     458    The tables must be of the same length. 
     459 
     460    :param dest: 
     461        An data table into which the meta values will be copied. 
     462    :type dest: :class:`Orange.data.Table` 
     463 
     464    :param source: 
     465        A data table with the meta attributes/values to be copied into `dest`. 
     466    :type source: :class:`Orange.data.Table` 
     467 
     468    """ 
     469    if len(dest) != len(source): 
     470        raise ValueError("'dest' and 'source' must have the same length.") 
     471 
     472    dest.domain.add_metas(source.domain.get_metas()) 
     473    for dest_inst, source_inst in zip(dest, source): 
     474        for meta_id, val in source_inst.get_metas().items(): 
     475            dest_inst[meta_id] = val 
     476 
     477 
    450478if __name__ == "__main__": 
    451479    app = QApplication(sys.argv) 
Note: See TracChangeset for help on using the changeset viewer.