Skip to content

Commit c29d5e5

Browse files
authored
Upgrade to ensmallen 2.12.1 (#25)
* Upgrade to ensmallen 2.12.1 * Update news * changelog * Bump version * Fix "too many requests" issue with multiple URLs to the same project page. From: NEWS.md Status: 429 Message: Too Many Requests
1 parent 73bafed commit c29d5e5

File tree

13 files changed

+156
-245
lines changed

13 files changed

+156
-245
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2020-04-23 James Balamuta <[email protected]>
2+
3+
* DESCRIPTION (Version): Release 2.12.1
4+
5+
* NEWS.md: Update for Ensmallen release 2.12.1
6+
7+
* inst/include/ensmallen_bits: Upgraded to Ensmallen 2.12.1
8+
* inst/include/ensmallen.hpp: ditto
9+
110
2020-02-19 James Balamuta <[email protected]>
211

312
* DESCRIPTION (Version): Release 2.11.3

DESCRIPTION

Lines changed: 1 addition & 1 deletion
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.11.3.1
3+
Version: 0.2.12.1.1
44
Authors@R: c(
55
person("James Joseph", "Balamuta", email = "[email protected]",
66
role = c("aut", "cre", "cph"),

NEWS.md

Lines changed: 65 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,71 @@
1+
# RcppEnsmallen 0.2.12.1.1
2+
3+
- Upgraded to ensmallen 2.12.1: "Stir Crazy" (2020-04-20)
4+
- Fix total number of epochs and time estimation for ProgressBar callback
5+
(mlpack/ensmallen#181).
6+
- Handle SpSubview_col and SpSubview_row in Armadillo 9.870
7+
(mlpack/ensmallen#194).
8+
- Minor documentation fixes
9+
(mlpack/ensmallen#197).
10+
- Correction in the formulation of sigma in CMA-ES
11+
(mlpack/ensmallen#183).
12+
- Remove deprecated methods from PrimalDualSolver implementation
13+
(mlpack/ensmallen#185).
14+
(mlpack/ensmallen#186).
15+
116
# RcppEnsmallen 0.2.11.3.1
217

3-
- Upgraded to ensmallen 2.13.1: "The Poster Session Is Full" (2020-02-19)
18+
- Upgraded to ensmallen 2.11.3: "The Poster Session Is Full" (2020-02-19)
419
- Prevent spurious compiler warnings
5-
([#161](https://github.com/mlpack/ensmallen/pull/161)).
20+
(mlpack/ensmallen#161).
621
- Fix minor memory leaks
7-
([#167](https://github.com/mlpack/ensmallen/pull/167)).
22+
(mlpack/ensmallen#167).
823
- Revamp CMake configuration
9-
([#152](https://github.com/mlpack/ensmallen/pull/152)).
24+
(mlpack/ensmallen#152).
1025
- Allow callback instantiation for SGD based optimizer
11-
([#138](https://github.com/mlpack/ensmallen/pull/155)).
26+
(mlpack/ensmallen#155).
1227
- Minor test stability fixes on i386
13-
([#156](https://github.com/mlpack/ensmallen/pull/156)).
28+
(mlpack/ensmallen#156).
1429
- Fix Lookahead MaxIterations() check.
15-
([#159](https://github.com/mlpack/ensmallen/pull/159)).
30+
(mlpack/ensmallen#159).
1631

1732
# RcppEnsmallen 0.2.11.1.1
1833

1934
- Upgraded to ensmallen 2.11.1: "The Poster Session Is Full" (2019-12-28)
2035
- Fix Lookahead Synchronization period type
21-
([#153](https://github.com/mlpack/ensmallen/pull/153)).
36+
(mlpack/ensmallen#153).
2237
- Add Lookahead
23-
([#138](https://github.com/mlpack/ensmallen/pull/138)).
38+
(mlpack/ensmallen#138).
2439
- Add AdaBound and AMSBound
25-
([#137](https://github.com/mlpack/ensmallen/pull/137)).
40+
(mlpack/ensmallen#137).
2641
- SGD callback test 32-bit safety (big number)
27-
([#143](https://github.com/mlpack/ensmallen/pull/143)).
42+
(mlpack/ensmallen#143).
2843
- Use "arbitrary" and "separable" terms in static function type checks
29-
([#145](https://github.com/mlpack/ensmallen/pull/145)).
44+
(mlpack/ensmallen#145).
3045
- Remove 'using namespace std' from `problems/` files
31-
([#147](https://github.com/mlpack/ensmallen/pull/147)).
46+
(mlpack/ensmallen#147).
3247
- Add optional tests building.
33-
([#141](https://github.com/mlpack/ensmallen/pull/141)).
48+
(mlpack/ensmallen#141).
3449
- Make code samples collapsible in the documentation.
35-
([#140](https://github.com/mlpack/ensmallen/pull/140)).
50+
(mlpack/ensmallen#140).
3651
- Switched deployment from TravisCI to GitHub Actions. ([#17](https://github.com/coatless/rcppensmallen/pull/17), [#22](https://github.com/coatless/rcppensmallen/pull/22))
3752
- Removed check on header file inclusion ([#21](https://github.com/coatless/rcppensmallen/pull/21))
3853

3954
# RcppEnsmallen 0.2.10.3.1
4055

4156
- Upgraded to ensmallen 2.10.3: "Fried Chicken" (2019-09-26)
4257
- Add release script to rel/ for maintainers
43-
([#128](https://github.com/mlpack/ensmallen/pull/128)).
58+
(mlpack/ensmallen#128).
4459
- Fix Armadillo version check
45-
([#133](https://github.com/mlpack/ensmallen/pull/133)).
60+
(mlpack/ensmallen#133).
4661
- Documentation fix for callbacks
47-
([#129](https://github.com/mlpack/ensmallen/pull/129).
62+
(mlpack/ensmallen#129).
4863
- Compatibility fixes for ensmallen 1.x
49-
([#131](https://github.com/mlpack/ensmallen/pull/131)).
64+
(mlpack/ensmallen#131).
5065
- Fix ParallelSGD runtime bug.
51-
([#135](https://github.com/mlpack/ensmallen/pull/135)).
66+
(mlpack/ensmallen#135).
5267
- Add additional L-BFGS convergence check
53-
([#136](https://github.com/mlpack/ensmallen/pull/136)).
68+
(mlpack/ensmallen#136).
5469
- Added vignette with worked example for linear regression and for package
5570
inclusion.
5671

@@ -59,57 +74,57 @@
5974
- Upgraded to ensmallen 2.10.0: "Fried Chicken" (2019-09-07)
6075
- All `Optimize()` functions now take any matrix type; so, e.g., `arma::fmat`
6176
or `arma::sp_mat` can be used for optimization. See the documentation for
62-
more details ([#113](https://github.com/mlpack/ensmallen/pull/113),
63-
[#119](https://github.com/mlpack/ensmallen/pull/119)).
77+
(mlpack/ensmallen#113).
78+
(mlpack/ensmallen#119).
6479
- Introduce callback support. Callbacks can be appended as the last arguments
6580
of an `Optimize()` call, and can perform custom behavior at different points
6681
during the optimization. See the documentation for more details
67-
([#119](https://github.com/mlpack/ensmallen/pull/119)).
82+
(mlpack/ensmallen#119).
6883
- Slight speedups for `FrankWolfe` optimizer
69-
([#127](https://github.com/mlpack/ensmallen/pull/127)).
84+
(mlpack/ensmallen#127).
7085

7186
# RcppEnsmallen 0.1.16.0.1
7287

7388
- Upgraded to ensmallen release 1.16.0 "Loud Alarm Clock" (2019-08-09)
7489
- Add option to avoid computing exact objective at the end of the optimization
75-
([#109](https://github.com/mlpack/ensmallen/pull/109)).
76-
- Fix handling of curvature for BigBatchSGD ([#118](https://github.com/mlpack/ensmallen/pull/118)).
77-
- Reduce runtime of tests ([#118](https://github.com/mlpack/ensmallen/pull/118)).
90+
(mlpack/ensmallen#109).
91+
(mlpack/ensmallen#118).
92+
(mlpack/ensmallen#118).
7893
- Introduce local-best particle swarm optimization, `LBestPSO`, for
79-
unconstrained optimization problems ([#86](https://github.com/mlpack/ensmallen/pull/86)).
80-
- Fix return type error in `PSO` ([#123](https://github.com/mlpack/ensmallen/pull/123))
94+
(mlpack/ensmallen#86).
95+
- (mlpack/ensmallen#123).
8196

8297
# RcppEnsmallen 0.1.15.0.1
8398

8499
- Upgraded to ensmallen release 1.15.0 "Wrong Side Of The Road" (2019-05-14)
85-
- Added QHAdam and QHSGD optimizers ([#81](https://github.com/mlpack/ensmallen/pull/81)).
86-
- Fix `-Wreorder` in `qhadam` warning ([#115](https://github.com/mlpack/ensmallen/pull/115)).
87-
- Fix `-Wunused-private-field` warning in `spsa` ([#115](https://github.com/mlpack/ensmallen/pull/115)).
100+
(mlpack/ensmallen#81).
101+
- (mlpack/ensmallen#115).
102+
- (mlpack/ensmallen#115).
88103

89104
# RcppEnsmallen 0.1.14.4.1
90105

91106
- Upgraded to ensmallen release 1.14.4 "Difficult Crimp" (2019-05-12)
92-
- Fixes for BigBatchSGD ([#91](https://github.com/mlpack/ensmallen/pull/91)).
93-
- Handle eig_sym() failures correctly ([#100](https://github.com/mlpack/ensmallen/pull/100)).
94-
- SPSA test tolerance fix ([#97](https://github.com/mlpack/ensmallen/pull/97)).
95-
- Minor documentation fixes ([#95](https://github.com/mlpack/ensmallen/pull/95), [#98](https://github.com/mlpack/ensmallen/pull/98)).
96-
- Fix newlines at end of file ([#92](https://github.com/mlpack/ensmallen/pull/92)).
107+
(mlpack/ensmallen#91).
108+
(mlpack/ensmallen#100).
109+
(mlpack/ensmallen#97).
110+
(mlpack/ensmallen#98).
111+
(mlpack/ensmallen#92).
97112

98113
# RcppEnsmallen 0.1.14.1.1
99114

100115
- Upgraded to ensmallen release 1.14.1 "Difficult Crimp" (2019-03-09)
101-
- Fixes for SPSA ([#87](https://github.com/mlpack/ensmallen/pull/87)).
102-
- Optimized CNE and DE ([#90](https://github.com/mlpack/ensmallen/pull/90)). Changed initial population generation
116+
(mlpack/ensmallen#87).
117+
(mlpack/ensmallen#90).
103118
in CNE to be a normal distribution about the given starting point,
104119
which should accelerate convergence.
105-
- Add DE optimizer ([#77](https://github.com/mlpack/ensmallen/pull/77)).
106-
- Fix for Cholesky decomposition in CMAES ([#83](https://github.com/mlpack/ensmallen/pull/83)).
120+
(mlpack/ensmallen#77).
121+
(mlpack/ensmallen#83).
107122

108123
# RcppEnsmallen 0.1.13.0.1
109124

110125
- Upgraded to ensmallen release 1.13.0 "Coronavirus Invasion" (2019-01-14)
111-
- Enhance options for AugLagrangian optimizer ([#66](https://github.com/mlpack/ensmallen/pull/66)).
112-
- Add SPSA optimizer ([#69](https://github.com/mlpack/ensmallen/pull/69)).
126+
(mlpack/ensmallen#66).
127+
(mlpack/ensmallen#69).
113128
- Fix list of contributors.
114129
- Make sure all files end with newlines.
115130
- Reordered SPSA parameters to quiet initialization error surfaced with `-Wreorder`.
@@ -119,12 +134,12 @@
119134
- Upgraded to ensmallen release 1.12.0 "New Year's Party" (2018-12-30)
120135
- Add link to ensmallen PDF to README.md.
121136
- Minor documentation fixes. Remove too-verbose documentation from source for
122-
each optimizer ([#61](https://github.com/mlpack/ensmallen/pull/61)).
123-
- Add FTML optimizer ([#48](https://github.com/mlpack/ensmallen/pull/48)).
124-
- Add SWATS optimizer ([#42](https://github.com/mlpack/ensmallen/pull/42)).
125-
- Add Padam optimizer ([#46](https://github.com/mlpack/ensmallen/pull/46)).
126-
- Add Eve optimizer ([#45](https://github.com/mlpack/ensmallen/pull/45)).
127-
- Add ResetPolicy() to SGD-like optimizers ([#60](https://github.com/mlpack/ensmallen/pull/60)).
137+
(mlpack/ensmallen#61).
138+
(mlpack/ensmallen#48).
139+
(mlpack/ensmallen#42).
140+
(mlpack/ensmallen#46).
141+
(mlpack/ensmallen#45).
142+
(mlpack/ensmallen#60).
128143
- Updated citation information
129144

130145
# RcppEnsmallen 0.1.11.1.1

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 3.6.2
4-
* ubuntu 16.04 (with GitHub Actions), R 3.6.2
3+
* local macOS install, R 3.6.3
4+
* ubuntu 16.04 (with GitHub Actions), R 3.6.3
55
* win-builder (devel and release)
66

77
## R CMD check results

inst/include/ensmallen_bits/callbacks/progress_bar.hpp

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,9 @@ class ProgressBar
8181
if (function.NumFunctions() % optimizer.BatchSize() > 0)
8282
epochSize++;
8383

84-
if (!optimizer.MaxIterations())
85-
{
86-
Warn << "Maximum number of iterations not defined (no limit),"
87-
<< " no progress bar shown." << std::endl;
88-
}
89-
else
90-
{
91-
epochs = optimizer.MaxIterations() / epochSize;
92-
if (optimizer.MaxIterations() % epochSize > 0)
93-
epochs++;
94-
}
84+
epochs = optimizer.MaxIterations() / function.NumFunctions();
85+
if (optimizer.MaxIterations() % function.NumFunctions() > 0)
86+
epochs++;
9587

9688
stepTimer.tic();
9789
}
@@ -138,8 +130,12 @@ class ProgressBar
138130
{
139131
if (newEpoch)
140132
{
141-
output << "Epoch " << epoch << "/" << epochs << "\n";
142-
output.flush();
133+
output << "Epoch " << epoch;
134+
if (epochs > 0)
135+
{
136+
output << "/" << epochs;
137+
}
138+
output << '\n';
143139
newEpoch = false;
144140
}
145141

@@ -161,8 +157,8 @@ class ProgressBar
161157
}
162158
}
163159

164-
output << "] " << progress << "% - ETA: " << (size_t) stepTimer.toc() *
165-
(epochSize - step + 1) % 60 << "s - loss: " <<
160+
output << "] " << progress << "% - ETA: " << (size_t) (stepTimer.toc() *
161+
(epochSize - step + 1)) % 60 << "s - loss: " <<
166162
objective / (double) step << "\r";
167163
output.flush();
168164

inst/include/ensmallen_bits/cmaes/cmaes_impl.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ typename MatType::elem_type CMAES<SelectionPolicyType>::Optimize(
7777
const double muEffective = 1 / arma::accu(arma::pow(w, 2));
7878

7979
// Step size control parameters.
80-
BaseMatType sigma(3, 1); // sigma is vector-shaped.
80+
BaseMatType sigma(2, 1); // sigma is vector-shaped.
8181
sigma(0) = 0.3 * (upperBound - lowerBound);
8282
const double cs = (muEffective + 2) / (iterate.n_elem + muEffective + 5);
8383
const double ds = 1 + cs + 2 * std::max(std::sqrt((muEffective - 1) /
@@ -97,7 +97,7 @@ typename MatType::elem_type CMAES<SelectionPolicyType>::Optimize(
9797
muEffective) / (std::pow(iterate.n_elem + 2, 2) +
9898
alphaMu * muEffective / 2));
9999

100-
std::vector<BaseMatType> mPosition(3, BaseMatType(iterate.n_rows,
100+
std::vector<BaseMatType> mPosition(2, BaseMatType(iterate.n_rows,
101101
iterate.n_cols));
102102
mPosition[0] = lowerBound + arma::randu<BaseMatType>(
103103
iterate.n_rows, iterate.n_cols) * (upperBound - lowerBound);
@@ -216,8 +216,7 @@ typename MatType::elem_type CMAES<SelectionPolicyType>::Optimize(
216216
}
217217

218218
const ElemType psNorm = arma::norm(ps[idx1]);
219-
sigma(idx1) = sigma(idx0) * std::pow(
220-
std::exp(cs / ds * psNorm / enn - 1), 0.3);
219+
sigma(idx1) = sigma(idx0) * std::exp(cs / ds * ( psNorm / enn - 1));
221220

222221
// Update covariance matrix.
223222
if ((psNorm / sqrt(1 - std::pow(1 - cs, 2 * i))) < h)

inst/include/ensmallen_bits/ens_version.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
#define ENS_VERSION_MAJOR 2
1616
// The minor version is two digits so regular numerical comparisons of versions
1717
// work right. The first minor version of a release is always 10.
18-
#define ENS_VERSION_MINOR 11
19-
#define ENS_VERSION_PATCH 3
18+
#define ENS_VERSION_MINOR 12
19+
#define ENS_VERSION_PATCH 1
2020
// If this is a release candidate, it will be reflected in the version name
2121
// (i.e. the version name will be "RC1", "RC2", etc.). Otherwise the version
2222
// name will typically be a seemingly arbitrary set of words that does not
2323
// contain the capitalized string "RC".
24-
#define ENS_VERSION_NAME "The Poster Session Is Full"
24+
#define ENS_VERSION_NAME "Stir Crazy"
2525

2626
namespace ens {
2727

inst/include/ensmallen_bits/function/arma_traits.hpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,31 @@ struct MatTypeTraits<arma::SpSubview<eT>>
7676
"or a matrix alias instead!");
7777
};
7878

79+
80+
#if ((ARMA_VERSION_MAJOR >= 10) || \
81+
((ARMA_VERSION_MAJOR == 9) && (ARMA_VERSION_MINOR >= 869)))
82+
83+
// Armadillo 9.869+ has SpSubview_col and SpSubview_row
84+
85+
template<typename eT>
86+
struct MatTypeTraits<arma::SpSubview_col<eT>>
87+
{
88+
static_assert(sizeof(arma::SpSubview_col<eT>) == 0,
89+
"Armadillo subviews cannot be passed to Optimize()! Create a matrix "
90+
"or a matrix alias instead!");
91+
};
92+
93+
template<typename eT>
94+
struct MatTypeTraits<arma::SpSubview_row<eT>>
95+
{
96+
static_assert(sizeof(arma::SpSubview_row<eT>) == 0,
97+
"Armadillo subviews cannot be passed to Optimize()! Create a matrix "
98+
"or a matrix alias instead!");
99+
};
100+
101+
#endif
102+
103+
79104
template<typename eT>
80105
struct MatTypeTraits<arma::Cube<eT>>
81106
{

inst/include/ensmallen_bits/sa/sa.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class SA
7373
* @param initMoveCoef Initial move size.
7474
* @param gain Proportional control in feedback move control.
7575
*/
76-
SA(CoolingScheduleType& coolingSchedule,
76+
SA(const CoolingScheduleType& coolingSchedule = CoolingScheduleType(),
7777
const size_t maxIterations = 1000000,
7878
const double initT = 10000.,
7979
const size_t initMoves = 1000,
@@ -102,6 +102,11 @@ class SA
102102
MatType& iterate,
103103
CallbackTypes&&... callbacks);
104104

105+
//! Get the cooling schedule.
106+
CoolingScheduleType CoolingSchedule() const { return coolingSchedule; }
107+
//! Modify the cooling schedule.
108+
CoolingScheduleType& CoolingSchedule() { return coolingSchedule; }
109+
105110
//! Get the temperature.
106111
double Temperature() const { return temperature; }
107112
//! Modify the temperature.
@@ -139,7 +144,7 @@ class SA
139144

140145
private:
141146
//! The cooling schedule being used.
142-
CoolingScheduleType& coolingSchedule;
147+
CoolingScheduleType coolingSchedule;
143148
//! The maximum number of iterations.
144149
size_t maxIterations;
145150
//! The current temperature.

inst/include/ensmallen_bits/sa/sa_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace ens {
1818

1919
template<typename CoolingScheduleType>
2020
SA<CoolingScheduleType>::SA(
21-
CoolingScheduleType& coolingSchedule,
21+
const CoolingScheduleType& coolingSchedule,
2222
const size_t maxIterations,
2323
const double initT,
2424
const size_t initMoves,

0 commit comments

Comments
 (0)