-
Notifications
You must be signed in to change notification settings - Fork 1
/
ArchIE_predict.R
31 lines (25 loc) · 963 Bytes
/
ArchIE_predict.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
args = commandArgs(trailingOnly=TRUE)
commandArgs()
# library(data.table)
# library(tidyverse)
# train <- data.frame(fread(args[1]))
LABEL_COL=209
# lr <- train[,1:LABEL_COL] # cut down the extra columns -- 209 is the label (0=not archaic, 1=archaic)
# model <- glm(V209 ~ .,family=binomial(link='logit'),data=lr) # train the model
cat("loading training data...")
model <- readRDS(args[1])
# load(args[1])
cat("done\n")
cat("loading test data...")
test <- read.table(args[2], sep="", header=F)
#test <- read_tsv(args[2], col_names=F)
# predicted <- plogis(predict.glm(model, test[,1:LABEL_COL]))
cat("done\n")
cat("getting predictions...")
# test <- read.table("archanc/output/ArchIE/combined/GutenkunstThreePop_mnm100-0.015_eur.txt")
predicted <- plogis(predict.glm(model, test[,1:LABEL_COL]))
cat("done\n")
# number of samples predicted to be archaic
# length(predicted[predicted>0.5])
# savehistory("archanc/ArchIE_predict.R")
saveRDS(predicted, args[3])