Module: TestResultsParser::Parser
- Defined in:
- lib/db_mlp/test_results_parser.rb
Instance Method Summary collapse
-
#parse_test_results(filepath, error_limit = 0.05) ⇒ Object
This goes through the test results file created by calling #create_test_report.
Instance Method Details
#parse_test_results(filepath, error_limit = 0.05) ⇒ Object
This goes through the test results file created by calling #create_test_report. It then tells you how accurate the classification has been on the testing data.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/db_mlp/test_results_parser.rb', line 11 def parse_test_results(filepath, error_limit=0.05) total, correct = 0.0, 0.0 File.open(filepath) do |f| while line = f.gets do next if line.match(/ID/) error = line.match(/\t(\d+\..+)$/)[1] total += 1 if error.to_f < error_limit correct += 1 end end #while end #File.open correct / total * 100 end |