Toggle navigation
Toggle navigation
This project
Loading...
Sign in
오영택
/
2018-capstone
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
pouder-Man
2018-06-06 21:14:12 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e2f5d2f83e8bd4fd7536da23baed975ff1ba2c38
e2f5d2f8
1 parent
fb86c905
command line argument handling code
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
2018-capstone/2018-capstone/model.r
2018-capstone/2018-capstone/model.r
View file @
e2f5d2f
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
(
C
50
)
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
)
...
...
Please
register
or
login
to post a comment