Skip to main content

nominal_api/conjure/objects/scout/compute/api/
curve_fit_result.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct CurveFitResult {
13    #[serde(rename = "r2")]
14    #[derive_with(with = conjure_object::private::DoubleWrapper)]
15    r2: f64,
16    #[builder(custom(type = super::CurveResultDetails, convert = Box::new))]
17    #[serde(rename = "curveResultDetails")]
18    curve_result_details: Box<super::CurveResultDetails>,
19}
20impl CurveFitResult {
21    /// Constructs a new instance of the type.
22    #[inline]
23    pub fn new(r2: f64, curve_result_details: super::CurveResultDetails) -> Self {
24        Self::builder().r2(r2).curve_result_details(curve_result_details).build()
25    }
26    /// R^2 (coefficient of determination) for the fit curve, a normalized measure of how well the curve fits the data.
27    /// Usually ranges from 0 to 1, with higher indicating better fit (points closer to fit line).
28    #[inline]
29    pub fn r2(&self) -> f64 {
30        self.r2
31    }
32    /// Description of the fit curve.
33    #[inline]
34    pub fn curve_result_details(&self) -> &super::CurveResultDetails {
35        &*self.curve_result_details
36    }
37}