pub struct LdaParams<F: BixverseFloat> {
pub alpha: F,
pub alpha_by_topic: bool,
pub eta: F,
pub eta_by_topic: bool,
pub max_iter: usize,
pub tol: F,
pub inner_max_iter: usize,
pub inner_tol: F,
pub check_every: usize,
pub learning: LdaLearning,
pub seed: u64,
}Expand description
Options for the variational Bayes LDA solver.
Defaults follow pycisTopic so the knobs mean the same thing on both sides.
Fields§
§alpha: FDirichlet prior on the document-topic distributions.
alpha_by_topic: boolWhether alpha is divided by the topic count. true gives the
Griffiths and Steyvers 50 / k heuristic that cisTopic defaults to.
eta: FDirichlet prior on the topic-term distributions.
eta_by_topic: boolWhether eta is divided by the topic count.
max_iter: usizeMaximum outer iterations (batch), ignored by the online variant which counts epochs instead.
tol: FRelative change in the bound below which the solver stops.
inner_max_iter: usizeMaximum fixed-point iterations of the per-document E-step.
inner_tol: FRelative L1 change in gamma below which the per-document E-step
stops. Relative rather than absolute, see [vb::e_step_document].
check_every: usizeCadence, in iterations, for evaluating the bound and testing tol.
learning: LdaLearningHow the corpus is swept, see LdaLearning.
seed: u64Seed for the lambda and gamma initialisation.
Implementations§
Source§impl<F: BixverseFloat> LdaParams<F>
impl<F: BixverseFloat> LdaParams<F>
Sourcepub fn new(
alpha: F,
alpha_by_topic: bool,
eta: F,
eta_by_topic: bool,
max_iter: usize,
tol: F,
inner_max_iter: usize,
inner_tol: F,
check_every: usize,
learning: LdaLearning,
seed: u64,
) -> Self
pub fn new( alpha: F, alpha_by_topic: bool, eta: F, eta_by_topic: bool, max_iter: usize, tol: F, inner_max_iter: usize, inner_tol: F, check_every: usize, learning: LdaLearning, seed: u64, ) -> Self
Generate a new instance of LdaParams
§Params
alpha- Document-topic Dirichlet prior.alpha_by_topic- Dividealphaby the topic count.eta- Topic-term Dirichlet prior.eta_by_topic- Divideetaby the topic count.max_iter- Maximum outer iterations.tol- Relative bound change for convergence.inner_max_iter- Maximum per-document E-step iterations.inner_tol- Relative L1gammachange for E-step convergence.check_every- Iterations between bound evaluations.learning- Batch or online, see LdaLearning.seed- Seed for the initialisation.
§Returns
The initialised LdaParams.
Sourcepub fn resolve_priors(&self, k: usize) -> Result<(F, F), MethodsErrors>
pub fn resolve_priors(&self, k: usize) -> Result<(F, F), MethodsErrors>
Trait Implementations§
impl<F: Copy + BixverseFloat> Copy for LdaParams<F>
Auto Trait Implementations§
impl<F> Freeze for LdaParams<F>where
F: Freeze,
impl<F> RefUnwindSafe for LdaParams<F>where
F: RefUnwindSafe,
impl<F> Send for LdaParams<F>
impl<F> Sync for LdaParams<F>
impl<F> Unpin for LdaParams<F>where
F: Unpin,
impl<F> UnsafeUnpin for LdaParams<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for LdaParams<F>where
F: UnwindSafe,
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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.