pub struct CompressionParams {
    pub pseudocounts: u64,
    pub topk: usize,
    pub structure_penalty: f64,
    pub topk_use_only_likelihood: bool,
    pub aic: f64,
    pub arity: u32,
}
Expand description

Parameters for grammar induction.

Proposed grammars are scored as likelihood - aic * #primitives - structure_penalty * #nodes. Additionally, pseudocounts affects the likelihood calculation, and topk and arity affect what fragments can be proposed.

Fields§

§pseudocounts: u64

Pseudocounts are added to the observed counts associated with each primitive and invented expression.

§topk: usize

Rather than using every expression in the frontier for proposing fragments, only use the topk best expressions in each frontier.

§structure_penalty: f64

Structure penalty penalizes the total number of nodes in each Expression of the grammar’s primitives and invented expressions.

§topk_use_only_likelihood: bool

Determines whether to use the maximum a-posteriori value for topk evaluation, or whether to use only the likelihood. Leave this to false unless you know what you are doing.

§aic: f64

AIC is a penalty in the number of parameters, i.e. the number of primitives and invented expressions.

§arity: u32

Arity is the largest applicative depth of an expression that may be manipulated to propose a fragment.

Trait Implementations§

source§

impl Default for CompressionParams

source§

fn default() -> Self

The default params prevent completely discarding of primives by having non-zero pseudocounts.

CompressionParams {
    pseudocounts: 5,
    topk: 2,
    topk_use_only_likelihood: false,
    structure_penalty: 1f64,
    aic: 1f64,
    arity: 2,
}

Auto Trait Implementations§

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V