2018의 게시물 표시

Systematic Sampling in R

SampleBy in the doBy package that was useful in R is not supported. I have created sample.by systematic sampling function as below. ^^ ## usage : sample.by(data_as_dataframe, number_of_column, ratio_of_sample) ##             returns a list of sample.df and rest.df   sample.by <- function(df, by.col.loc=1, prop=0.1) {   sample.df <- data.frame()   rest.df <- data.frame()   dat <- split(df, df[by.col.loc])   for(i in 1:NROW(dat)) {     idx <- sample(c(rep(1,n<-round(NROW(dat[[i]]) * prop)),                     rep(2,NROW(dat[[i]]) - n)))     sample.df <- rbind(sample.df, dat[[i]][idx==1,])     rest.df  <- rbind(rest.df, dat[[i]][idx==2,])       }   list(sample.df=sample.df[sample(NROW(sample.df)),],        rest.df=rest.df[sample(NROW(rest.df)),]) } ## example sample.by(iris, 5, 0.7) 

ubuntu server에 GUI 설치

GUI 버전설치 Ubuntu Desktop : sudo apt install ubuntu-desktop KDE : sudo apt install kubuntu-desktop XFCE : sudo apt install xface LXDE : sudo apt install lxde Openbox : sudo apt install openbox 기본프로그램 제외한 최소설치 $ sudo apt install --no-install-recommends ubuntu-desktop

ipython notebook에서 다른 버전의 python 설치

1. Anaconda 5 설치 2. Python 2.7 환경구축     $ conda create -n python27 python=2.7     $ source activate python27     $ conda install notebook ipykernel     $ ipython kernel install --user 3. Python 3.5 환경구축     $ conda create -n python35 python=3.5     $ source activate python35     $ conda install notebook ipykernel     $ ipython kernel install --user 4. $ ipython notebook ./local/share/jupyter/kernels 내 환경변수로 수정가능