Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ease
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
ease
Commits
e13aafa3
Commit
e13aafa3
authored
Feb 13, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cv error generator to run for 100
parent
c9596b82
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
tests/test_cv_full.py
+18
-2
No files found.
tests/test_cv_full.py
View file @
e13aafa3
...
...
@@ -24,8 +24,10 @@ if not data_path.endswith("/"):
data_path
=
data_path
+
"/"
filenames
=
[
str
(
i
)
+
".tsv"
for
i
in
xrange
(
1
,
19
)]
run_cv
=
False
def
run_single_worker
(
args
):
filename
,
data_path
=
args
filename
,
data_path
,
run_cv
=
args
base_name
=
data_path
+
filename
print
base_name
sa_val
=
file
(
base_name
)
...
...
@@ -55,10 +57,24 @@ def run_single_worker(args):
else
:
clf
=
GradientBoostingRegressor
(
n_estimators
=
100
,
learn_rate
=.
05
,
max_depth
=
4
,
random_state
=
1
,
min_samples_leaf
=
3
)
if
run_cv
:
try
:
cv_preds
=
util_functions
.
gen_cv_preds
(
clf
,
train_feats
,
score1s
,
num_chunks
=
10
)
# int(math.floor(len(texts)/2)
except
:
cv_preds
=
score1s
else
:
try
:
random_nums
=
list
(
numpy
.
random
.
random_integers
(
0
,
train_feats
.
shape
[
0
],
100
))
out_group_rows
=
[
row
for
row
in
xrange
(
0
,
train_feats
.
shape
[
0
])
if
row
not
in
random_nums
]
in_group_scores
=
list
(
numpy
.
array
(
score1s
)[
random_nums
])
out_group_scores
=
list
(
numpy
.
array
(
score1s
)[
out_group_rows
])
out_group_score2s
=
list
(
numpy
.
array
(
score2s
)[
out_group_rows
])
score1s
=
out_group_scores
score2s
=
out_group_score2s
model
=
util_functions
.
gen_model
(
clf
,
train_feats
[
random_nums
,:],
in_group_scores
)
cv_preds
=
util_functions
.
gen_preds
(
model
,
train_feats
[
out_group_rows
,:])
except
:
cv_preds
=
score1s
[
100
:]
rounded_cv
=
[
int
(
round
(
cv
))
for
cv
in
list
(
cv_preds
)]
added_score1
=
[
s1
+
1
for
s1
in
score1s
]
...
...
@@ -80,7 +96,7 @@ def run_single_worker(args):
length
=
len
(
filenames
)
np
=
8
p
=
Pool
(
processes
=
np
)
errs
,
kappas
,
percent_errors
,
human_errs
,
human_kappas
,
human_percent_errors
=
zip
(
*
p
.
map
(
run_single_worker
,[(
filenames
[
i
],
data_path
)
for
i
in
xrange
(
0
,
length
)]))
errs
,
kappas
,
percent_errors
,
human_errs
,
human_kappas
,
human_percent_errors
=
zip
(
*
p
.
map
(
run_single_worker
,[(
filenames
[
i
],
data_path
,
run_cv
)
for
i
in
xrange
(
0
,
length
)]))
outfile
=
open
(
data_path
+
"outdata/summary.tsv"
,
'w+'
)
outfile
.
write
(
"set
\t
err
\t
kappa
\t
percent_error
\t
human_err
\t
human_kappa
\t
human_percent_error
\n
"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment