Enum nice_smile::errors::Error

source ·
pub enum Error {
Show 27 variants GeneralError, OutOfRange, NoItem, InvalidValue, NoUsefulSamples, CantSolveEquation, CycleDetected, WrongNumStates, ConflictingEvidence, IllegalId, DuplicatedId, OutOfMemory, ZeroPotential, WrongNodeType, WrongElementType, Interrupted, FileRead, FileWrite, EndOfFile, WrongFile, NoMoreTokens, LexicalError, SyntaxError, UnexpectedEof, FieldNotFound, IoError(Error), NulError(NulError),
}
Expand description

SMILE error enumeration

Variants§

§

GeneralError

SMILE documentation does not specify when this error happens.

§

OutOfRange

SMILE documentation does not specify when this error happens.

§

NoItem

An error occurred when a node has no outcome intervals.

Documented use is only in [smile::ffi::DSL_discDef] if the node has no outcome intervals.

§

InvalidValue

An error occurred when a value is invalid.

Happens when „some of the discretization samples fall outside of the node’s domain (defined by the lower and the upper bounds set earlier by [smile::ffi::DSL_equation::SetBounds])” TODO: The SMILE documentation says that it is a „warning”. This should be checked.

Returned by smile::ffi::DSL_network::SetTarget when nodeHandle was valid, but the value of target is the same as the value of the current target flag of the node (i.e., when trying to set the target flag of a node that is already a target or when trying to clear the target flag of a node that is not a target).

§

NoUsefulSamples

SMILE documentation does not specify when this error happens.

§

CantSolveEquation

SMILE documentation does not specify when this error happens.

§

CycleDetected

An error occurred when a cycle is detected.

This error occurs when calling smile::ffi::DSL_network::AddArc would result in a cycle in the grpah.

§

WrongNumStates

An error occurred when the discretization intervals for the Damper Control Signal node are missing.

When occured, SMILE uses two intervals dividing the node’s domain into two equal halves. Two intervals are adequate in this case, as the equation for this node uses Bernoulli distribution. TODO: The SMILE documentation says that it is a „warning”. This should be checked.

§

ConflictingEvidence

SMILE documentation does not specify when this error happens.

§

IllegalId

SMILE documentation does not specify when this error happens.

§

DuplicatedId

SMILE documentation does not specify when this error happens.

§

OutOfMemory

Returned by smile::ffi::DSL_network::UpdateBeliefs when the temporary data structures required to complete the inference require more memory than that available.

In such case, or if the inference takes too long, consider taking advantage of SMILE’s relevance reasoning layer. TODO: Move this to revelance reasoning docs: Relevance reasoning runs as a pre-processing step, which can lessen the complexity of later stages of inference algorithms. Relevance reasoning takes the target node set into account, therefore, to reduce the workload you should reduce the number of nodes set as targets if possible. Note that by default all nodes are targets (this is the case when no nodes were marked as such). If your network has 1,000 nodes and you only need the probabilities of 20 nodes, by all means call DSL_network::SetTarget on these nodes.

§

ZeroPotential

SMILE documentation does not specify when this error happens.

§

WrongNodeType

This error indicates that operation is not supported on current node type.

§

WrongElementType

SMILE documentation does not specify when this error happens.

§

Interrupted

Some methods can receive progress argument that allows them to be interrupted. This error happens when such iterrupt occurs. For more information consult smile::ffi::DSL_progress docs.

TODO: There should be an abstraction over this error type:

enum ProgressResult<T> {
   Ok(T),
   Interrupted(String)
}

/// Trait for checking progress of learning alghorithms [smile::ffi::DSL_progress].
trait Progress {
  /// Check if the progress should be interrupted.
  ///
  /// The `progress` argument is a number from 0 to 100.
  /// The `message` argument is a message returned by a learning algorithm on every tick.
  ///
  /// This function is called on every iteration of learning algorithms and is equivalent to
  /// [smile::ffi::DSL_progress::Tick].
  fn should_interrupt(&mut self, progress: u8, message: &str) -> bool {
    true
  }
}
§

FileRead

SMILE documentation does not specify when this error happens.

§

FileWrite

SMILE documentation does not specify when this error happens.

§

EndOfFile

SMILE documentation does not specify when this error happens.

§

WrongFile

SMILE documentation does not specify when this error happens.

§

NoMoreTokens

SMILE documentation does not specify when this error happens.

§

LexicalError

SMILE documentation does not specify when this error happens.

§

SyntaxError

SMILE documentation does not specify when this error happens.

§

UnexpectedEof

SMILE documentation does not specify when this error happens.

§

FieldNotFound

SMILE documentation does not specify when this error happens.

§

IoError(Error)

An error occurred while performing an I/O operation.

§

NulError(NulError)

An error occurred while converting a string to a C string.

Trait Implementations§

source§

impl Debug for Error

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Error

source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Error for Error

source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<Error> for Error

source§

fn from(source: Error) -> Self

Converts to this type from the input type.
source§

impl From<NulError> for Error

source§

fn from(source: NulError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Error

§

impl !RefUnwindSafe for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl !UnwindSafe for Error

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.