@@ -26,7 +26,7 @@ class LFDA(BaseMetricLearner):
26
26
Local Fisher Discriminant Analysis for Supervised Dimensionality Reduction
27
27
Sugiyama, ICML 2006
28
28
'''
29
- def __init__ (self , num_dims = None , k = None , metric = 'weighted' ):
29
+ def __init__ (self , num_dims = None , k = None , embedding_type = 'weighted' ):
30
30
'''
31
31
Initialize LFDA.
32
32
@@ -39,16 +39,16 @@ def __init__(self, num_dims=None, k=None, metric='weighted'):
39
39
Number of nearest neighbors used in local scaling method.
40
40
Defaults to min(7, num_dims - 1).
41
41
42
- metric : str, optional
42
+ embedding_type : str, optional
43
43
Type of metric in the embedding space (default: 'weighted')
44
44
'weighted' - weighted eigenvectors
45
45
'orthonormalized' - orthonormalized
46
46
'plain' - raw eigenvectors
47
47
'''
48
- if metric not in ('weighted' , 'orthonormalized' , 'plain' ):
49
- raise ValueError ('Invalid metric : %r' % metric )
48
+ if embedding_type not in ('weighted' , 'orthonormalized' , 'plain' ):
49
+ raise ValueError ('Invalid embedding_type : %r' % embedding_type )
50
50
self .num_dims = num_dims
51
- self .metric = metric
51
+ self .embedding_type = embedding_type
52
52
self .k = k
53
53
54
54
def transformer (self ):
@@ -122,9 +122,9 @@ def fit(self, X, y):
122
122
vals = vals [order ].real
123
123
vecs = vecs [:,order ]
124
124
125
- if self .metric == 'weighted' :
125
+ if self .embedding_type == 'weighted' :
126
126
vecs *= np .sqrt (vals )
127
- elif self .metric == 'orthonormalized' :
127
+ elif self .embedding_type == 'orthonormalized' :
128
128
vecs , _ = np .linalg .qr (vecs )
129
129
130
130
self .transformer_ = vecs .T
0 commit comments