Skip to content

Commit 84ef62f

Browse files
Upgrade ensmallen to 2.20.0 (#57)
* Upgrade ensmallen to 2.20.0 * fix entry * Fix entries in HISTORYold.md * Update NEWS.md * Attempt to restore all URLs in NEWS.md * Remove C++11 designation * Add revdep checks * Drop CXX11 specification * Add changelog and news entry --------- Co-authored-by: coatless <[email protected]> Co-authored-by: James J Balamuta <[email protected]>
1 parent 43013c9 commit 84ef62f

32 files changed

+1285
-213
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@
99
^_pkgdown\.yml$
1010
^docs$
1111
^pkgdown$
12+
^CRAN-SUBMISSION$
13+
^revdep$

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ src/*.dll
99
inst/doc
1010
CRAN-RELEASE
1111
docs
12+
CRAN-SUBMISSION

ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2023-10-05 James Balamuta <[email protected]>
2+
3+
* NEWS.md: Restored mlpack/ensmallen URLs
4+
5+
* DESCRIPTION: Removed CXX11 requirement
6+
* src/Makevars: ditto
7+
* src/Makevars.win: ditto
8+
9+
* DESCRIPTION (Version): Release 2.20.0
10+
* NEWS.md: Update for Ensmallen release 2.20.0
11+
* inst/include/ensmallen_bits: Upgraded to Ensmallen 2.20.0
12+
* inst/include/ensmallen.hpp: ditto
13+
114
2023-02-08 James Balamuta <[email protected]>
215

316
* DESCRIPTION (Version): Release 2.19.1

DESCRIPTION

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: RcppEnsmallen
22
Title: Header-Only C++ Mathematical Optimization Library for 'Armadillo'
3-
Version: 0.2.19.1.1
3+
Version: 0.2.20.0.1
44
Authors@R: c(
55
person("James Joseph", "Balamuta", email = "[email protected]",
66
role = c("aut", "cre", "cph"),
@@ -32,7 +32,6 @@ LinkingTo: Rcpp, RcppArmadillo (>= 0.9.800.0.0)
3232
Imports: Rcpp
3333
RoxygenNote: 7.2.3
3434
Roxygen: list(markdown = TRUE)
35-
SystemRequirements: C++11
3635
Suggests:
3736
knitr,
3837
rmarkdown

NEWS.md

Lines changed: 114 additions & 99 deletions
Large diffs are not rendered by default.

cran-comments.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Test environments
22

3-
* local macOS install, R 4.1.0
4-
* ubuntu 20.04 (with GitHub Actions), R 4.1.0
3+
* local macOS install, R 4.3.1
4+
* ubuntu 20.04 (with GitHub Actions), R 4.3.1
55
* win-builder (devel and release)
66

77
## R CMD check results

inst/include/ensmallen.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@
9797
#include "ensmallen_bits/aug_lagrangian/aug_lagrangian.hpp"
9898
#include "ensmallen_bits/bigbatch_sgd/bigbatch_sgd.hpp"
9999
#include "ensmallen_bits/cmaes/cmaes.hpp"
100+
#include "ensmallen_bits/cmaes/active_cmaes.hpp"
101+
#include "ensmallen_bits/cd/cd.hpp"
100102
#include "ensmallen_bits/cne/cne.hpp"
101103
#include "ensmallen_bits/de/de.hpp"
102104
#include "ensmallen_bits/eve/eve.hpp"
@@ -118,7 +120,6 @@
118120

119121
#include "ensmallen_bits/sa/sa.hpp"
120122
#include "ensmallen_bits/sarah/sarah.hpp"
121-
#include "ensmallen_bits/scd/scd.hpp"
122123
#include "ensmallen_bits/sdp/sdp.hpp"
123124
#include "ensmallen_bits/sdp/lrsdp.hpp"
124125
#include "ensmallen_bits/sdp/primal_dual.hpp"

inst/include/ensmallen_bits/scd/scd.hpp renamed to inst/include/ensmallen_bits/cd/cd.hpp

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/**
2-
* @file scd.hpp
2+
* @file cd.hpp
33
* @author Shikhar Bhardwaj
44
*
5-
* Stochastic Coordinate Descent (SCD).
5+
* Coordinate Descent (CD).
66
*
77
* ensmallen is free software; you may redistribute it and/or modify it under
88
* the terms of the 3-clause BSD license. You should have received a copy of
99
* the 3-clause BSD license along with ensmallen. If not, see
1010
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
1111
*/
12-
#ifndef ENSMALLEN_SCD_SCD_HPP
13-
#define ENSMALLEN_SCD_SCD_HPP
12+
#ifndef ENSMALLEN_CD_CD_HPP
13+
#define ENSMALLEN_CD_CD_HPP
1414

1515
#include "descent_policies/cyclic_descent.hpp"
1616
#include "descent_policies/random_descent.hpp"
@@ -42,19 +42,19 @@ namespace ens {
4242
* }
4343
* @endcode
4444
*
45-
* SCD can optimize partially differentiable functions. For more details, see
45+
* CD can optimize partially differentiable functions. For more details, see
4646
* the documentation on function types included with this distribution or on the
4747
* ensmallen website.
4848
*
4949
* @tparam DescentPolicy Descent policy to decide the order in which the
5050
* coordinate for descent is selected.
5151
*/
5252
template <typename DescentPolicyType = RandomDescent>
53-
class SCD
53+
class CD
5454
{
5555
public:
5656
/**
57-
* Construct the SCD optimizer with the given function and parameters. The
57+
* Construct the CD optimizer with the given function and parameters. The
5858
* default value here are not necessarily good for every problem, so it is
5959
* suggested that the values used are tailored for the task at hand. The
6060
* maximum number of iterations refers to the maximum number of "descents"
@@ -70,11 +70,11 @@ class SCD
7070
* @param descentPolicy The policy to use for picking up the coordinate to
7171
* descend on.
7272
*/
73-
SCD(const double stepSize = 0.01,
74-
const size_t maxIterations = 100000,
75-
const double tolerance = 1e-5,
76-
const size_t updateInterval = 1e3,
77-
const DescentPolicyType descentPolicy = DescentPolicyType());
73+
CD(const double stepSize = 0.01,
74+
const size_t maxIterations = 100000,
75+
const double tolerance = 1e-5,
76+
const size_t updateInterval = 1e3,
77+
const DescentPolicyType descentPolicy = DescentPolicyType());
7878

7979
/**
8080
* Optimize the given function using stochastic coordinate descent. The
@@ -158,6 +158,24 @@ class SCD
158158
} // namespace ens
159159

160160
// Include implementation.
161-
#include "scd_impl.hpp"
161+
#include "cd_impl.hpp"
162+
163+
namespace ens {
164+
165+
/**
166+
* Backwards-compatibility alias; this can be removed after ensmallen 3.10.0.
167+
* The history here is that CD was originally named SCD, but that is an
168+
* inaccurate name because this is not a stochastic technique; thus, it was
169+
* renamed SCD.
170+
*/
171+
template<typename DescentPolicyType = RandomDescent>
172+
using SCD = CD<DescentPolicyType>;
173+
174+
// Convenience typedefs.
175+
using RandomCD = CD<RandomDescent>;
176+
using GreedyCD = CD<GreedyDescent>;
177+
using CyclicCD = CD<CyclicDescent>;
178+
179+
} // namespace ens
162180

163181
#endif

inst/include/ensmallen_bits/scd/scd_impl.hpp renamed to inst/include/ensmallen_bits/cd/cd_impl.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
/**
2-
* @file scd_impl.hpp
2+
* @file cd_impl.hpp
33
* @author Shikhar Bhardwaj
44
*
5-
* Implementation of stochastic coordinate descent.
5+
* Implementation of coordinate descent.
66
*
77
* ensmallen is free software; you may redistribute it and/or modify it under
88
* the terms of the 3-clause BSD license. You should have received a copy of
99
* the 3-clause BSD license along with ensmallen. If not, see
1010
* http://www.opensource.org/licenses/BSD-3-Clause for more information.
1111
*/
12-
#ifndef ENSMALLEN_SCD_SCD_IMPL_HPP
13-
#define ENSMALLEN_SCD_SCD_IMPL_HPP
12+
#ifndef ENSMALLEN_CD_CD_IMPL_HPP
13+
#define ENSMALLEN_CD_CD_IMPL_HPP
1414

1515
// In case it hasn't been included yet.
16-
#include "scd.hpp"
16+
#include "cd.hpp"
1717

1818
#include <ensmallen_bits/function.hpp>
1919

2020
namespace ens {
2121

2222
template <typename DescentPolicyType>
23-
SCD<DescentPolicyType>::SCD(
23+
CD<DescentPolicyType>::CD(
2424
const double stepSize,
2525
const size_t maxIterations,
2626
const double tolerance,
@@ -41,7 +41,7 @@ template <typename ResolvableFunctionType,
4141
typename... CallbackTypes>
4242
typename std::enable_if<IsArmaType<GradType>::value,
4343
typename MatType::elem_type>::type
44-
SCD<DescentPolicyType>::Optimize(
44+
CD<DescentPolicyType>::Optimize(
4545
ResolvableFunctionType& function,
4646
MatType& iterateIn,
4747
CallbackTypes&&... callbacks)
@@ -94,12 +94,12 @@ SCD<DescentPolicyType>::Optimize(
9494
overallObjective, callbacks...);
9595

9696
// Output current objective function.
97-
Info << "SCD: iteration " << i << ", objective " << overallObjective
97+
Info << "CD: iteration " << i << ", objective " << overallObjective
9898
<< "." << std::endl;
9999

100100
if (std::isnan(overallObjective) || std::isinf(overallObjective))
101101
{
102-
Warn << "SCD: converged to " << overallObjective << "; terminating"
102+
Warn << "CD: converged to " << overallObjective << "; terminating"
103103
<< " with failure. Try a smaller step size?" << std::endl;
104104

105105
Callback::EndOptimization(*this, function, iterate, callbacks...);
@@ -108,7 +108,7 @@ SCD<DescentPolicyType>::Optimize(
108108

109109
if (std::abs(lastObjective - overallObjective) < tolerance)
110110
{
111-
Info << "SCD: minimized within tolerance " << tolerance << "; "
111+
Info << "CD: minimized within tolerance " << tolerance << "; "
112112
<< "terminating optimization." << std::endl;
113113

114114
Callback::EndOptimization(*this, function, iterate, callbacks...);
@@ -119,7 +119,7 @@ SCD<DescentPolicyType>::Optimize(
119119
}
120120
}
121121

122-
Info << "SCD: maximum iterations (" << maxIterations << ") reached; "
122+
Info << "CD: maximum iterations (" << maxIterations << ") reached; "
123123
<< "terminating optimization." << std::endl;
124124

125125
// Calculate and return final objective.

0 commit comments

Comments
 (0)