IvectorExtractorStats is a class used to update the parameters of the ivector extractor. More...
#include <ivector-extractor.h>
Public Member Functions | |
IvectorExtractorStats () | |
IvectorExtractorStats (const IvectorExtractor &extractor, const IvectorExtractorStatsOptions &stats_opts) | |
void | Add (const IvectorExtractorStats &other) |
void | AccStatsForUtterance (const IvectorExtractor &extractor, const MatrixBase< BaseFloat > &feats, const Posterior &post) |
double | AccStatsForUtterance (const IvectorExtractor &extractor, const MatrixBase< BaseFloat > &feats, const FullGmm &fgmm) |
void | Read (std::istream &is, bool binary, bool add=false) |
void | Write (std::ostream &os, bool binary) |
void | Write (std::ostream &os, bool binary) const |
double | Update (const IvectorExtractorEstimationOptions &opts, IvectorExtractor *extractor) const |
Returns the objf improvement per frame. More... | |
double | AuxfPerFrame () |
void | IvectorVarianceDiagnostic (const IvectorExtractor &extractor) |
Prints the proportion of the variance explained by the Ivector model versus the Gaussians. More... | |
IvectorExtractorStats (const IvectorExtractorStats &other) | |
Protected Member Functions | |
void | CommitStatsForUtterance (const IvectorExtractor &extractor, const IvectorExtractorUtteranceStats &utt_stats) |
void | CommitStatsForM (const IvectorExtractor &extractor, const IvectorExtractorUtteranceStats &utt_stats, const VectorBase< double > &ivec_mean, const SpMatrix< double > &ivec_var) |
This is called by CommitStatsForUtterance. More... | |
void | FlushCache () |
Flushes the cache for the R_ stats. More... | |
void | CommitStatsForSigma (const IvectorExtractor &extractor, const IvectorExtractorUtteranceStats &utt_stats) |
Commit the stats used to update the variance. More... | |
void | CommitStatsForWPoint (const IvectorExtractor &extractor, const IvectorExtractorUtteranceStats &utt_stats, const VectorBase< double > &ivector, double weight) |
Commit the stats used to update the weight-projection w_– this one takes a point sample, it's called from CommitStatsForW(). More... | |
void | CommitStatsForW (const IvectorExtractor &extractor, const IvectorExtractorUtteranceStats &utt_stats, const VectorBase< double > &ivec_mean, const SpMatrix< double > &ivec_var) |
Commit the stats used to update the weight-projection w_. More... | |
void | CommitStatsForPrior (const VectorBase< double > &ivec_mean, const SpMatrix< double > &ivec_var) |
Commit the stats used to update the prior distribution. More... | |
double | UpdateProjections (const IvectorExtractorEstimationOptions &opts, IvectorExtractor *extractor) const |
double | UpdateProjection (const IvectorExtractorEstimationOptions &opts, int32 gaussian, IvectorExtractor *extractor) const |
double | UpdateWeights (const IvectorExtractorEstimationOptions &opts, IvectorExtractor *extractor) const |
double | UpdateWeight (const IvectorExtractorEstimationOptions &opts, int32 gaussian, IvectorExtractor *extractor) const |
double | UpdateVariances (const IvectorExtractorEstimationOptions &opts, IvectorExtractor *extractor) const |
double | UpdatePrior (const IvectorExtractorEstimationOptions &opts, IvectorExtractor *extractor) const |
double | PriorDiagnostics (double old_prior_offset) const |
void | CheckDims (const IvectorExtractor &extractor) const |
Protected Attributes | |
IvectorExtractorStatsOptions | config_ |
double | tot_auxf_ |
Caution: if we read from disk, this. More... | |
std::mutex | gamma_Y_lock_ |
This mutex guards gamma_ and Y_ (for multi-threaded update) More... | |
Vector< double > | gamma_ |
Total occupation count for each Gaussian index (zeroth-order stats) More... | |
std::vector< Matrix< double > > | Y_ |
Stats Y_i for estimating projections M. More... | |
std::mutex | R_lock_ |
This mutex guards R_ (for multi-threaded update) More... | |
Matrix< double > | R_ |
R_i, quadratic term for ivector subspace (M matrix)estimation. More... | |
std::mutex | R_cache_lock_ |
This mutex guards R_num_cached_, R_gamma_cache_, R_ivec_cache_ (for multi-threaded update) More... | |
int32 | R_num_cached_ |
To avoid too-frequent rank-1 update of R, which is slow, we cache some quantities here. More... | |
Matrix< double > | R_gamma_cache_ |
dimension: [num-to-cache][I] More... | |
Matrix< double > | R_ivec_scatter_cache_ |
dimension: [num-to-cache][S*(S+1)/2] More... | |
std::mutex | weight_stats_lock_ |
This mutex guards Q_ and G_ (for multi-threaded update) More... | |
Matrix< double > | Q_ |
Q_ is like R_ (with same dimensions), except used for weight estimation; the scatter of ivectors is weighted by the coefficient of the quadratic term in the expansion for w (the "safe" one, with the max expression). More... | |
Matrix< double > | G_ |
G_ is the linear term in the weight projection matrix w_. More... | |
std::mutex | variance_stats_lock_ |
This mutex guards S_ (for multi-threaded update) More... | |
std::vector< SpMatrix< double > > | S_ |
S_{i}, raw second-order stats per Gaussian which we will use to update the variances Sigma_inv_. More... | |
std::mutex | prior_stats_lock_ |
This mutex guards num_ivectors_, ivector_sum_ and ivector_scatter_ (for multi-threaded update) More... | |
double | num_ivectors_ |
Count of the number of iVectors we trained on. More... | |
Vector< double > | ivector_sum_ |
Sum of all the iVector means. Needed for prior re-estimation. More... | |
SpMatrix< double > | ivector_scatter_ |
Second-order stats for the iVectors. Needed for prior re-estimation. More... | |
Private Member Functions | |
void | GetOrthogonalIvectorTransform (const SubMatrix< double > &T, IvectorExtractor *extractor, Matrix< double > *A) const |
Computes an orthogonal matrix A from the iVector transform T such that T' = A*T is an alternative transform which diagonalizes the quadratic_term_ in the iVector estimation objective function. More... | |
IvectorExtractorStats & | operator= (const IvectorExtractorStats &other) |
Friends | |
class | IvectorExtractor |
class | IvectorExtractorUpdateProjectionClass |
class | IvectorExtractorUpdateWeightClass |
IvectorExtractorStats is a class used to update the parameters of the ivector extractor.
Definition at line 481 of file ivector-extractor.h.
|
inline |
Definition at line 485 of file ivector-extractor.h.
References kaldi::AccStatsForUtterance().
IvectorExtractorStats | ( | const IvectorExtractor & | extractor, |
const IvectorExtractorStatsOptions & | stats_opts | ||
) |
Definition at line 891 of file ivector-extractor.cc.
References IvectorExtractorStatsOptions::cache_size, IvectorExtractorStats::config_, IvectorExtractor::FeatDim(), IvectorExtractorStats::G_, IvectorExtractorStats::gamma_, rnnlm::i, IvectorExtractorStats::ivector_scatter_, IvectorExtractorStats::ivector_sum_, IvectorExtractor::IvectorDependentWeights(), IvectorExtractor::IvectorDim(), KALDI_ASSERT, IvectorExtractorStats::num_ivectors_, IvectorExtractorStatsOptions::num_samples_for_weights, IvectorExtractor::NumGauss(), IvectorExtractorStats::Q_, IvectorExtractorStats::R_, IvectorExtractorStats::R_gamma_cache_, IvectorExtractorStats::R_ivec_scatter_cache_, IvectorExtractorStats::R_num_cached_, SpMatrix< Real >::Resize(), Vector< Real >::Resize(), Matrix< Real >::Resize(), IvectorExtractorStats::S_, IvectorExtractorStats::tot_auxf_, IvectorExtractorStatsOptions::update_variances, and IvectorExtractorStats::Y_.
|
explicit |
Definition at line 1766 of file ivector-extractor.cc.
void AccStatsForUtterance | ( | const IvectorExtractor & | extractor, |
const MatrixBase< BaseFloat > & | feats, | ||
const Posterior & | post | ||
) |
Definition at line 1132 of file ivector-extractor.cc.
References IvectorExtractorUtteranceStats::AccStats(), IvectorExtractorStats::CheckDims(), IvectorExtractorStats::CommitStatsForUtterance(), IvectorExtractor::FeatDim(), KALDI_ASSERT, KALDI_ERR, MatrixBase< Real >::NumCols(), IvectorExtractor::NumGauss(), MatrixBase< Real >::NumRows(), and IvectorExtractorStats::S_.
Referenced by IvectorExtractorStats::AccStatsForUtterance(), IvectorTask::operator()(), and kaldi::UnitTestIvectorExtractor().
double AccStatsForUtterance | ( | const IvectorExtractor & | extractor, |
const MatrixBase< BaseFloat > & | feats, | ||
const FullGmm & | fgmm | ||
) |
Definition at line 1159 of file ivector-extractor.cc.
References IvectorExtractorStats::AccStatsForUtterance(), FullGmm::ComponentPosteriors(), rnnlm::i, kaldi::kUndefined, FullGmm::NumGauss(), and MatrixBase< Real >::NumRows().
void Add | ( | const IvectorExtractorStats & | other | ) |
Definition at line 1178 of file ivector-extractor.cc.
References MatrixBase< Real >::AddMat(), SpMatrix< Real >::AddSp(), VectorBase< Real >::AddVec(), IvectorExtractorStats::config_, IvectorExtractorStats::G_, IvectorExtractorStats::gamma_, rnnlm::i, IvectorExtractorStats::ivector_scatter_, IvectorExtractorStats::ivector_sum_, KALDI_ASSERT, IvectorExtractorStats::num_ivectors_, IvectorExtractorStatsOptions::num_samples_for_weights, IvectorExtractorStats::Q_, IvectorExtractorStats::R_, IvectorExtractorStats::S_, IvectorExtractorStats::tot_auxf_, and IvectorExtractorStats::Y_.
Referenced by kaldi::TestIvectorExtractorStatsIO().
|
inline |
Definition at line 515 of file ivector-extractor.h.
Referenced by kaldi::UnitTestIvectorExtractor().
|
protected |
Definition at line 1104 of file ivector-extractor.cc.
References IvectorExtractorStats::config_, VectorBase< Real >::Dim(), IvectorExtractor::FeatDim(), IvectorExtractorStats::G_, IvectorExtractorStats::gamma_, rnnlm::i, IvectorExtractorStats::ivector_scatter_, IvectorExtractorStats::ivector_sum_, IvectorExtractor::IvectorDependentWeights(), IvectorExtractor::IvectorDim(), KALDI_ASSERT, IvectorExtractorStats::num_ivectors_, IvectorExtractorStatsOptions::num_samples_for_weights, MatrixBase< Real >::NumCols(), IvectorExtractor::NumGauss(), MatrixBase< Real >::NumRows(), PackedMatrix< Real >::NumRows(), IvectorExtractorStats::Q_, IvectorExtractorStats::R_, IvectorExtractorStats::S_, and IvectorExtractorStats::Y_.
Referenced by IvectorExtractorStats::AccStatsForUtterance(), and IvectorExtractorStats::Update().
|
protected |
This is called by CommitStatsForUtterance.
We commit the stats used to update the M matrix.
Definition at line 926 of file ivector-extractor.cc.
References VectorBase< Real >::AddVec(), SpMatrix< Real >::AddVec2(), PackedMatrix< Real >::Data(), VectorBase< Real >::Dim(), IvectorExtractorStats::FlushCache(), IvectorExtractorUtteranceStats::gamma_, IvectorExtractorStats::gamma_, IvectorExtractorStats::gamma_Y_lock_, rnnlm::i, IvectorExtractor::NumGauss(), MatrixBase< Real >::NumRows(), IvectorExtractorStats::R_cache_lock_, IvectorExtractorStats::R_gamma_cache_, IvectorExtractorStats::R_ivec_scatter_cache_, IvectorExtractorStats::R_num_cached_, MatrixBase< Real >::Row(), IvectorExtractorUtteranceStats::X_, and IvectorExtractorStats::Y_.
Referenced by IvectorExtractorStats::CommitStatsForUtterance().
|
protected |
Commit the stats used to update the prior distribution.
Definition at line 1067 of file ivector-extractor.cc.
References SpMatrix< Real >::AddSp(), VectorBase< Real >::AddVec(), SpMatrix< Real >::AddVec2(), IvectorExtractorStats::ivector_scatter_, IvectorExtractorStats::ivector_sum_, IvectorExtractorStats::num_ivectors_, and IvectorExtractorStats::prior_stats_lock_.
Referenced by IvectorExtractorStats::CommitStatsForUtterance().
|
protected |
Commit the stats used to update the variance.
Definition at line 988 of file ivector-extractor.cc.
References rnnlm::i, IvectorExtractor::NumGauss(), IvectorExtractorUtteranceStats::S_, IvectorExtractorStats::S_, and IvectorExtractorStats::variance_stats_lock_.
Referenced by IvectorExtractorStats::CommitStatsForUtterance().
|
protected |
Definition at line 1080 of file ivector-extractor.cc.
References IvectorExtractorStats::CommitStatsForM(), IvectorExtractorStats::CommitStatsForPrior(), IvectorExtractorStats::CommitStatsForSigma(), IvectorExtractorStats::CommitStatsForW(), IvectorExtractorStatsOptions::compute_auxf, IvectorExtractorStats::config_, IvectorExtractor::GetAuxf(), IvectorExtractor::GetIvectorDistribution(), IvectorExtractor::IvectorDependentWeights(), IvectorExtractor::IvectorDim(), IvectorExtractorStats::S_, and IvectorExtractorStats::tot_auxf_.
Referenced by IvectorExtractorStats::AccStatsForUtterance().
|
protected |
Commit the stats used to update the weight-projection w_.
Definition at line 1038 of file ivector-extractor.cc.
References MatrixBase< Real >::AddMatTp(), VectorBase< Real >::AddRowSumMat(), TpMatrix< Real >::Cholesky(), IvectorExtractorStats::CommitStatsForWPoint(), IvectorExtractorStats::config_, IvectorExtractor::IvectorDim(), KALDI_ASSERT, kaldi::kNoTrans, kaldi::kTrans, IvectorExtractorStatsOptions::num_samples_for_weights, and MatrixBase< Real >::SetRandn().
Referenced by IvectorExtractorStats::CommitStatsForUtterance().
|
protected |
Commit the stats used to update the weight-projection w_– this one takes a point sample, it's called from CommitStatsForW().
Definition at line 1003 of file ivector-extractor.cc.
References VectorBase< Real >::AddMatVec(), SpMatrix< Real >::AddVec2(), MatrixBase< Real >::AddVecVec(), VectorBase< Real >::ApplySoftMax(), PackedMatrix< Real >::Data(), IvectorExtractorStats::G_, IvectorExtractorUtteranceStats::gamma_, rnnlm::i, IvectorExtractor::IvectorDim(), kaldi::kNoTrans, IvectorExtractor::NumGauss(), IvectorExtractorStats::Q_, VectorBase< Real >::Sum(), IvectorExtractor::w_, and IvectorExtractorStats::weight_stats_lock_.
Referenced by IvectorExtractorStats::CommitStatsForW().
|
protected |
Flushes the cache for the R_ stats.
Definition at line 963 of file ivector-extractor.cc.
References MatrixBase< Real >::AddMatMat(), KALDI_VLOG, kaldi::kNoTrans, kaldi::kTrans, MatrixBase< Real >::NumCols(), IvectorExtractorStats::R_, IvectorExtractorStats::R_cache_lock_, IvectorExtractorStats::R_gamma_cache_, IvectorExtractorStats::R_ivec_scatter_cache_, IvectorExtractorStats::R_lock_, IvectorExtractorStats::R_num_cached_, and MatrixBase< Real >::Range().
Referenced by IvectorExtractorStats::CommitStatsForM(), and IvectorExtractorStats::Write().
|
private |
Computes an orthogonal matrix A from the iVector transform T such that T' = A*T is an alternative transform which diagonalizes the quadratic_term_ in the iVector estimation objective function.
This reorders the dimensions of the iVector from most to least important, which may be more convenient to view. The transform should not affect the performance of systems which use iVectors.
Definition at line 1353 of file ivector-extractor.cc.
References MatrixBase< Real >::AddMat(), VectorBase< Real >::AddMatVec(), IvectorExtractor::ComputeDerivedVars(), rnnlm::i, MatrixBase< Real >::Invert(), IvectorExtractor::IvectorDependentWeights(), IvectorExtractor::IvectorDim(), KALDI_LOG, kaldi::kNoTrans, kaldi::kTrans, MatrixBase< Real >::NumCols(), IvectorExtractor::NumGauss(), MatrixBase< Real >::NumRows(), Matrix< Real >::Resize(), MatrixBase< Real >::SetZero(), kaldi::SortSvd(), IvectorExtractor::U_, and IvectorExtractor::w_vec_.
Referenced by IvectorExtractorStats::UpdatePrior().
void IvectorVarianceDiagnostic | ( | const IvectorExtractor & | extractor | ) |
Prints the proportion of the variance explained by the Ivector model versus the Gaussians.
Definition at line 1297 of file ivector-extractor.cc.
References IvectorExtractor::FeatDim(), IvectorExtractorStats::gamma_, rnnlm::i, IvectorExtractor::InvertWithFlooring(), KALDI_LOG, kaldi::kNoTrans, IvectorExtractor::M_, IvectorExtractor::NumGauss(), PackedMatrix< Real >::Scale(), IvectorExtractor::Sigma_inv_, and VectorBase< Real >::Sum().
Referenced by main().
|
private |
|
protected |
Definition at line 1613 of file ivector-extractor.cc.
References SpMatrix< Real >::AddVec2(), VectorBase< Real >::Dim(), IvectorExtractorStats::gamma_, IvectorExtractorStats::ivector_scatter_, IvectorExtractorStats::ivector_sum_, KALDI_LOG, SpMatrix< Real >::LogPosDefDet(), IvectorExtractorStats::num_ivectors_, PackedMatrix< Real >::Scale(), VectorBase< Real >::Scale(), VectorBase< Real >::Sum(), and SpMatrix< Real >::Trace().
Referenced by IvectorExtractorStats::UpdatePrior().
Definition at line 1240 of file ivector-extractor.cc.
References kaldi::ExpectToken(), IvectorExtractorStats::G_, IvectorExtractorStats::gamma_, rnnlm::i, IvectorExtractorStats::ivector_scatter_, IvectorExtractorStats::ivector_sum_, IvectorExtractorStats::num_ivectors_, IvectorExtractorStats::Q_, IvectorExtractorStats::R_, PackedMatrix< Real >::Read(), Vector< Real >::Read(), Matrix< Real >::Read(), kaldi::ReadBasicType(), IvectorExtractorStats::S_, IvectorExtractorStats::tot_auxf_, and IvectorExtractorStats::Y_.
Referenced by main(), and kaldi::TestIvectorExtractorStatsIO().
double Update | ( | const IvectorExtractorEstimationOptions & | opts, |
IvectorExtractor * | extractor | ||
) | const |
Returns the objf improvement per frame.
Definition at line 1272 of file ivector-extractor.cc.
References IvectorExtractorStats::CheckDims(), IvectorExtractor::ComputeDerivedVars(), IvectorExtractorStats::gamma_, IvectorExtractor::IvectorDependentWeights(), KALDI_LOG, IvectorExtractorStats::S_, VectorBase< Real >::Sum(), IvectorExtractorStats::tot_auxf_, IvectorExtractorStats::UpdatePrior(), IvectorExtractorStats::UpdateProjections(), IvectorExtractorStats::UpdateVariances(), and IvectorExtractorStats::UpdateWeights().
Referenced by main(), and kaldi::UnitTestIvectorExtractor().
|
protected |
Definition at line 1651 of file ivector-extractor.cc.
References SpMatrix< Real >::AddMat2Sp(), MatrixBase< Real >::AddMatMat(), SpMatrix< Real >::AddVec2(), MatrixBase< Real >::AddVecVec(), VectorBase< Real >::ApplyFloor(), VectorBase< Real >::ApplyPow(), kaldi::ApproxEqual(), IvectorExtractorEstimationOptions::diagonalize, SpMatrix< Real >::Eig(), IvectorExtractorStats::GetOrthogonalIvectorTransform(), SpMatrix< Real >::IsUnit(), IvectorExtractorStats::ivector_scatter_, IvectorExtractorStats::ivector_sum_, IvectorExtractor::IvectorDim(), KALDI_ASSERT, KALDI_LOG, KALDI_WARN, kaldi::kNoTrans, kaldi::kTrans, M_SQRT2, VectorBase< Real >::Max(), VectorBase< Real >::Min(), MatrixBase< Real >::MulRowsVec(), VectorBase< Real >::Norm(), IvectorExtractorStats::num_ivectors_, MatrixBase< Real >::NumCols(), MatrixBase< Real >::NumRows(), IvectorExtractor::prior_offset_, IvectorExtractorStats::PriorDiagnostics(), PackedMatrix< Real >::Scale(), VectorBase< Real >::Scale(), MatrixBase< Real >::SetUnit(), and IvectorExtractor::TransformIvectors().
Referenced by IvectorExtractorStats::Update().
|
protected |
Definition at line 1319 of file ivector-extractor.cc.
References VectorBase< Real >::CopyFromVec(), SolverOptions::diagonal_precondition, IvectorExtractorStats::gamma_, IvectorExtractorEstimationOptions::gaussian_min_count, rnnlm::i, IvectorExtractor::IvectorDim(), KALDI_ASSERT, KALDI_VLOG, KALDI_WARN, kaldi::kUndefined, IvectorExtractor::M_, SolverOptions::name, IvectorExtractor::NumGauss(), IvectorExtractorStats::R_, IvectorExtractor::Sigma_inv_, kaldi::SolveQuadraticMatrixProblem(), and IvectorExtractorStats::Y_.
|
protected |
Definition at line 1416 of file ivector-extractor.cc.
References count, kaldi::g_num_threads, IvectorExtractorStats::gamma_, rnnlm::i, KALDI_LOG, TaskSequencerConfig::num_threads, IvectorExtractor::NumGauss(), TaskSequencer< C >::Run(), and VectorBase< Real >::Sum().
Referenced by IvectorExtractorStats::Update().
|
protected |
Definition at line 1437 of file ivector-extractor.cc.
References MatrixBase< Real >::AddMat(), SpMatrix< Real >::AddMat2Sp(), MatrixBase< Real >::AddMatMat(), SpMatrix< Real >::AddSp(), SpMatrix< Real >::ApplyFloor(), VectorBase< Real >::CopyFromVec(), PackedMatrix< Real >::Data(), IvectorExtractor::FeatDim(), IvectorExtractorStats::gamma_, IvectorExtractorEstimationOptions::gaussian_min_count, rnnlm::i, SpMatrix< Real >::Invert(), IvectorExtractor::IvectorDim(), KALDI_ASSERT, KALDI_LOG, KALDI_VLOG, KALDI_WARN, kaldi::kNoTrans, kaldi::kTakeMeanAndCheck, kaldi::kTrans, SpMatrix< Real >::LogPosDefDet(), IvectorExtractor::M_, SpMatrix< Real >::MaxAbsEig(), IvectorExtractor::NumGauss(), PackedMatrix< Real >::NumRows(), IvectorExtractorStats::R_, MatrixBase< Real >::Row(), IvectorExtractorStats::S_, PackedMatrix< Real >::Scale(), IvectorExtractor::Sigma_inv_, VectorBase< Real >::Sum(), kaldi::TraceSpSp(), IvectorExtractorEstimationOptions::variance_floor_factor, and IvectorExtractorStats::Y_.
Referenced by IvectorExtractorStats::Update().
|
protected |
Definition at line 1540 of file ivector-extractor.cc.
References VectorBase< Real >::CopyFromVec(), PackedMatrix< Real >::Data(), SolverOptions::diagonal_precondition, IvectorExtractorStats::G_, IvectorExtractorStats::gamma_, IvectorExtractor::IvectorDim(), KALDI_ASSERT, KALDI_VLOG, SolverOptions::name, IvectorExtractor::NumGauss(), IvectorExtractorStats::Q_, MatrixBase< Real >::Row(), kaldi::SolveQuadraticProblem(), and IvectorExtractor::w_.
|
protected |
Definition at line 1589 of file ivector-extractor.cc.
References kaldi::g_num_threads, IvectorExtractorStats::gamma_, rnnlm::i, KALDI_LOG, TaskSequencerConfig::num_threads, IvectorExtractor::NumGauss(), TaskSequencer< C >::Run(), and VectorBase< Real >::Sum().
Referenced by IvectorExtractorStats::Update().
void Write | ( | std::ostream & | os, |
bool | binary | ||
) |
Definition at line 1199 of file ivector-extractor.cc.
References IvectorExtractorStats::FlushCache().
Referenced by main(), kaldi::TestIvectorExtractorStatsIO(), and IvectorExtractorStats::Write().
void Write | ( | std::ostream & | os, |
bool | binary | ||
) | const |
Definition at line 1205 of file ivector-extractor.cc.
References IvectorExtractorStats::G_, IvectorExtractorStats::gamma_, rnnlm::i, IvectorExtractorStats::ivector_scatter_, IvectorExtractorStats::ivector_sum_, KALDI_ASSERT, IvectorExtractorStats::num_ivectors_, IvectorExtractorStats::Q_, IvectorExtractorStats::R_, IvectorExtractorStats::R_num_cached_, IvectorExtractorStats::S_, IvectorExtractorStats::tot_auxf_, PackedMatrix< Real >::Write(), VectorBase< Real >::Write(), IvectorExtractorStats::Write(), MatrixBase< Real >::Write(), kaldi::WriteBasicType(), kaldi::WriteToken(), and IvectorExtractorStats::Y_.
|
friend |
Definition at line 483 of file ivector-extractor.h.
|
friend |
Definition at line 525 of file ivector-extractor.h.
|
friend |
Definition at line 526 of file ivector-extractor.h.
|
protected |
Definition at line 603 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::Add(), IvectorExtractorStats::CheckDims(), IvectorExtractorStats::CommitStatsForUtterance(), IvectorExtractorStats::CommitStatsForW(), and IvectorExtractorStats::IvectorExtractorStats().
|
protected |
G_ is the linear term in the weight projection matrix w_.
It has the same dim as w_, i.e. [I][S]
Definition at line 654 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::Add(), IvectorExtractorStats::CheckDims(), IvectorExtractorStats::CommitStatsForWPoint(), IvectorExtractorStats::IvectorExtractorStats(), IvectorExtractorStats::Read(), IvectorExtractorStats::UpdateWeight(), and IvectorExtractorStats::Write().
|
protected |
Total occupation count for each Gaussian index (zeroth-order stats)
Definition at line 616 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::Add(), IvectorExtractorStats::CheckDims(), IvectorExtractorStats::CommitStatsForM(), IvectorExtractorStats::IvectorExtractorStats(), IvectorExtractorStats::IvectorVarianceDiagnostic(), IvectorExtractorStats::PriorDiagnostics(), IvectorExtractorStats::Read(), IvectorExtractorStats::Update(), IvectorExtractorStats::UpdateProjection(), IvectorExtractorStats::UpdateProjections(), IvectorExtractorStats::UpdateVariances(), IvectorExtractorStats::UpdateWeight(), IvectorExtractorStats::UpdateWeights(), and IvectorExtractorStats::Write().
|
protected |
This mutex guards gamma_ and Y_ (for multi-threaded update)
Definition at line 613 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::CommitStatsForM().
|
protected |
Second-order stats for the iVectors. Needed for prior re-estimation.
Definition at line 676 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::Add(), IvectorExtractorStats::CheckDims(), IvectorExtractorStats::CommitStatsForPrior(), IvectorExtractorStats::IvectorExtractorStats(), IvectorExtractorStats::PriorDiagnostics(), IvectorExtractorStats::Read(), IvectorExtractorStats::UpdatePrior(), and IvectorExtractorStats::Write().
|
protected |
Sum of all the iVector means. Needed for prior re-estimation.
Definition at line 673 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::Add(), IvectorExtractorStats::CheckDims(), IvectorExtractorStats::CommitStatsForPrior(), IvectorExtractorStats::IvectorExtractorStats(), IvectorExtractorStats::PriorDiagnostics(), IvectorExtractorStats::Read(), IvectorExtractorStats::UpdatePrior(), and IvectorExtractorStats::Write().
|
protected |
Count of the number of iVectors we trained on.
Need for prior re-estimation. (make it double not int64 to more easily support weighting later.)
Definition at line 670 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::Add(), IvectorExtractorStats::CheckDims(), IvectorExtractorStats::CommitStatsForPrior(), IvectorExtractorStats::IvectorExtractorStats(), IvectorExtractorStats::PriorDiagnostics(), IvectorExtractorStats::Read(), IvectorExtractorStats::UpdatePrior(), and IvectorExtractorStats::Write().
|
protected |
This mutex guards num_ivectors_, ivector_sum_ and ivector_scatter_ (for multi-threaded update)
Definition at line 666 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::CommitStatsForPrior().
|
protected |
Q_ is like R_ (with same dimensions), except used for weight estimation; the scatter of ivectors is weighted by the coefficient of the quadratic term in the expansion for w (the "safe" one, with the max expression).
Definition at line 650 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::Add(), IvectorExtractorStats::CheckDims(), IvectorExtractorStats::CommitStatsForWPoint(), IvectorExtractorStats::IvectorExtractorStats(), IvectorExtractorStats::Read(), IvectorExtractorStats::UpdateWeight(), and IvectorExtractorStats::Write().
|
protected |
R_i, quadratic term for ivector subspace (M matrix)estimation.
This is a kind of scatter of ivectors of training speakers, weighted by count for each Gaussian. Conceptually vector<SpMatrix<double> >, but we store each SpMatrix as a row of R_. Conceptually, the dim is [I][S][S]; the actual dim is [I][S*(S+1)/2].
Definition at line 630 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::Add(), IvectorExtractorStats::CheckDims(), IvectorExtractorStats::FlushCache(), IvectorExtractorStats::IvectorExtractorStats(), IvectorExtractorStats::Read(), IvectorExtractorStats::UpdateProjection(), IvectorExtractorStats::UpdateVariances(), and IvectorExtractorStats::Write().
|
protected |
This mutex guards R_num_cached_, R_gamma_cache_, R_ivec_cache_ (for multi-threaded update)
Definition at line 634 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::CommitStatsForM(), and IvectorExtractorStats::FlushCache().
|
protected |
dimension: [num-to-cache][I]
Definition at line 640 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::CommitStatsForM(), IvectorExtractorStats::FlushCache(), and IvectorExtractorStats::IvectorExtractorStats().
|
protected |
dimension: [num-to-cache][S*(S+1)/2]
Definition at line 642 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::CommitStatsForM(), IvectorExtractorStats::FlushCache(), and IvectorExtractorStats::IvectorExtractorStats().
|
protected |
This mutex guards R_ (for multi-threaded update)
Definition at line 623 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::FlushCache().
|
protected |
To avoid too-frequent rank-1 update of R, which is slow, we cache some quantities here.
Definition at line 638 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::CommitStatsForM(), IvectorExtractorStats::FlushCache(), IvectorExtractorStats::IvectorExtractorStats(), and IvectorExtractorStats::Write().
|
protected |
S_{i}, raw second-order stats per Gaussian which we will use to update the variances Sigma_inv_.
Definition at line 661 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::AccStatsForUtterance(), IvectorExtractorStats::Add(), IvectorExtractorStats::CheckDims(), IvectorExtractorStats::CommitStatsForSigma(), IvectorExtractorStats::CommitStatsForUtterance(), IvectorExtractorStats::IvectorExtractorStats(), IvectorExtractorStats::Read(), IvectorExtractorStats::Update(), IvectorExtractorStats::UpdateVariances(), and IvectorExtractorStats::Write().
|
protected |
Caution: if we read from disk, this.
is not recovered. Options will not be used during the update phase anyway, so this should not matter. Total auxiliary function over the training data– can be used to check convergence, etc.
Definition at line 610 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::Add(), IvectorExtractorStats::CommitStatsForUtterance(), IvectorExtractorStats::IvectorExtractorStats(), IvectorExtractorStats::Read(), IvectorExtractorStats::Update(), and IvectorExtractorStats::Write().
|
protected |
This mutex guards S_ (for multi-threaded update)
Definition at line 657 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::CommitStatsForSigma().
|
protected |
This mutex guards Q_ and G_ (for multi-threaded update)
Definition at line 645 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::CommitStatsForWPoint().
|
protected |
Stats Y_i for estimating projections M.
Dimension is [I][D][S]. The linear term in M.
Definition at line 620 of file ivector-extractor.h.
Referenced by IvectorExtractorStats::Add(), IvectorExtractorStats::CheckDims(), IvectorExtractorStats::CommitStatsForM(), IvectorExtractorStats::IvectorExtractorStats(), IvectorExtractorStats::Read(), IvectorExtractorStats::UpdateProjection(), IvectorExtractorStats::UpdateVariances(), and IvectorExtractorStats::Write().