@@ -47,8 +47,8 @@ def generate_data(n_samples, n_features):
47
47
for _ in range (n_averages ):
48
48
X , y = generate_data (n_train , n_features )
49
49
50
- clf1 = LinearDiscriminantAnalysis (solver = "lsqr" , shrinkage = "auto" ).fit (X , y )
51
- clf2 = LinearDiscriminantAnalysis (solver = "lsqr" , shrinkage = None ).fit (X , y )
50
+ clf1 = LinearDiscriminantAnalysis (solver = "lsqr" , shrinkage = None ).fit (X , y )
51
+ clf2 = LinearDiscriminantAnalysis (solver = "lsqr" , shrinkage = "auto" ).fit (X , y )
52
52
oa = OAS (store_precision = False , assume_centered = False )
53
53
clf3 = LinearDiscriminantAnalysis (solver = "lsqr" , covariance_estimator = oa ).fit (
54
54
X , y
@@ -69,36 +69,37 @@ def generate_data(n_samples, n_features):
69
69
features_samples_ratio ,
70
70
acc_clf1 ,
71
71
linewidth = 2 ,
72
- label = "Linear Discriminant Analysis with Ledoit Wolf " ,
73
- color = "navy " ,
74
- linestyle = "dashed " ,
72
+ label = "LDA " ,
73
+ color = "gold " ,
74
+ linestyle = "solid " ,
75
75
)
76
76
plt .plot (
77
77
features_samples_ratio ,
78
78
acc_clf2 ,
79
79
linewidth = 2 ,
80
- label = "Linear Discriminant Analysis " ,
81
- color = "gold " ,
82
- linestyle = "solid " ,
80
+ label = "LDA with Ledoit Wolf " ,
81
+ color = "navy " ,
82
+ linestyle = "dashed " ,
83
83
)
84
84
plt .plot (
85
85
features_samples_ratio ,
86
86
acc_clf3 ,
87
87
linewidth = 2 ,
88
- label = "Linear Discriminant Analysis with OAS" ,
88
+ label = "LDA with OAS" ,
89
89
color = "red" ,
90
90
linestyle = "dotted" ,
91
91
)
92
92
93
93
plt .xlabel ("n_features / n_samples" )
94
94
plt .ylabel ("Classification accuracy" )
95
95
96
- plt .legend (loc = 3 , prop = {"size" : 12 })
96
+ plt .legend (loc = "lower left" )
97
+ plt .ylim ((0.65 , 1.0 ))
97
98
plt .suptitle (
98
- "Linear Discriminant Analysis vs. "
99
+ "LDA ( Linear Discriminant Analysis) vs. "
99
100
+ "\n "
100
- + "Shrinkage Linear Discriminant Analysis vs. "
101
+ + "LDA with Ledoit Wolf vs. "
101
102
+ "\n "
102
- + "OAS Linear Discriminant Analysis (1 discriminative feature)"
103
+ + "LDA with OAS (1 discriminative feature)"
103
104
)
104
105
plt .show ()
0 commit comments