boston nn-data (scala regression)

Published by onesixx on

https://onesixx.com/data-boston/
source(file.path(getwd(),"../00.global_dl.R"))
### Title: BOSTON house prices regression --- --- -- --- --- --- --- --- --- ----
# Deep Learning with R by François Chollet
# 3.6 Predicting house prices: a regression example

data("Boston", package="MASS")
Boston %>% str()
xColNm <- colnames(Boston)[1:13]
yColNm <- colnames(Boston)[14]

##1# DATA Source : INPUT LAYER -------------------------------------------------
# 데이터량이 적다. / feature간 척도가 다르다.
# y:주택가격 median (단위 1,000$)
#boston <- dataset_boston_housing()
boston <- readRDS(file.path(DATA_PATH,"boston.RData"))
c(c(trnData, trnTarget), c(tstData, tstTarget)) %<-% boston 


melt_trnX <- data.table(trnData) %>% melt.data.table(measure=str_c("V",1:13))
melt_trnX %>% ggplot(aes(variable, value)) + geom_boxplot()

##2# Preprocess  ---------------------------------------------------------------
trnData %>% str()
tstData %>% str()
trnTarget %>% summary()

# *Normalize ----
trn_mean   <- apply(trnData, 2, mean)
trn_stdev  <- apply(trnData, 2, sd)
trn_Data <- scale(trnData, center=trn_mean, scale=trn_stdev)
tst_Data <- scale(tstData, center=trn_mean, scale=trn_stdev)   # test data!!!

melt_trn_Data <- data.table(trn_Data) %>% melt.data.table(measure=str_c("V",1:13))
melt_trn_Data %>% ggplot(aes(variable, value)) + geom_boxplot()

Categories: Keras

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x