博文

目前显示的是 十二月, 2017的博文

Deep learning in R with h2o

library(MASS) library(h2o) set.seed(123) DataFrame <- Boston #Structure of Boston str(DataFrame) #Histgram of the Boston data hist(DataFrame$medv) #Check the dimention of this data frame dim(DataFrame) head(DataFrame) #min and max value for each of the variable apply(DataFrame,2,range) #scale function will give mean=0 and standard deviation=1 for each variable maxValue <- apply(DataFrame,2,max) minValue <- apply(DataFrame,2,min) DataFrame <- as.data.frame(scale(DataFrame,center = minValue,scale = maxValue-minValue)) #h2o initialization h2o.init(ip="localhost",port = 54321,max_mem_size = "3000m") #Defining x and y y <- "medv" x <- setdiff(colnames(DataFrame),y) #create the train and test data set ind <- sample(1:nrow(DataFrame),400) trainDF <- DataFrame[ind,] testDF <- DataFrame[-ind,] #Fitting the model model <- h2o.deeplearning(x=x,                           y=y,                           seed = 1234,                         

Rstudio 实用快捷键

 %in%    Ctrl+Shift+Alt+K  %>%     Ctrl+Shift+M <-           Alt+-

Linux mint software manager 错误

sudo apt install  software-properties-common mintupdate

R 中文正则表达式

library(stringr) word <- c("在线正则表达式测试") pattern <- '^[\u4E00-\u9FA5]+$' #返回了向量x中哪个元素匹配了模式pattern(即返回了向量x的某些下标)或者具体哪个元素匹配了模式(通过设置value参数来完成) grep(pattern,word) #检测字符是否存在某些指定模式 str_detect(word,pattern) #向量word中的每个元素是否匹配了pattern,即只返回TRUE或FALSE grepl(pattern, word) #regexpr(),gregexpr()和regexec()函数同样也可用来进行字符串搜索