Skip to content

Commit 5e3e94d

Browse files
authored
Prepare 0.14 (#120)
* Bump 0.14 * Update readme and changelog * Update changelog * Add to_discrete|continuous_space aliases * Better names in mixint
1 parent 891009d commit 5e3e94d

File tree

15 files changed

+81
-59
lines changed

15 files changed

+81
-59
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
Changes
22
-------
33

4-
Version 0.14.0 - unreleased
4+
Version 0.15.0 - unreleased
55
===========================
66

7+
Version 0.14.0 - 13/12/2023
8+
===========================
9+
10+
* `ego`: Fix ask-and-tell interface `suggest()` method in presence of discrete variable to work
11+
in discrete not in continuous space
12+
A few API breaking changes:
13+
* `EgorConfig::xtypes` not an option anymore
14+
* `EgorSolver::new_with_xtypes()` renamed `new` as `new` with xlimits is removed, use `to_xtypes` to convert `xlimits`
15+
* `EgorConfig::no_discrete` attribute removed, use `EgorConfig::discrete()` method
16+
* `SurrogateBuilder::new_with_xtypes_rng` renamed `new_with_xtypes`
17+
718
Version 0.13.0 - 30/11/2023
819
===========================
920

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "egobox"
3-
version = "0.13.0"
3+
version = "0.14.0"
44
authors = ["Rémi Lafage <remi.lafage@onera.fr>"]
55
edition = "2021"
66
description = "A toolbox for efficient global optimization"
@@ -31,10 +31,10 @@ persistent-ego = ["egobox-ego/persistent"]
3131
blas = ["ndarray/blas", "egobox-gp/blas", "egobox-moe/blas", "egobox-ego/blas"]
3232

3333
[dependencies]
34-
egobox-doe = { version = "0.13.0", path = "./doe" }
35-
egobox-gp = { version = "0.13.0", path = "./gp" }
36-
egobox-moe = { version = "0.13.0", path = "./moe", features = ["persistent"] }
37-
egobox-ego = { version = "0.13.0", path = "./ego", features = ["persistent"] }
34+
egobox-doe = { version = "0.14.0", path = "./doe" }
35+
egobox-gp = { version = "0.14.0", path = "./gp" }
36+
egobox-moe = { version = "0.14.0", path = "./moe", features = ["persistent"] }
37+
egobox-ego = { version = "0.14.0", path = "./ego", features = ["persistent"] }
3838

3939
linfa = { version = "0.7", default-features = false }
4040

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ Depending on the sub-packages you want to use, you have to add following declara
4040

4141
```text
4242
[dependencies]
43-
egobox-doe = { version = "0.11.0" }
44-
egobox-gp = { version = "0.11.0" }
45-
egobox-moe = { version = "0.11.0" }
46-
egobox-ego = { version = "0.11.0" }
43+
egobox-doe = { version = "0.14.0" }
44+
egobox-gp = { version = "0.14.0" }
45+
egobox-moe = { version = "0.14.0" }
46+
egobox-ego = { version = "0.14.0" }
4747
```
4848

4949
### Features
@@ -86,7 +86,7 @@ Otherwise, you can choose an external BLAS/LAPACK backend available through the
8686
Thus, for instance, to use `gp` with the Intel MKL BLAS/LAPACK backend, you could specify in your `Cargo.toml` the following features:
8787
```text
8888
[dependencies]
89-
egobox-gp = { version = "0.11.0", features = ["blas", "linfa/intel-mkl-static"] }
89+
egobox-gp = { version = "0.14.0", features = ["blas", "linfa/intel-mkl-static"] }
9090
```
9191
or you could run the `gp` example as follows:
9292
``` bash

doe/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "egobox-doe"
3-
version = "0.13.0"
3+
version = "0.14.0"
44
authors = ["Rémi Lafage <remi.lafage@onera.fr>"]
55
edition = "2021"
66
description = "A library for design of experiments"

ego/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "egobox-ego"
3-
version = "0.13.0"
3+
version = "0.14.0"
44
authors = ["Rémi Lafage <remi.lafage@onera.fr>"]
55
edition = "2021"
66
description = "A library for efficient global optimization"
@@ -16,11 +16,11 @@ persistent = ["serde_json"]
1616
blas = ["ndarray-linalg", "linfa/ndarray-linalg", "linfa-pls/blas"]
1717

1818
[dependencies]
19-
egobox-doe = { version = "0.13.0", path = "../doe", features = [
19+
egobox-doe = { version = "0.14.0", path = "../doe", features = [
2020
"serializable",
2121
] }
22-
egobox-gp = { version = "0.13.0", path = "../gp", features = ["serializable"] }
23-
egobox-moe = { version = "0.13.0", path = "../moe", features = [
22+
egobox-gp = { version = "0.14.0", path = "../gp", features = ["serializable"] }
23+
egobox-moe = { version = "0.14.0", path = "../moe", features = [
2424
"serializable",
2525
] }
2626

ego/src/criteria/ei.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,5 @@ impl InfillCriterion for ExpectedImprovement {
9191
}
9292
}
9393

94+
/// Expected Improvement infill criterion
9495
pub const EI: ExpectedImprovement = ExpectedImprovement {};

ego/src/criteria/wb2.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl InfillCriterion for WB2Criterion {
5656
}
5757

5858
/// Computes the scaling factor used to scale WB2 infill criteria.
59-
pub fn compute_wb2s_scale(
59+
pub(crate) fn compute_wb2s_scale(
6060
x: &ArrayView2<f64>,
6161
obj_model: &dyn ClusteredSurrogate,
6262
f_min: f64,
@@ -78,7 +78,9 @@ pub fn compute_wb2s_scale(
7878
}
7979
}
8080

81+
/// WB2 infill criterion
8182
pub const WB2: WB2Criterion = WB2Criterion(Some(1.0));
83+
/// WB2 scaled infill criterion
8284
pub const WB2S: WB2Criterion = WB2Criterion(None);
8385

8486
#[cfg(test)]

ego/src/egor.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ impl<O: GroupFunc, SB: SurrogateBuilder> Egor<O, SB> {
212212
y_hist: y_data,
213213
}
214214
} else {
215-
let x_data = cast_to_discrete_values(&xtypes, &x_data);
216-
let x_data = fold_with_enum_index(&xtypes, &x_data.view());
215+
let x_data = to_discrete_space(&xtypes, &x_data.view());
217216
info!("History: \n{}", concatenate![Axis(1), x_data, y_data]);
218217

219218
let x_opt = result
@@ -222,8 +221,7 @@ impl<O: GroupFunc, SB: SurrogateBuilder> Egor<O, SB> {
222221
.unwrap()
223222
.to_owned()
224223
.insert_axis(Axis(0));
225-
let x_opt = cast_to_discrete_values(&xtypes, &x_opt);
226-
let x_opt = fold_with_enum_index(&xtypes, &x_opt.view());
224+
let x_opt = to_discrete_space(&xtypes, &x_opt.view());
227225
OptimResult {
228226
x_opt: x_opt.row(0).to_owned(),
229227
y_opt: result.state.get_full_best_cost().unwrap().to_owned(),

ego/src/egor_service.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,9 @@ impl<SB: SurrogateBuilder> EgorService<SB> {
131131
y_data: &ArrayBase<impl Data<Elem = f64>, Ix2>,
132132
) -> Array2<f64> {
133133
let xtypes = &self.solver.config.xtypes;
134-
let x_data = unfold_with_enum_mask(xtypes, x_data);
134+
let x_data = to_continuous_space(xtypes, x_data);
135135
let x = self.solver.suggest(&x_data, y_data);
136-
let x = cast_to_discrete_values(xtypes, &x);
137-
fold_with_enum_index(xtypes, &x).to_owned()
136+
to_discrete_space(xtypes, &x).to_owned()
138137
}
139138
}
140139

ego/src/egor_solver.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ impl<SB: SurrogateBuilder> EgorSolver<SB> {
230230
let xtypes = config.xtypes.clone();
231231
EgorSolver {
232232
config,
233-
xlimits: unfold_xtypes_as_continuous_limits(&xtypes),
233+
xlimits: as_continuous_limits(&xtypes),
234234
surrogate_builder: SB::new_with_xtypes(&xtypes),
235235
rng,
236236
}
@@ -312,7 +312,7 @@ where
312312
let doe = hstart_doe.as_ref().or(self.config.doe.as_ref());
313313

314314
let (y_data, x_data) = if let Some(doe) = doe {
315-
let doe = unfold_with_enum_mask(&self.config.xtypes, doe);
315+
let doe = to_continuous_space(&self.config.xtypes, doe);
316316

317317
if doe.ncols() == self.xlimits.nrows() {
318318
// only x are specified
@@ -970,10 +970,9 @@ where
970970
x: &Array2<f64>,
971971
) -> Array2<f64> {
972972
let params = if self.config.discrete() {
973-
// When xtypes is specified, we have to cast x to folded space
974-
// as EgorSolver works internally in the continuous space
975-
let xcast = cast_to_discrete_values(&self.config.xtypes, x);
976-
fold_with_enum_index(&self.config.xtypes, &xcast.view())
973+
// We have to cast x to folded space as EgorSolver
974+
// works internally in the continuous space
975+
to_discrete_space(&self.config.xtypes, x)
977976
} else {
978977
x.to_owned()
979978
};

0 commit comments

Comments
 (0)