1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
//! An ensemble of multiple predictive models. use serde::{Deserialize, Serialize}; use std::collections::HashMap; use super::id::*; use super::status::*; use super::{Resource, ResourceCommon}; /// An ensemble of multiple predictive models. /// /// TODO: Still lots of missing fields. #[derive(Clone, Debug, Deserialize, Resource, Serialize)] #[api_name = "ensemble"] pub struct Ensemble { /// Common resource information. These fields will be serialized at the /// top-level of this structure by `serde`. #[serde(flatten)] pub common: ResourceCommon, /// The ID of this resource. pub resource: Id<Ensemble>, /// The current status of this ensemble. pub status: GenericStatus, /// Extra information about this ensemble. Does not appear to be /// documented in the official API. /// /// TODO: This may need to be wrapped in `Option` to handle the early /// stages of resource creation, when not all fields are present. pub ensemble: EnsembleInfo, /// Maps BigML field IDs to average importance per field. /// /// TODO: This may need to be wrapped in `Option` to handle the early /// stages of resource creation, when not all fields are present. pub importance: HashMap<String, f64>, // The dataset used to create this ensemble. //pub dataset: Id<Dataset>, /// Placeholder to allow extensibility without breaking the API. #[serde(skip)] _placeholder: (), } /// Information about this ensemble. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct EnsembleInfo { /// Information about this ensemble's fields. Keyed by BigML field ID. pub fields: HashMap<String, EnsembleField>, /// Placeholder to allow extensibility without breaking the API. #[serde(skip)] _placeholder: (), } /// List of field codes mapped to input fields #[derive(Clone, Debug, Deserialize, Serialize)] pub struct EnsembleField { /// The original name of this field (not the BigML field ID). pub name: String, /// Placeholder to allow extensibility without breaking the API. #[serde(skip)] _placeholder: (), }