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.