FitSigmoid.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * @file FitSigmoid.h
  3. * @brief fit a sigmoid function accordings to the paper of platt
  4. * @author Erik Rodner
  5. * @date 03/05/2009
  6. */
  7. #ifndef FITSIGMOIDINCLUDE
  8. #define FITSIGMOIDINCLUDE
  9. #include <vector>
  10. namespace OBJREC {
  11. /** fit a sigmoid function accordings to the paper of platt */
  12. class FitSigmoid
  13. {
  14. public:
  15. /** fit a sigmoid function f(t) = out = 1/(1+exp(A*t+B))
  16. @param t input values
  17. @param out output values
  18. @param startp initial value of f(t)
  19. @param A initial value of A
  20. @param B initial value of B
  21. */
  22. static void fitSigmoid ( const std::vector<double> & t,
  23. const std::vector<double> & out,
  24. double startp,
  25. double & A, double & B );
  26. /** fit a sigmoid function using fitSigmoid to results of a binary
  27. classifier (e.g. svm), 1/(1+exp(A*t+B))
  28. @param results classifier results
  29. @param A final parameter A
  30. @param B final parameter B
  31. @param mlestimation perform ML-estimation or MAP-estimation (cf. Platt)
  32. */
  33. static void fitProbabilities ( const std::vector<std::pair<int, double> > & results,
  34. double & A, double & B, double mlestimation = false );
  35. };
  36. } // namespace
  37. #endif