您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

38 行
885B

  1. package classifier
  2. func CombinedClassify(feat Features, mf MathFeatures, centerHz float64, snrDb float64) Classification {
  3. ruleCls := RuleClassify(feat, centerHz, snrDb)
  4. mathCls := MathClassify(mf, feat.BW3dB, centerHz, snrDb)
  5. combined := map[SignalClass]float64{}
  6. for k, v := range ruleCls.Scores {
  7. combined[k] += v * 0.4
  8. }
  9. for k, v := range mathCls.Scores {
  10. combined[k] += v * 0.6
  11. }
  12. best, _, second, _ := top2(combined)
  13. if best == "" {
  14. best = ClassUnknown
  15. }
  16. if second == "" {
  17. second = ClassUnknown
  18. }
  19. conf := softmaxConfidence(combined, best)
  20. if snrDb < 20 {
  21. snrFactor := clamp01((snrDb - 3) / 17.0)
  22. conf *= 0.3 + 0.7*snrFactor
  23. }
  24. if conf <= 0 {
  25. conf = 0.1
  26. }
  27. return Classification{
  28. ModType: best,
  29. Confidence: conf,
  30. BW3dB: feat.BW3dB,
  31. Features: feat,
  32. MathFeatures: &mf,
  33. SecondBest: second,
  34. Scores: combined,
  35. }
  36. }