14 #ifndef MLPACK_CORE_OPTIMIZERS_FW_CONSTR_STRUCTURE_GROUP_HPP 15 #define MLPACK_CORE_OPTIMIZERS_FW_CONSTR_STRUCTURE_GROUP_HPP 21 namespace optimization {
67 template<
typename GroupType>
78 groupExtractor(groupExtractor)
87 void Optimize(
const arma::mat& v, arma::mat& s)
89 size_t nGroups = groupExtractor.NumGroups();
91 size_t optimalGroup = 1;
94 for (
size_t i = 1; i <= nGroups; ++i)
97 groupExtractor.ProjectToGroup(v, i, y);
98 double newNorm = groupExtractor.DualNorm(y, i);
101 if (newNorm > dualNorm)
108 groupExtractor.OptimalFromGroup(v, optimalGroup, s);
113 GroupType& groupExtractor;
132 const size_t dimOrig,
133 std::vector<arma::uvec> groupIndicesList):
134 p(p), numGroups(groupIndicesList.size()),
136 groupIndicesList(groupIndicesList),
149 arma::uvec& indList = groupIndicesList[groupId - 1];
150 size_t dim = indList.n_elem;
153 for (
size_t i = 0; i < dim; ++i)
154 y(i) = v(indList(i));
169 ProjectToGroup(v, groupId, yk);
172 arma::vec sProj(yk.n_elem);
173 lpBallSolver.Optimize(yk, sProj);
176 arma::uvec& indList = groupIndicesList[groupId - 1];
177 size_t dim = indList.n_elem;
180 for (
size_t i = 0; i < dim; ++i)
181 s(indList(i)) = sProj(i);
195 double DualNorm(
const arma::vec& yk,
const int groupId)
197 if (p == std::numeric_limits<double>::infinity())
200 return arma::norm(yk, 1);
205 double q = 1.0 / (1.0 - 1.0/p);
206 return arma::norm(yk, q);
211 return arma::norm(yk,
"inf");
232 std::vector<arma::uvec> groupIndicesList;
void ProjectToGroup(const arma::mat &v, const size_t groupId, arma::vec &y)
Projection to specific group.
GroupLpBall(const double p, const size_t dimOrig, std::vector< arma::uvec > groupIndicesList)
Construct the lp ball group extractor class.
void OptimalFromGroup(const arma::mat &v, const size_t groupId, arma::mat &s)
Get optimal atom, which belongs to specific group.
double DualNorm(const arma::vec &yk, const int groupId)
Compute the q-norm of yk, 1/p+1/q=1.
void Optimize(const arma::mat &v, arma::mat &s)
Optimizer of structure group ball constrained Problem for FrankWolfe.
The core includes that mlpack expects; standard C++ includes and Armadillo.
Linear Constrained Solver for FrankWolfe.
size_t NumGroups() const
Get the number of groups.
static MLPACK_EXPORT util::PrefixedOutStream Fatal
Prints fatal messages prefixed with [FATAL], then terminates the program.
size_t & NumGroups()
Modify the number of groups.
LinearConstrSolver for FrankWolfe algorithm.
Implementation of Structured Group.
ConstrStructGroupSolver(GroupType &groupExtractor)
Construct the structure group optimization solver.