summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgebele <gebele@in-silico.ch>2015-10-15 08:08:32 +0000
committergebele <gebele@in-silico.ch>2015-10-15 08:08:32 +0000
commit4d011490e82b3e4d1c16639a176479904055c82d (patch)
tree76a6009d0f522c9274f435c3cfc507f5efc8b337
parentbccf3e4d6cd1fa0d3d0e346923da8b943916b6ff (diff)
fixed round issue for nil
-rw-r--r--views/predict.haml24
-rw-r--r--views/prediction.haml2
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