pub struct Oracle {
pub states: Vec<State>,
pub codebook: Codebook,
pub data: DataStore,
}
Expand description
Oracle answers questions
Fields§
§states: Vec<State>
Vector of states
codebook: Codebook
Metadata for the rows and columns
data: DataStore
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for Oracle
impl<'de> Deserialize<'de> for Oracle
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<Oracle> for DatalessOracle
impl From<Oracle> for DatalessOracle
source§impl HasStates for Oracle
impl HasStates for Oracle
source§fn states_mut(&mut self) -> &mut Vec<State>
fn states_mut(&mut self) -> &mut Vec<State>
Get a mutable reference to the States
Auto Trait Implementations§
impl RefUnwindSafe for Oracle
impl Send for Oracle
impl Sync for Oracle
impl Unpin for Oracle
impl UnwindSafe for Oracle
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
Mutably borrows from an owned value. Read more
source§impl<T> OracleT for Twhere
T: CanOracle,
impl<T> OracleT for Twhere
T: CanOracle,
source§fn state_diagnostics(&self) -> Vec<StateDiagnostics>
fn state_diagnostics(&self) -> Vec<StateDiagnostics>
Returns the diagnostics for each state
source§fn shape(&self) -> (usize, usize, usize)
fn shape(&self) -> (usize, usize, usize)
Returns a tuple containing the number of rows, the number of columns,
and the number of states Read more
source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Returns true if the object is empty, having no structure to analyze.
source§fn ftype<Ix: ColumnIndex>(&self, col_ix: Ix) -> Result<FType, IndexError>
fn ftype<Ix: ColumnIndex>(&self, col_ix: Ix) -> Result<FType, IndexError>
Return the FType of the column
col_ix
Read moresource§fn summarize_col<Ix: ColumnIndex>(
&self,
col_ix: Ix
) -> Result<SummaryStatistics, IndexError>
fn summarize_col<Ix: ColumnIndex>( &self, col_ix: Ix ) -> Result<SummaryStatistics, IndexError>
Return a summary of the data in the column Read more
source§fn depprob<Ix: ColumnIndex>(
&self,
col_a: Ix,
col_b: Ix
) -> Result<f64, IndexError>
fn depprob<Ix: ColumnIndex>( &self, col_a: Ix, col_b: Ix ) -> Result<f64, IndexError>
source§fn depprob_pw<'x, Ix>(
&self,
pairs: &'x [(Ix, Ix)]
) -> Result<Vec<f64>, IndexError>
fn depprob_pw<'x, Ix>( &self, pairs: &'x [(Ix, Ix)] ) -> Result<Vec<f64>, IndexError>
Compute dependence probability for a list of column pairs. Read more
fn _rowsim_validation( &self, row_a: usize, row_b: usize, wrt: &Option<&Vec<usize>> ) -> Result<(), RowSimError>
source§fn rowsim<RIx: RowIndex, CIx: ColumnIndex>(
&self,
row_a: RIx,
row_b: RIx,
wrt: Option<&[CIx]>,
variant: RowSimilarityVariant
) -> Result<f64, RowSimError>
fn rowsim<RIx: RowIndex, CIx: ColumnIndex>( &self, row_a: RIx, row_b: RIx, wrt: Option<&[CIx]>, variant: RowSimilarityVariant ) -> Result<f64, RowSimError>
source§fn rowsim_pw<'x, RIx, CIx>(
&self,
pairs: &'x [(RIx, RIx)],
wrt: Option<&[CIx]>,
variant: RowSimilarityVariant
) -> Result<Vec<f64>, RowSimError>where
RIx: RowIndex,
CIx: ColumnIndex + Sync,
&'x [(RIx, RIx)]: IntoParallelIterator<Item = &'x (RIx, RIx)>,
fn rowsim_pw<'x, RIx, CIx>(
&self,
pairs: &'x [(RIx, RIx)],
wrt: Option<&[CIx]>,
variant: RowSimilarityVariant
) -> Result<Vec<f64>, RowSimError>where
RIx: RowIndex,
CIx: ColumnIndex + Sync,
&'x [(RIx, RIx)]: IntoParallelIterator<Item = &'x (RIx, RIx)>,
Compute row similarity for pairs of rows Read more
source§fn novelty<RIx: RowIndex, CIx: ColumnIndex>(
&self,
row_ix: RIx,
wrt: Option<&[CIx]>
) -> Result<f64, IndexError>
fn novelty<RIx: RowIndex, CIx: ColumnIndex>( &self, row_ix: RIx, wrt: Option<&[CIx]> ) -> Result<f64, IndexError>
Determine the relative novelty of a row. Read more
source§fn mi<Ix: ColumnIndex>(
&self,
col_a: Ix,
col_b: Ix,
n: usize,
mi_type: MiType
) -> Result<f64, MiError>
fn mi<Ix: ColumnIndex>( &self, col_a: Ix, col_b: Ix, n: usize, mi_type: MiType ) -> Result<f64, MiError>
source§fn mi_pw<Ix: ColumnIndex>(
&self,
col_pairs: &[(Ix, Ix)],
n: usize,
mi_type: MiType
) -> Result<Vec<f64>, MiError>
fn mi_pw<Ix: ColumnIndex>( &self, col_pairs: &[(Ix, Ix)], n: usize, mi_type: MiType ) -> Result<Vec<f64>, MiError>
Compute mutual information over pairs of columns Read more
source§fn entropy<Ix: ColumnIndex>(
&self,
col_ixs: &[Ix],
n: usize
) -> Result<f64, EntropyError>
fn entropy<Ix: ColumnIndex>( &self, col_ixs: &[Ix], n: usize ) -> Result<f64, EntropyError>
Estimate joint entropy Read more
source§fn predictor_search<Ix: ColumnIndex>(
&self,
cols_t: &[Ix],
max_predictors: usize,
n_qmc_samples: usize
) -> Result<Vec<(usize, f64)>, IndexError>
fn predictor_search<Ix: ColumnIndex>( &self, cols_t: &[Ix], max_predictors: usize, n_qmc_samples: usize ) -> Result<Vec<(usize, f64)>, IndexError>
Determine the set of predictors that most efficiently account for the
most information in a set of target columns. Read more
source§fn info_prop<IxT: ColumnIndex, IxX: ColumnIndex>(
&self,
cols_t: &[IxT],
cols_x: &[IxX],
n: usize
) -> Result<f64, InfoPropError>
fn info_prop<IxT: ColumnIndex, IxX: ColumnIndex>( &self, cols_t: &[IxT], cols_x: &[IxX], n: usize ) -> Result<f64, InfoPropError>
source§fn conditional_entropy<IxT: ColumnIndex, IxX: ColumnIndex>(
&self,
col_t: IxT,
cols_x: &[IxX],
n: usize
) -> Result<f64, ConditionalEntropyError>
fn conditional_entropy<IxT: ColumnIndex, IxX: ColumnIndex>( &self, col_t: IxT, cols_x: &[IxX], n: usize ) -> Result<f64, ConditionalEntropyError>
Conditional entropy H(T|X) where X is lists of column indices Read more
source§fn conditional_entropy_pw<Ix: ColumnIndex>(
&self,
col_pairs: &[(Ix, Ix)],
n: usize,
kind: ConditionalEntropyType
) -> Result<Vec<f64>, ConditionalEntropyError>
fn conditional_entropy_pw<Ix: ColumnIndex>( &self, col_pairs: &[(Ix, Ix)], n: usize, kind: ConditionalEntropyType ) -> Result<Vec<f64>, ConditionalEntropyError>
Pairwise copmutation of conditional entreopy or information proportion Read more
source§fn surprisal<RIx: RowIndex, CIx: ColumnIndex>(
&self,
x: &Datum,
row_ix: RIx,
col_ix: CIx,
state_ixs: Option<Vec<usize>>
) -> Result<Option<f64>, SurprisalError>
fn surprisal<RIx: RowIndex, CIx: ColumnIndex>( &self, x: &Datum, row_ix: RIx, col_ix: CIx, state_ixs: Option<Vec<usize>> ) -> Result<Option<f64>, SurprisalError>
Negative log PDF/PMF of a datum, x, in a specific cell of the table at
position row_ix, col_ix. Read more
source§fn self_surprisal<RIx: RowIndex, CIx: ColumnIndex>(
&self,
row_ix: RIx,
col_ix: CIx,
state_ixs: Option<Vec<usize>>
) -> Result<Option<f64>, SurprisalError>
fn self_surprisal<RIx: RowIndex, CIx: ColumnIndex>( &self, row_ix: RIx, col_ix: CIx, state_ixs: Option<Vec<usize>> ) -> Result<Option<f64>, SurprisalError>
Get the surprisal of the datum in a cell. Read more
source§fn datum<RIx: RowIndex, CIx: ColumnIndex>(
&self,
row_ix: RIx,
col_ix: CIx
) -> Result<Datum, IndexError>
fn datum<RIx: RowIndex, CIx: ColumnIndex>( &self, row_ix: RIx, col_ix: CIx ) -> Result<Datum, IndexError>
Get the datum at an index Read more
source§fn logp<Ix: ColumnIndex, GIx: ColumnIndex>(
&self,
col_ixs: &[Ix],
vals: &[Vec<Datum>],
given: &Given<GIx>,
state_ixs_opt: Option<&[usize]>
) -> Result<Vec<f64>, LogpError>
fn logp<Ix: ColumnIndex, GIx: ColumnIndex>( &self, col_ixs: &[Ix], vals: &[Vec<Datum>], given: &Given<GIx>, state_ixs_opt: Option<&[usize]> ) -> Result<Vec<f64>, LogpError>
Compute the log PDF/PMF of a set of values possibly conditioned on the
values of other columns Read more
source§fn logp_scaled<Ix: ColumnIndex, GIx: ColumnIndex>(
&self,
col_ixs: &[Ix],
vals: &[Vec<Datum>],
given: &Given<GIx>,
state_ixs_opt: Option<&[usize]>
) -> Result<Vec<f64>, LogpError>where
Self: Sized,
fn logp_scaled<Ix: ColumnIndex, GIx: ColumnIndex>(
&self,
col_ixs: &[Ix],
vals: &[Vec<Datum>],
given: &Given<GIx>,
state_ixs_opt: Option<&[usize]>
) -> Result<Vec<f64>, LogpError>where
Self: Sized,
A version of
logp
where the likelihood are scaled by the column modes. Read moresource§fn draw<RIx: RowIndex, CIx: ColumnIndex, R: Rng>(
&self,
row_ix: RIx,
col_ix: CIx,
n: usize,
rng: &mut R
) -> Result<Vec<Datum>, IndexError>
fn draw<RIx: RowIndex, CIx: ColumnIndex, R: Rng>( &self, row_ix: RIx, col_ix: CIx, n: usize, rng: &mut R ) -> Result<Vec<Datum>, IndexError>
source§fn simulate<Ix: ColumnIndex, GIx: ColumnIndex, R: Rng>(
&self,
col_ixs: &[Ix],
given: &Given<GIx>,
n: usize,
state_ixs_opt: Option<Vec<usize>>,
rng: &mut R
) -> Result<Vec<Vec<Datum>>, SimulateError>
fn simulate<Ix: ColumnIndex, GIx: ColumnIndex, R: Rng>( &self, col_ixs: &[Ix], given: &Given<GIx>, n: usize, state_ixs_opt: Option<Vec<usize>>, rng: &mut R ) -> Result<Vec<Vec<Datum>>, SimulateError>
Simulate values from joint or conditional distribution Read more
source§fn impute<RIx: RowIndex, CIx: ColumnIndex>(
&self,
row_ix: RIx,
col_ix: CIx,
with_uncertainty: bool
) -> Result<(Datum, Option<f64>), IndexError>
fn impute<RIx: RowIndex, CIx: ColumnIndex>( &self, row_ix: RIx, col_ix: CIx, with_uncertainty: bool ) -> Result<(Datum, Option<f64>), IndexError>
Return the most likely value for a cell in the table along with the
confidence in that imputation. Read more
source§fn predict<Ix: ColumnIndex, GIx: ColumnIndex>(
&self,
col_ix: Ix,
given: &Given<GIx>,
with_uncertainty: bool,
state_ixs_opt: Option<&[usize]>
) -> Result<(Datum, Option<f64>), PredictError>
fn predict<Ix: ColumnIndex, GIx: ColumnIndex>( &self, col_ix: Ix, given: &Given<GIx>, with_uncertainty: bool, state_ixs_opt: Option<&[usize]> ) -> Result<(Datum, Option<f64>), PredictError>
Return the most likely value for a column given a set of conditions
along with the confidence in that prediction. Read more
source§fn variability<Ix: ColumnIndex, GIx: ColumnIndex>(
&self,
col_ix: Ix,
given: &Given<GIx>,
state_ixs_opt: Option<&[usize]>
) -> Result<Variability, VariabilityError>
fn variability<Ix: ColumnIndex, GIx: ColumnIndex>( &self, col_ix: Ix, given: &Given<GIx>, state_ixs_opt: Option<&[usize]> ) -> Result<Variability, VariabilityError>
Compute the variability of a conditional distribution Read more
source§fn feature_error<Ix: ColumnIndex>(
&self,
col_ix: Ix
) -> Result<(f64, f64), IndexError>
fn feature_error<Ix: ColumnIndex>( &self, col_ix: Ix ) -> Result<(f64, f64), IndexError>
Compute the error between the observed data in a feature and the feature
model. Read more
fn _logp_unchecked( &self, col_ixs: &[usize], vals: &[Vec<Datum>], given: &Given<usize>, state_ixs_opt: Option<&[usize]>, scaled: bool ) -> Vec<f64>
fn _simulate_unchecked<R: Rng>( &self, col_ixs: &[usize], given: &Given<usize>, n: usize, state_ixs_opt: Option<Vec<usize>>, rng: &mut R ) -> Vec<Vec<Datum>>
fn _surprisal_unchecked( &self, x: &Datum, row_ix: usize, col_ix: usize, state_ixs_opt: Option<Vec<usize>> ) -> Option<f64>
source§fn _dual_entropy(&self, col_a: usize, col_b: usize, n: usize) -> f64
fn _dual_entropy(&self, col_a: usize, col_b: usize, n: usize) -> f64
specialization for column pairs. If a specialization is not founds for
the specific columns types, will fall back to MC approximation
source§fn _mi_components(&self, col_a: usize, col_b: usize, n: usize) -> MiComponents
fn _mi_components(&self, col_a: usize, col_b: usize, n: usize) -> MiComponents
Get the components of mutual information between two columns
source§fn _sobol_joint_entropy(&self, col_ixs: &[usize], n: usize) -> f64
fn _sobol_joint_entropy(&self, col_ixs: &[usize], n: usize) -> f64
Use a Sobol QMC sequence to appropriate joint entropy Read more
fn _mc_joint_entropy<R: Rng>( &self, col_ixs: &[usize], n: usize, rng: &mut R ) -> f64
fn _entropy_unchecked(&self, col_ixs: &[usize], n: usize) -> f64
source§fn _impute_uncertainty(&self, row_ix: usize, col_ix: usize) -> f64
fn _impute_uncertainty(&self, row_ix: usize, col_ix: usize) -> f64
Computes the predictive uncertainty for the datum at (row_ix, col_ix)
as mean the pairwise KL divergence between the components to which the
datum is assigned. Read more
source§fn _predict_uncertainty(
&self,
col_ix: usize,
given: &Given<usize>,
state_ixs_opt: Option<&[usize]>
) -> f64
fn _predict_uncertainty( &self, col_ix: usize, given: &Given<usize>, state_ixs_opt: Option<&[usize]> ) -> f64
Computes the uncertainty associated with predicting the value of a
features with optional given conditions. Uses Jensen-Shannon divergence
computed on the mixture of mixtures. Read more
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.