public void UpdateTopScores(IData feature) { if (feature is DoubleData) { Console.WriteLine("DoubleData conversion required on mixture level!"); } var firstSampleNumber = FloatData.ToFloatData(feature).FirstSampleNumber; if (_toStoreScore) { _curScores = GetStoredScores(firstSampleNumber); } else { if (_curScores != null && _curScores.FrameStartSample != firstSampleNumber) { _curScores = null; } } if (_curScores != null) { //component scores for this frame was already calculated return; } var featureVector = FloatData.ToFloatData(feature).Values; UpdateTopScores(featureVector); //store just calculated score in list _curScores = CreateFromTopGau(firstSampleNumber); if (_toStoreScore) { StoreScores(_curScores); } }
private void StoreScores(MixtureComponentSetScores scores) { _storedScores.Add(scores); while (_storedScores.Count > _scoresQueueLen) { _storedScores.Poll(); } }
private MixtureComponentSetScores CreateFromTopGau(long firstFrameSample) { var scores = new MixtureComponentSetScores(_numStreams, TopGauNum, firstFrameSample); for (var i = 0; i < _numStreams; i++) { for (var j = 0; j < TopGauNum; j++) { scores.SetScore(i, j, _topComponents[i][j].StoredScore); scores.SetGauId(i, j, _topComponents[i][j].Id); } } return(scores); }
public MixtureComponentSet(List <PrunableMixtureComponent[]> components, int topGauNum) { _components = components; _numStreams = components.Count; TopGauNum = topGauNum; GauNum = components[0].Length; _topComponents = new List <PrunableMixtureComponent[]>(); for (var i = 0; i < _numStreams; i++) { var featTopComponents = new PrunableMixtureComponent[topGauNum]; for (var j = 0; j < topGauNum; j++) { featTopComponents[j] = components[i][j]; } _topComponents.Add(featTopComponents); } _gauCalcSampleNumber = -1; _toStoreScore = false; _storedScores = new LinkedList <MixtureComponentSetScores>(); _curScores = null; }