Changeset 8769:180322d40dab in orange
 Timestamp:
 08/24/11 22:39:33 (3 years ago)
 Branch:
 default
 Convert:
 31293cb50935734cf29ef13c7e108c02e54bba20
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

orange/Orange/projection/linear.py
r8765 r8769 326 326 if not attr_indices: return 327 327 328 if self.implementation == FAST_IMPLEMENTATION and not hasattr(self, '_use_3 d'): # TODO328 if self.implementation == FAST_IMPLEMENTATION and not hasattr(self, '_use_3D'): # TODO 329 329 return self.optimize_fast_separation(steps, single_step, distances) 330 330 … … 984 984 class_array = numpy.compress(indices, class_array) 985 985 986 ncomps = 3 if hasattr(self, '_use_3D') else 2 986 987 vectors = None 987 988 if method == DR_PCA: 988 vals, vectors = create_pca_projection(data_matrix, ncomps = 2,989 vals, vectors = create_pca_projection(data_matrix, ncomps = ncomps, 989 990 use_generalized_eigenvectors = self.use_generalized_eigenvectors) 990 991 elif method == DR_SPCA and self.graph.dataHasClass: 991 992 vals, vectors = create_pca_projection(data_matrix, class_array, 992 ncomps = 2,993 ncomps = ncomps, 993 994 use_generalized_eigenvectors = self.use_generalized_eigenvectors) 994 995 elif method == DR_PLS and self.graph.dataHasClass: 995 996 data_matrix = data_matrix.transpose() 996 997 class_matrix = numpy.transpose(numpy.matrix(class_array)) 997 vectors = create_pls_projection(data_matrix, class_matrix, 2)998 vectors = create_pls_projection(data_matrix, class_matrix, ncomps) 998 999 vectors = vectors.T 999 1000 … … 1006 1007 xanchors = vectors[0] 1007 1008 yanchors = vectors[1] 1008 1009 m = math.sqrt(max(xanchors**2 + yanchors**2)) 1009 1010 if ncomps == 3: 1011 zanchors = vectors[2] 1012 m = math.sqrt(max(xanchors**2 + yanchors**2 + zanchors**2)) 1013 zanchors /= m 1014 else: 1015 m = math.sqrt(max(xanchors**2 + yanchors**2)) 1010 1016 1011 1017 xanchors /= m … … 1015 1021 1016 1022 if set_anchors: 1017 self.graph.setAnchors(list(xanchors), list(yanchors), attributes) 1023 if ncomps == 3: 1024 self.graph.setAnchors(list(xanchors), list(yanchors), list(zanchors), attributes) 1025 else: 1026 self.graph.setAnchors(list(xanchors), list(yanchors), attributes) 1018 1027 self.graph.updateData() 1019 1028 self.graph.repaint() 1020 return xanchors, yanchors, (attributes, attr_indices) 1029 1030 if ncomps == 3: 1031 return xanchors, yanchors, zanchors, (attributes, attr_indices) 1032 else: 1033 return xanchors, yanchors, (attributes, attr_indices) 1021 1034 1022 1035 findProjection = find_projection
Note: See TracChangeset
for help on using the changeset viewer.