use treeboost::dataset::{BinnedDataset, FeatureInfo, FeatureType};
pub fn create_synthetic_dataset(n: usize, seed: u64) -> BinnedDataset {
let mut state = seed;
let mut next_rand = || -> f32 {
state = state.wrapping_mul(1103515245).wrapping_add(12345);
((state >> 16) & 0x7FFF) as f32 / 32767.0
};
let num_features = 5;
let mut features = Vec::with_capacity(n * num_features);
for _f in 0..num_features {
for _r in 0..n {
features.push((next_rand() * 255.0) as u8);
}
}
let targets: Vec<f32> = (0..n)
.map(|i| {
let f0 = features[i] as f32 / 255.0;
let f1 = features[n + i] as f32 / 255.0;
f0 * 10.0 + f1 * 5.0 + next_rand() * 0.5
})
.collect();
let feature_info: Vec<FeatureInfo> = (0..num_features)
.map(|i| FeatureInfo {
name: format!("feature_{}", i),
feature_type: FeatureType::Numeric,
num_bins: 255,
bin_boundaries: vec![],
})
.collect();
BinnedDataset::new(n, features, targets, feature_info)
}