Skip to content

Commit e02140d

Browse files
Upgrade ensmallen to 2.16.1 (#42)
Co-authored-by: coatless <[email protected]>
1 parent c98031d commit e02140d

32 files changed

+83
-32
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2021-03-05 James Balamuta <[email protected]>
2+
3+
* DESCRIPTION (Version): Release 2.16.1
4+
* NEWS.md: Update for Ensmallen release 2.16.1
5+
* inst/include/ensmallen_bits: Upgraded to Ensmallen 2.16.1
6+
* inst/include/ensmallen.hpp: ditto
7+
18
2021-02-19 James Balamuta <[email protected]>
29

310
* DESCRIPTION (Version): Release 2.16.0

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.16.0.1
3+
Version: 0.2.16.1.1
44
Authors@R: c(
55
person("James Joseph", "Balamuta", email = "[email protected]",
66
role = c("aut", "cre", "cph"),

NEWS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# RcppEnsmallen 0.2.16.1.1
2+
3+
- Upgraded to ensmallen 2.16.1: "Severely Dented Can Of Polyurethane" (2021-03-04)
4+
- Fix test compilation issue when `ENS_USE_OPENMP` is set
5+
([#255](https://github.com/mlpack/ensmallen/pull/255)).
6+
- Fix CNE initial population generation to use normal distribution
7+
([#258](https://github.com/mlpack/ensmallen/pull/258)).
8+
- Fix compilation warnings
9+
([#259](https://github.com/mlpack/ensmallen/pull/259)).
10+
111
# RcppEnsmallen 0.2.16.0.1 (GitHub-Only Release)
212

313
- Upgraded to ensmallen 2.16.0: "Severely Dented Can Of Polyurethane" (2021-02-19)

inst/include/ensmallen_bits/callbacks/report.hpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,26 @@ class Report
149149
output << coordinates.n_cols << std::endl;
150150
output << std::endl;
151151

152+
// If we did not take any steps, at least fill what the initial objective
153+
// was.
154+
const bool tookStep = (objectives.size() > 0);
155+
if (objectives.size() == 0 && evaluateCalls > 0)
156+
{
157+
objectives.push_back(objective);
158+
timings.push_back(optimizationTimer.toc());
159+
}
160+
else if (evaluateCalls == 0)
161+
{
162+
// It's not entirely clear how to compute the objective (since the
163+
// function could implement many different ways of evaluating the
164+
// objective), so issue an error and return.
165+
output << "Objective never computed. Did the optimization fail?"
166+
<< std::endl;
167+
PrettyPrintElement("Time (in seconds):", 30);
168+
output << optimizationTimer.toc() << std::endl;
169+
return;
170+
}
171+
152172
output << "Loss:" << std::endl;
153173
PrettyPrintElement("Initial", 30);
154174
output << objectives[0] << std::endl;
@@ -166,7 +186,10 @@ class Report
166186
output << optimizerStream.str();
167187

168188
PrettyPrintElement("Iterations:", 30);
169-
output << objectives.size() << std::endl;
189+
if (tookStep)
190+
output << objectives.size() << std::endl;
191+
else
192+
output << "0 (No steps taken! Did the optimization fail?)" << std::endl;
170193

171194
if (epochCalls > 0)
172195
{
@@ -183,7 +206,7 @@ class Report
183206
output << stepsizes.back() << std::endl;
184207
}
185208

186-
if (hasGradient)
209+
if (hasGradient && gradientsNorm.size() > 0)
187210
{
188211
PrettyPrintElement("Coordinates max. norm:", 30);
189212
output << *std::max_element(std::begin(gradientsNorm),

inst/include/ensmallen_bits/cne/cne_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ typename MatType::elem_type CNE::Optimize(ArbitraryFunctionType& function,
9393
std::vector<BaseMatType> population;
9494
for (size_t i = 0 ; i < populationSize; ++i)
9595
{
96-
population.push_back(arma::randu<BaseMatType>(iterate.n_rows,
96+
population.push_back(arma::randn<BaseMatType>(iterate.n_rows,
9797
iterate.n_cols) + iterate);
9898
}
9999

inst/include/ensmallen_bits/ens_version.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
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.
1818
#define ENS_VERSION_MINOR 16
19-
#define ENS_VERSION_PATCH 0
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".
2424
#define ENS_VERSION_NAME "Severely Dented Can Of Polyurethane"
2525
// Incorporate the date the version was released.
2626
#define ENS_VERSION_YEAR "2021"
27-
#define ENS_VERSION_MONTH "02"
28-
#define ENS_VERSION_DAY "11"
27+
#define ENS_VERSION_MONTH "03"
28+
#define ENS_VERSION_DAY "02"
2929

3030
namespace ens {
3131

inst/include/ensmallen_bits/problems/ackley_function.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class AckleyFunction
6868
MatType GetFinalPoint() const { return MatType("0.0; 0.0"); }
6969

7070
//! Get the final objective.
71-
const double GetFinalObjective() const { return 0.0; }
71+
double GetFinalObjective() const { return 0.0; }
7272

7373
/**
7474
* Evaluate a function for a particular batch-size.

inst/include/ensmallen_bits/problems/beale_function.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class BealeFunction
6161
MatType GetFinalPoint() const { return MatType("3.0; 0.5"); }
6262

6363
//! Get the final objective.
64-
const double GetFinalObjective() const { return 0.0; }
64+
double GetFinalObjective() const { return 0.0; }
6565

6666
/**
6767
* Evaluate a function for a particular batch-size.

inst/include/ensmallen_bits/problems/booth_function.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class BoothFunction
6161
MatType GetFinalPoint() const { return MatType("1.0; 3.0"); }
6262

6363
//! Get the final objective.
64-
const double GetFinalObjective() const { return 0.0; }
64+
double GetFinalObjective() const { return 0.0; }
6565

6666
/**
6767
* Evaluate a function for a particular batch-size.

inst/include/ensmallen_bits/problems/bukin_function.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class BukinFunction
6666
MatType GetFinalPoint() const { return MatType("-10.0; 1.0"); }
6767

6868
//! Get the final objective.
69-
const double GetFinalObjective() const { return 0.0; }
69+
double GetFinalObjective() const { return 0.0; }
7070

7171
/**
7272
* Evaluate a function for a particular batch-size.

0 commit comments

Comments
 (0)