How to Install WordPress on VPS (Ubuntu 1604)
Hi all, I just bought a new VPS from Vultr.com, and I’d like to share my experience with you!
Hi all, I just bought a new VPS from Vultr.com, and I’d like to share my experience with you!
GGplot实操100练
#并行计算-parallel包 #parallel包的思路和lapply函数很相似,都是将输入数据分割、计算、整合结果。只不过并行计算是用到了不同的cpu来运算。下面的例子是解决欧拉问题的第14个问题。 # 并行计算euler14问题 # 自定义函数以返回原始数值和步数 library(parallel) func <- function(x) { n = 1 raw <- x while (x > 1) { x <- ifelse(x%%2==0,x/2,3*x+1) n = n + 1 } return(c(raw,n)) } library(parallel) # 用system.time来返回计算所需时间 system.time({ x <- 1:1e6 cl <- makeCluster(4) # 初始化四核心集群 results <- parLapply(cl,x,func) # lapply的并行版本 res.df <- do.call('rbind',results) # 整合结果 stopCluster(cl) [...]
#Multiplot in ggplot2 install.packages("gridExtra") library("gridExtra") install.packages("cowplot") library("cowplot") df <- ToothGrowth # Convert the variable dose from a numeric to a factor variable df$dose <- as.factor(df$dose) head(df) #----Cowplot---- # The cowplot package is an extension to ggplot2 #and it can be used to provide a publication-ready plots. library(cowplot) # Default plot bp <- ggplot(df, aes(x=dose, y=len, color=dose)) [...]
Here is an interesting package called 'profvis' that I recently get to know about. It is quite useful when you are trying to locate the place where takes the longest time when running the code. Below is an official example. #R system monitoring install.packages('profvis') library(profvis) # To run code with profiling, wrap the expression in profvis(). [...]
Date: 2017/04/16 source: http://math.usu.edu/jrstevens/stat5570/2.3.Clustering.pdf # Heatmap Trial library(cluster) library(RColorBrewer) set.seed(123) x1 <- c(rnorm(20,sd=.05), rnorm(20,mean=1,sd=.05), rnorm(20,mean=1.5,sd=.05)) x2 <- 4+c(rnorm(20,sd=2), rnorm(20,mean=8,sd=1.5), rnorm(20,mean=8,sd=1)) x1.sc <- x1/sd(x1) x2.sc <- x2/sd(x2) hmcol <- colorRampPalette(brewer.pal(10,"RdBu"))(256) csc <- c(hmcol[50],hmcol[200]) # define side colors heatmap(cbind(x1.sc,x2.sc),scale="column",col=hmcol, ColSideColors=csc,cexCol=1.5,cexRow=.5) # ---- try with ALL datasets source("http://bioconductor.org/biocLite.R") biocLite(c('affy', 'ALL')) # download packages library(affy); library(ALL); data(ALL) gn <- featureNames(ALL) [...]
I believe most of you are quite familiar using R markdown to write either your analysis report or work sample, some of which requires a lot of formula and table writing. So here is what I find to be useful to do these jobs. Write math matrix \mathbf{X} = \left[\begin{array} {rrr} 1 & 2 & 3 [...]
Just finished an amazing tutorial textbook in 3 consecutive days. is such a fantastic book for both beginners and mid-level learners like me to review all the aspects of Data Science using R systematically and grab a more thorough understanding of data tidying methods, how to treat different data format effectively and utilize dplyr, lubridate and [...]
xgboost在代价函数里加入了正则项,用于控制模型的复杂度。正则项里包含了树的叶子节点个数、每个叶子节点上输出的score的L2模的平方和。
下面推荐一个PPT Slide 帮助你们更好地理解正则化Regularization