pub struct Solution {
pub tree: EmlTree,
pub mse: f64,
pub complexity: usize,
}Expand description
A single discovered expression together with its accuracy and complexity.
Fields§
§tree: EmlTreeThe EML tree (with fitted constants).
mse: f64Mean-squared error on the training data.
complexity: usizeStructural complexity (EML node count).
Implementations§
Source§impl Solution
impl Solution
Sourcepub fn new(tree: EmlTree, mse: f64) -> Self
pub fn new(tree: EmlTree, mse: f64) -> Self
Build a solution from a tree and its MSE; complexity is the node count.
Sourcepub fn latex(&self) -> String
pub fn latex(&self) -> String
Render the expression as a LaTeX math string (via oxieml lowering + simplification).
Sourcepub fn numpy_code(&self) -> String
pub fn numpy_code(&self) -> String
Generate a NumPy-compatible Python lambda for the expression.
Sourcepub fn sympy_code(&self) -> String
pub fn sympy_code(&self) -> String
Generate a SymPy expression string for the expression.
Sourcepub fn distill(&self) -> Distilled
pub fn distill(&self) -> Distilled
Distill the expression into every supported output format at once (canonical LaTeX/pretty plus Rust/NumPy/SymPy code).
Sourcepub fn predict(&self, x: &Array2<f64>) -> Result<Array1<f64>>
pub fn predict(&self, x: &Array2<f64>) -> Result<Array1<f64>>
Evaluate the discovered expression on new data x ([n_rows, n_vars]), returning the
predictions [n_rows] through phop’s guarded forward.
§Errors
Returns crate::PhopError if evaluation fails or produces non-finite values.
Sourcepub fn to_model_json(&self) -> Result<String>
pub fn to_model_json(&self) -> Result<String>
Serialize the discovered law (its EML tree) to a portable JSON string — the model artifact
phop predict consumes. Round-trips with Self::from_model_json.
§Errors
Returns crate::PhopError::Symbolic if serialization fails.
Sourcepub fn from_model_json(s: &str) -> Result<Self>
pub fn from_model_json(s: &str) -> Result<Self>
Reconstruct a law from Self::to_model_json output. The MSE is unknown until the law is
re-evaluated (left as NaN); complexity is recomputed from the tree.
§Errors
Returns crate::PhopError::Parse if the JSON is not a valid serialized EML tree.
Sourcepub fn analyze(&self, wrt: usize, series_order: usize) -> Analysis
pub fn analyze(&self, wrt: usize, series_order: usize) -> Analysis
Symbolically analyze the discovered law via the oxieml CAS: derivative, antiderivative,
Maclaurin series, and the +∞ limit, all w.r.t. variable wrt (see crate::analyze()).
Sourcepub fn certified_root(
&self,
wrt: usize,
others: &[f64],
lo: f64,
hi: f64,
) -> Result<RootCertificate>
pub fn certified_root( &self, wrt: usize, others: &[f64], lo: f64, hi: f64, ) -> Result<RootCertificate>
Find a certified root of the law in [lo, hi] along variable wrt (interval
Newton/Krawczyk verification). others fixes the remaining variables (&[] for 1-D).
§Errors
Returns crate::PhopError if the verifier errors.
Sourcepub fn certified_range(&self, domain: &[(f64, f64)]) -> (f64, f64)
pub fn certified_range(&self, domain: &[(f64, f64)]) -> (f64, f64)
A guaranteed interval enclosure of the law’s range over an axis-aligned domain
([lo, hi] per variable): f(x) ∈ [returned.0, returned.1] for all x in the box.
Sourcepub fn compile_rust(&self, fn_name: &str) -> String
pub fn compile_rust(&self, fn_name: &str) -> String
Generate a standalone, canonical Rust function for the law (lowered + simplified over the
full elementary algebra via oxieml), suitable for embedding/deployment. This differs from
Self::rust_code, which emits the raw eml-form; here the recovered law is simplified to
ordinary exp/ln/+/-/… first.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Solution
impl RefUnwindSafe for Solution
impl Send for Solution
impl Sync for Solution
impl Unpin for Solution
impl UnsafeUnpin for Solution
impl UnwindSafe for Solution
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.