Today, I finally found the code of how to extract the remaining data from a matrix without the sample submatrix.
#biological predictors can be used to assess the quality of the raw mateiral before processing.
#manufacturing process predictors can be changed in the manufacturing process.
library(AppliedPredictiveModeling)
data(ChemicalManufacturingProcess)
ChemicalManufacturingProcess
#12 biological predictors, 45 process predictors, 176 manufacturing runs
head(ChemicalManufacturingProcess)
set.seed(1)
trainrows=createDataPartition(ChemicalManufacturingProcess[ ,1], p=0.8, list = FALSE)
trainrows
trainpredictors=ChemicalManufacturingProcess[trainrows, ]
dim(trainpredictors)
testpredictors=ChemicalManufacturingProcess[-trainrows, ]
dim(testpredictors)
The function of it is to remove the sample submatrix from the main matrix and use the remaining data to build another matrix. So we can obtain both training data matrix and testing data matrix from the data matrix that we have.
Next week, I will continue to read Chapter 7.
No comments:
Post a Comment