README.md in eps-0.2.0 vs README.md in eps-0.2.1
- old
+ new
@@ -231,19 +231,20 @@
test_features = test_set.map { |v| features(v) }
test_target = test_set.map { |v| target(v) }
metrics = model.evaluate(test_features, test_target)
puts "Test RMSE: #{metrics[:rmse]}"
# for classification, use:
- # puts "Test accuracy: #{metrics[:accuracy]}"
+ # puts "Test accuracy: #{(100 * metrics[:accuracy]).round}%"
# finalize
houses = preprocess(houses)
all_features = houses.map { |h| features(h) }
all_target = houses.map { |h| target(h) }
- @model = Eps::Model.new(all_features, all_target)
+ model = Eps::Model.new(all_features, all_target)
# save
- File.write(model_file, @model.to_pmml)
+ File.write(model_file, model.to_pmml)
+ @model = nil # reset for future predictions
end
def predict(house)
model.predict(features(house))
end