#![allow(clippy::large_const_arrays)]
#![allow(clippy::approx_constant)]
#[derive(Debug, Clone)]
pub struct Dataset {
data: Vec<Vec<f64>>,
target: Vec<f64>,
feature_names: &'static [&'static str],
target_names: &'static [&'static str],
}
impl Dataset {
pub(crate) fn from_const(
data: Vec<Vec<f64>>,
target: Vec<f64>,
feature_names: &'static [&'static str],
target_names: &'static [&'static str],
) -> Self {
Self {
data,
target,
feature_names,
target_names,
}
}
pub fn features(&self) -> crate::Matrix {
crate::Matrix::new(self.data.clone()).expect("embedded dataset data is well-formed")
}
pub fn targets(&self) -> &[f64] {
&self.target
}
pub fn feature_names(&self) -> &[&str] {
self.feature_names
}
pub fn target_names(&self) -> &[&str] {
self.target_names
}
pub fn n_samples(&self) -> usize {
self.data.len()
}
pub fn n_features(&self) -> usize {
self.feature_names.len()
}
pub fn n_classes(&self) -> usize {
self.target_names.len()
}
}
pub mod breast_cancer;
pub mod diabetes;
pub mod iris;
pub mod wine;