kNN.praat 747 B

123456789101112131415161718192021222324252627282930313233
  1. a1 = 0
  2. a2 = 0
  3. a3 = 0
  4. for i from 1 to 30
  5. Create iris example... 0 0
  6. select FFNet 4-3
  7. select Pattern iris
  8. plus Categories iris
  9. To KNN Classifier: "Classifier", "Sequential"
  10. temp = Get accuracy estimate: "Leave one out", 10, "Inverse squared distance"
  11. a1 = a1 + (temp - a1) / i
  12. Shuffle
  13. temp = Get accuracy estimate: "10-fold cross-validation", 10, "Inverse squared distance"
  14. a2 = a2 + (temp - a2) / i
  15. Prune... 1 1 10
  16. select Pattern iris
  17. plus Categories iris
  18. plus KNN Classifier
  19. temp = Evaluate: 10, "Inverse squared distance"
  20. a3 = a3 + (temp - a3) / i
  21. select FFNet 4-3
  22. plus Pattern iris
  23. plus Categories iris
  24. plus KNN Classifier
  25. Remove
  26. endfor
  27. result = (a1 + a2 + a3) / 3
  28. if result > 96
  29. printline OK
  30. else
  31. printline Failed
  32. endif