pouder-Man

command line argument handling code

df<-read.csv('result_4.csv')
tail(df,10)
set.seed(2)
id<-sample(2,nrow(df),prob = c(0.8,0.2), replace = TRUE)
train<-df[id==1,]
test<-df[id==2,]
tail(test,2)
library('rjson')
args <- commandArgs(trailingOnly=TRUE)
json <- fromJSON(args)
path = json$path
df<-read.csv(path)
library(C50)
model <- readRDS("./c5_model.rds")
prob <- predict(model, newdata = test[1:1, 1:126], type = "prob")
prob <- predict(model, newdata = df[1:1, 1:126], type = "prob")
max1 <- 0
max2 <- 0
max3 <- 0
......@@ -49,4 +48,4 @@ v <-c("51","54,51","56","56,51","56,54,51","59","59,51","59,56,51","59,56,54,51"
plot <- list(data.frame(idx=toString(v[idx1]),probability=max1),data.frame(idx=toString(v[idx2]),probability=max2),data.frame(idx=toString(v[idx3]),probability=max3))
newplot <- do.call(rbind,plot)
p <- ggplot(newplot,aes(idx,probability))+geom_bar(stat="identity",fill = "blue")
ggsave(file="~/bar_plot.png",plot=p,dpi=300)
ggsave(file="./bar_plot.png",plot=p,dpi=300)
......