Being a notorious beginner I wondered how to see the results of preprocessing, (normal-izing, scaling, centering) my data with caret package in R. I typed some data in Excel and played with it in R Studio.I could not figure out at first where the results of preProcess function are. It appears they must be processed with "predict".
library(caret)
x<-read.table(file="clipboard",dec=",",header=T)
x
#preProcValues<-scale(x,center = T, scale=T) - just a note on a built in function in base R
#here i build a "model", a preprocessing object or model
preProcObject<-preProcess(x, method = c("center", "scale","YeoJohnson"))
#to see the results I must apply it
Data_PreProc <- predict(preProcObject, x)
#I build a table to see source data and processed data side by side.
Output<-cbind("input"=x$data,"output"=Data_PreProc$data)
Output
plot(Output)
Brak komentarzy:
Prześlij komentarz