@@ -42,38 +42,47 @@ function conditional_gradients(
42
42
43
43
# determine oracle
44
44
if oracle_type == " CG"
45
- oracle = frank_wolfe
45
+ oracle = FrankWolfe. frank_wolfe
46
+ elseif oracle_type == " Away" || oracle_type == " AFW"
47
+ oracle = FrankWolfe. away_frank_wolfe
48
+ elseif oracle_type == " PCG"
49
+ oracle = FrankWolfe. pairwise_frank_wolfe
50
+ elseif oracle_type == " Lazy" || oracle_type == " LCG"
51
+ oracle = FrankWolfe. lazified_conditional_gradient
46
52
elseif oracle_type == " BCG"
47
- oracle = blended_conditional_gradient
53
+ oracle = FrankWolfe . blended_conditional_gradient
48
54
elseif oracle_type == " BPCG"
49
55
oracle = FrankWolfe. blended_pairwise_conditional_gradient
50
56
end
51
57
52
58
# create L1 ball as feasible region
53
59
region = FrankWolfe. LpNormLMO {1} (tau- 1 )
54
-
55
- # compute starting point
60
+
61
+
62
+ # call oracles
56
63
if inverse_hessian_boost in [" weak" , " full" ]
64
+ display (" Inverse Hessian Boosting (IHB) is active. Vanilla Frank-Wolfe is used for the IHB run." )
65
+
66
+ # compute starting point for IHB
57
67
x0 = l1_projection (solution; radius= tau- 1 )
58
68
x0 = reshape (x0, length (x0))
59
- else
60
- x0 = compute_extreme_point (region, zeros (Float64, n))
61
- x0 = Vector (x0)
62
- end
63
-
64
- # run oracle to find coefficient vector
65
- if inverse_hessian_boost == " weak"
66
- coefficient_vector, _ = oracle (f, grad!, region, x0; epsilon= epsilon, max_iteration= max_iters)
69
+
70
+ # IHB oracle call
71
+ coefficient_vector, _ = FrankWolfe. frank_wolfe (f, grad!, region, x0; epsilon= epsilon, max_iteration= max_iters)
67
72
if typeof (coefficient_vector) <: FrankWolfe.ScaledHotVector
68
73
coefficient_vector = convert (Vector, coefficient_vector)
69
74
end
70
75
coefficient_vector = vcat (coefficient_vector, [1 ])
71
76
72
77
loss = 1 / m * norm (data_with_labels * coefficient_vector, 2 )^ 2
73
-
74
- if loss <= psi
78
+
79
+ # attempt to find sparse solution if IHB solution found
80
+ if inverse_hessian_boost == " weak" && loss <= psi
81
+ display (" IHB solution found. Attempting to find sparse solution." )
82
+
75
83
x0 = compute_extreme_point (region, zeros (Float64, n))
76
84
x0 = Vector (x0)
85
+
77
86
tmp_coefficient_vector, _ = oracle (f, grad!, region, x0; epsilon= epsilon, max_iteration= max_iters)
78
87
tmp_coefficient_vector = vcat (tmp_coefficient_vector, [1 ])
79
88
@@ -83,14 +92,18 @@ function conditional_gradients(
83
92
loss = loss2
84
93
coefficient_vector = tmp_coefficient_vector
85
94
end
86
-
87
95
end
88
- else
96
+ else
97
+ # compute starting vertex
98
+ x0 = compute_extreme_point (region, zeros (Float64, n))
99
+ x0 = Vector (x0)
100
+
101
+ # oracle call
89
102
coefficient_vector, _ = oracle (f, grad!, region, x0; epsilon= epsilon, max_iteration= max_iters)
90
103
coefficient_vector = vcat (coefficient_vector, [1 ])
91
104
92
105
loss = 1 / m * norm (data_with_labels * coefficient_vector, 2 )^ 2
93
- end
106
+ end
94
107
return coefficient_vector, loss
95
108
end
96
109
0 commit comments