Description Usage Arguments Details Value Examples
A function to calculate error using Root-Mean-Square-Error
1 | RMSE(outputData, prediction)
|
outputData |
a data.frame represented dataset with output variable only (m \times 1), where m is the number of instances has one variable, which is the output. |
prediction |
a data.frame represented prediction data with output variable only (m \times 1), where m is the number of instances has one variable, which is the output. |
This function used to calculate the error between two variables.
outputData
is the first parameter of this function representing
the real output value. prediction
is the second parameter of
this function representing the prediction value.
a float value represent the average error of the prediction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ##################################
## Calculate Error using RMSE
## load R Package data
data(gradDescentRData)
## get z-factor Data
dataSet <- gradDescentRData$CompressilbilityFactor
## do variance scaling to dataset
featureScalingResult <- varianceScaling(dataSet)
## split dataset
splitedDataSet <- splitData(featureScalingResult$scaledDataSet)
## built model using GD
model <- GD(splitedDataSet$dataTrain)
## separate testing data with input only
dataTestInput <- (splitedDataSet$dataTest)[,1:ncol(splitedDataSet$dataTest)-1]
## predict testing data using GD model
predictionData <- prediction(model, dataTestInput)
## calculate error using rmse
errorValue <- RMSE(splitedDataSet$dataTest[,ncol(splitedDataSet$dataTest)],
predictionData[,ncol(predictionData)])
## show result
errorValue
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.