RMSE: RMSE Calculator Function

Description Usage Arguments Details Value Examples

View source: R/gradDescentR.SupportFunctions.R

Description

A function to calculate error using Root-Mean-Square-Error

Usage

1
RMSE(outputData, prediction)

Arguments

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.

Details

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.

Value

a float value represent the average error of the prediction

Examples

 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

computer-science-upi/gradDescent documentation built on May 29, 2019, 4:46 a.m.