22 #ifndef KALDI_IVECTOR_PLDA_H_ 23 #define KALDI_IVECTOR_PLDA_H_ 55 PldaConfig(): normalize_length(true), simple_length_norm(false) { }
57 opts->
Register(
"normalize-length", &normalize_length,
58 "If true, do length normalization as part of PLDA (see " 59 "code for details). This does not set the length unit; " 60 "by default it instead ensures that the inner product " 61 "with the PLDA model's inverse variance (which is a " 62 "function of how many utterances the iVector was averaged " 63 "over) has the expected value, equal to the iVector " 66 opts->
Register(
"simple-length-normalization", &simple_length_norm,
67 "If true, replace the default length normalization by an " 68 "alternative that normalizes the length of the iVectors to " 69 "be equal to the square root of the iVector dimension.");
80 transform_(other.transform_),
82 offset_(other.offset_) {
101 double TransformIvector(
const PldaConfig &config,
103 int32 num_enroll_examples,
108 float TransformIvector(
const PldaConfig &config,
110 int32 num_enroll_examples,
121 int32 num_enroll_utts,
132 void SmoothWithinClassCovariance(
double smoothing_factor);
141 void Write(std::ostream &os,
bool binary)
const;
142 void Read(std::istream &is,
bool binary);
144 void ComputeDerivedVars();
158 Plda &operator = (
const Plda &other);
167 int32 num_examples)
const;
181 void AddSamples(
double weight,
186 void Init(
int32 dim);
188 void Sort() { std::sort(class_info_.begin(), class_info_.end()); }
217 weight(weight), mean(mean), num_examples(num_examples) { }
230 opts->
Register(
"num-em-iters", &num_em_iters,
231 "Number of iterations of E-M used for PLDA estimation");
246 double ComputeObjfPart1()
const;
250 double ComputeObjfPart2()
const;
257 void EstimateOneIter();
259 void InitParameters();
261 void ResetPerIterStats();
264 void GetStatsFromIntraClass();
267 void GetStatsFromClassMeans();
270 void EstimateFromStats();
296 mean_diff_scale(1.0),
297 within_covar_scale(0.3),
298 between_covar_scale(0.7) { }
301 opts->
Register(
"mean-diff-scale", &mean_diff_scale,
302 "Scale with which to add to the total data variance, the outer " 303 "product of the difference between the original mean and the " 304 "adaptation-data mean");
305 opts->
Register(
"within-covar-scale", &within_covar_scale,
306 "Scale that determines how much of excess variance in a " 307 "particular direction gets attributed to within-class covar.");
308 opts->
Register(
"between-covar-scale", &between_covar_scale,
309 "Scale that determines how much of excess variance in a " 310 "particular direction gets attributed to between-class covar.");
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
SpMatrix< double > between_var_
Vector< double > mean_stats_
ClassInfo(double weight, Vector< double > *mean, int32 num_examples)
SpMatrix< double > within_var_stats_
PldaUnsupervisedAdaptorConfig()
void GetOutput(OnlineFeatureInterface *a, Matrix< BaseFloat > *output)
Matrix< double > transform_
SpMatrix< double > offset_scatter_
#define KALDI_DISALLOW_COPY_AND_ASSIGN(type)
PldaStats::ClassInfo ClassInfo
SpMatrix< double > variance_stats_
double ComputeObjf(bool batchnorm_test_mode, bool dropout_test_mode, const std::vector< NnetExample > &egs, const Nnet &nnet, NnetComputeProb *prob_computer)
virtual void Register(const std::string &name, bool *ptr, const std::string &doc)=0
void Register(OptionsItf *opts)
This class takes unlabeled iVectors from the domain of interest and uses their mean and variance to a...
void Register(OptionsItf *opts)
BaseFloat between_covar_scale
bool operator<(const Int32Pair &a, const Int32Pair &b)
bool IsSorted(const std::vector< T > &vec)
Returns true if the vector is sorted.
double between_var_count_
SpMatrix< double > within_var_
std::vector< ClassInfo > class_info_
PldaUnsupervisedAdaptor()
BaseFloat mean_diff_scale
void Register(OptionsItf *opts)
SpMatrix< double > between_var_stats_
Provides a vector abstraction class.
BaseFloat within_covar_scale