Skip to content

Commit

Permalink
Fix persistent feature consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
relf committed Feb 1, 2024
1 parent 919c08a commit 7acdaf6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ blas = ["ndarray/blas", "egobox-gp/blas", "egobox-moe/blas", "egobox-ego/blas"]
egobox-doe = { version = "0.15.0", path = "./doe" }
egobox-gp = { version = "0.15.0", path = "./gp" }
egobox-moe = { version = "0.15.0", path = "./moe", features = ["persistent"] }
egobox-ego = { version = "0.15.0", path = "./ego" }
egobox-ego = { version = "0.15.0", path = "./ego", features = ["persistent"] }

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

Expand Down
1 change: 1 addition & 0 deletions ego/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ categories = ["algorithms", "mathematics", "science"]
[features]
default = []

persistent = ["egobox-moe/persistent"]
blas = ["ndarray-linalg", "linfa/ndarray-linalg", "linfa-pls/blas"]

[dependencies]
Expand Down
6 changes: 5 additions & 1 deletion ego/src/mixint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ use ndarray::{s, Array, Array2, ArrayBase, ArrayView2, Axis, Data, DataMut, Ix2,
use ndarray_rand::rand::SeedableRng;
use ndarray_stats::QuantileExt;
use rand_xoshiro::Xoshiro256Plus;
use std::marker::PhantomData;

use serde::{Deserialize, Serialize};

#[cfg(feature = "persistent")]
use egobox_moe::MoeError;
#[cfg(feature = "persistent")]
use std::fs;
#[cfg(feature = "persistent")]
use std::io::Write;
use std::marker::PhantomData;

/// Expand xlimits to add continuous dimensions for enumeration x features.
///
Expand Down Expand Up @@ -549,6 +552,7 @@ impl GpSurrogate for MixintMoe {
}

/// Save Moe model in given file.
#[cfg(feature = "persistent")]
fn save(&self, path: &str) -> egobox_moe::Result<()> {
let mut file = fs::File::create(path).unwrap();
let bytes = match serde_json::to_string(self) {
Expand Down

0 comments on commit 7acdaf6

Please sign in to comment.