stevenlee / WLEPredictionModel

Weight Lifting Exercise Prediction Model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Weight Lifting Exercise Prediction Assignment

In this assignment, I create two R scripts help me to run model with different parameters, and save the results to different directories for me to pickup the model with better accuracy

files in this repo

  1. index.Rmd: R markdown shows codes training model to predict the 20 testing cases
  2. compiled html from R markdwon
  3. WLEWriteUp.R script used to to build the model for this assignment
  4. cleanData function(data) return cleanData
    1. keep measurement value and classe only
    2. romove column with missing values
    3. uses nearZeroVar to remove nzv, zeroVar columns
  5. probeData function(cleanData, prob) return pData
    1. creates train/test data set by Data Partition with p = 0.7
  6. runRFModel function(data = pData, modDir = "NZV", ...) return modFit
    1. train model modFit by data$training
    2. predict data$testing by modFit
    3. create confusionMatrix by testing$classe and predicted value
    4. save confusionMatrix$overall , confusionMatrix$byClass
    5. plot the frequency of predict v.s. actual and save image
  7. pml_write_files = function(x, modDir)
    1. write prediction of 20 new testing cases with assignment format
  8. RunningModels.R script used to train model with different parameters, save confusionMatrix, and predict 20 new test cases and writes prediction result for this assignment
  9. cData <- cleanData(data = trainData)
  10. pData <- probeData(cData, 0.7)
  11. modFit1 <- runRFModel(data = pData, modDir = "parRF70/", method = "parRF")
  12. testPred <- predict(modFit, testCase)
  13. pml_write_files(testPred, modDir= "RPART70/")
  14. modFit.RData: a list of training model
  15. mod: training model by Parallel Random Forest
  16. cfMatrix: confusion matrix
  17. cfplot: confusion matrix plot

About

Weight Lifting Exercise Prediction Model


Languages

Language:HTML 99.0%Language:R 1.0%