From 4d011490e82b3e4d1c16639a176479904055c82d Mon Sep 17 00:00:00 2001 From: gebele Date: Thu, 15 Oct 2015 08:08:32 +0000 Subject: fixed round issue for nil --- views/predict.haml | 24 ++++++++++++------------ views/prediction.haml | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/views/predict.haml b/views/predict.haml index 91cf1e6..0e6b3cc 100644 --- a/views/predict.haml +++ b/views/predict.haml @@ -172,22 +172,22 @@ - if model.classification? %br = "Accuracy:\t" - = cv.accuracy.round(3) + = cv.accuracy.round(3) if cv.accuracy %br = "Weighted Accuracy:\t" - = cv.weighted_accuracy.round(3) + = cv.weighted_accuracy.round(3) if cv.weighted_accuracy %br = "True positive rate:\t" - = cv.true_rate["active"].round(3) + = cv.true_rate["active"].round(3) if cv.true_rate["active"] %br = "True negative rate:\t" - = cv.true_rate["inactive"].round(3) + = cv.true_rate["inactive"].round(3) if cv.true_rate["inactive"] %br = "Positive predictive value:\t" - = cv.predictivity["active"].round(3) + = cv.predictivity["active"].round(3) if cv.predictivity["active"] %br = "Negative predictive value:\t" - = cv.predictivity["inactive"].round(3) + = cv.predictivity["inactive"].round(3) if cv.predictivity["inactive"] %p %b Confusion Matrix: %table.table.table-condensed.table-borderless{:style=>"width:20%;"} @@ -234,22 +234,22 @@ %td -#= "Confusion Matrix:\t" -#= cv.confusion_matrix - - if model.regression? + - if model.regression? %br = "Root mean squared error:\t" - = cv.rmse.round(3) + = cv.rmse.round(3) if cv.rmse %br = "Weighted root mean squared error:\t" - = cv.weighted_rmse.round(3) + = cv.weighted_rmse.round(3) if cv.weighted_rmse %br = "Mean absolute error:\t" - = cv.mae.round(3) + = cv.mae.round(3) if cv.mae %br = "Weighted mean absolute error:\t" - = cv.weighted_mae.round(3) + = cv.weighted_mae.round(3) if cv.weighted_mae %br = "R square:\t" - = cv.r_squared.round(3) + = cv.r_squared.round(3) if cv.r_squared /%br /= "Correlation plot" /= cv.correlation_plot diff --git a/views/prediction.haml b/views/prediction.haml index a03b509..e7bc88a 100644 --- a/views/prediction.haml +++ b/views/prediction.haml @@ -30,7 +30,7 @@ %p / TODO fix scientific notation from database %b Measured activity: - = prediction[:value].numeric? ? "#{prediction[:value].round(3)} (#{@models[i].unit})" : prediction[:value] + = prediction[:value].numeric? ? "#{prediction[:value].to_f.round(3)} (#{@models[i].unit})" : prediction[:value] %p Compound is part of the training dataset - elsif prediction[:neighbors].size > 0 %p -- cgit v1.2.3