Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mhc_rank
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Patrick Skillman-Lawrence
mhc_rank
Commits
7d889baf
Commit
7d889baf
authored
9 years ago
by
Alex Rubinsteyn
Browse files
Options
Downloads
Patches
Plain Diff
added missing import
parent
3beb40ec
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
experiments/model-selection.py
+1
-34
1 addition, 34 deletions
experiments/model-selection.py
with
1 addition
and
34 deletions
experiments/model-selection.py
+
1
−
34
View file @
7d889baf
...
...
@@ -21,12 +21,8 @@ from __future__ import (
unicode_literals
)
import
argparse
from
time
import
time
import
numpy
as
np
import
pandas
as
pd
from
mhcflurry.data_helpers
import
load_data
...
...
@@ -46,6 +42,7 @@ from model_configs import (
)
from
model_selection_helpers
import
(
evaluate_model_config_by_cross_validation
,
evaluate_model_configs
,
)
from
summarize_model_results
import
hyperparameter_performance
...
...
@@ -146,36 +143,6 @@ parser.add_argument(
help
=
"
Comma separated list of optimization methods
"
)
def
evaluate_model_configs
(
configs
,
results_filename
,
train_fn
):
all_dataframes
=
[]
all_elapsed_times
=
[]
for
i
,
config
in
enumerate
(
configs
):
t_start
=
time
()
print
(
"
\n\n
=== Config %d/%d: %s
"
%
(
i
+
1
,
len
(
configs
),
config
))
result_df
=
train_fn
(
config
)
n_rows
=
len
(
result_df
)
result_df
[
"
config_idx
"
]
=
[
i
]
*
n_rows
for
hyperparameter_name
in
config
.
_fields
:
value
=
getattr
(
config
,
hyperparameter_name
)
result_df
[
hyperparameter_name
]
=
[
value
]
*
n_rows
# overwrite existing files for first config
# only write column names for first batch of data
# append results to CSV
with
open
(
results_filename
,
mode
=
(
"
a
"
if
i
>
0
else
"
w
"
))
as
f
:
result_df
.
to_csv
(
f
,
index
=
False
,
header
=
(
i
==
0
))
all_dataframes
.
append
(
result_df
)
t_end
=
time
()
t_elapsed
=
t_end
-
t_start
all_elapsed_times
.
append
(
t_elapsed
)
median_elapsed_time
=
np
.
median
(
all_elapsed_times
)
estimate_remaining
=
(
len
(
configs
)
-
i
-
1
)
*
median_elapsed_time
print
(
"
-- Time for config = %0.2fs, estimated remaining: %0.2f hours
"
%
(
t_elapsed
,
estimate_remaining
/
(
60
*
60
)))
return
pd
.
concat
(
all_dataframes
)
if
__name__
==
"
__main__
"
:
args
=
parser
.
parse_args
()
configs
=
generate_all_model_configs
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment