-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resource allocation colormap #3453
base: dev
Are you sure you want to change the base?
Changes from 13 commits
88dc031
447e01a
442e735
43aa8bf
3afba3a
a36dc8a
071eb5f
2ecfa1e
d5996f1
dd12143
1c30fc8
82c95e1
2cb3f37
2ea03e2
60ec9fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
INSERT INTO qiita.allocation_equations(equation_name, expression) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the other sql: these lines need to be moved to 94.sql. |
||
VALUES | ||
('mem_model1', '(k * (np.log(x))) + (x * a) + b'), | ||
('mem_model2', '(k * (np.log(x))) + (b * ((np.log(x))**2)) + a'), | ||
('mem_model3', '(k * (np.log(x))) + (b * ((np.log(x))**2)) + (a * ((np.log(x))**3))'), | ||
('mem_model4', '(k * (np.log(x))) + (b * ((np.log(x))**2)) + (a * ((np.log(x))**2.5))'), | ||
('time_model1', 'a + b + ((np.log(x)) * k)'), | ||
('time_model2', 'a + (b * x) + ((np.log(x)) * k)'), | ||
('time_model3', 'a + (b * ((np.log(x))**2)) + ((np.log(x)) * k)'), | ||
('time_model4', '(a * ((np.log(x))**3)) + (b * ((np.log(x))**2)) + ((np.log(x)) * k)'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1327,8 +1327,7 @@ def setUp(self): | |
|
||
def test_plot_return(self): | ||
# check the plot returns correct objects | ||
fig1, axs1 = qdb.util.resource_allocation_plot( | ||
self.df, self.cname, self.sname, self.col_name) | ||
fig1, axs1 = qdb.util.resource_allocation_plot(self.df, self.col_name) | ||
self.assertIsInstance( | ||
fig1, Figure, | ||
"Returned object fig1 is not a Matplotlib Figure") | ||
|
@@ -1344,46 +1343,46 @@ def test_minimize_const(self): | |
self.df[self.col_name] = self.df.samples * self.df['columns'] | ||
fig, axs = plt.subplots(ncols=2, figsize=(10, 4), sharey=False) | ||
|
||
bm, options = qdb.util._resource_allocation_plot_helper( | ||
self.df, axs[0], self.cname, self.sname, 'MaxRSSRaw', | ||
qdb.util.MODELS_MEM, self.col_name) | ||
mem_models, time_models = qdb.util.retrieve_equations() | ||
bm_name, bm, options = qdb.util._resource_allocation_plot_helper( | ||
self.df, axs[0], 'MaxRSSRaw', mem_models, self.col_name) | ||
# check that the algorithm chooses correct model for MaxRSSRaw and | ||
# has 0 failures | ||
k, a, b = options.x | ||
failures_df = qdb.util._resource_allocation_failures( | ||
self.df, k, a, b, bm, self.col_name, 'MaxRSSRaw') | ||
failures_df = qdb.util._resource_allocation_success_failures( | ||
self.df, k, a, b, bm, self.col_name, 'MaxRSSRaw')[-1] | ||
failures = failures_df.shape[0] | ||
self.assertEqual(bm, qdb.util.mem_model3, | ||
|
||
self.assertEqual(bm_name, 'mem_model4', | ||
msg=f"""Best memory model | ||
doesn't match | ||
{bm_name} != 'mem_model4'""") | ||
self.assertEqual(bm, mem_models['mem_model4']['equation'], | ||
msg=f"""Best memory model | ||
doesn't match | ||
Coefficients:{k} {a} {b} | ||
{qdb.util.mem_model1}, "qdb.util.mem_model1" | ||
{qdb.util.mem_model2}, "qdb.util.mem_model2" | ||
{qdb.util.mem_model3}, "qdb.util.mem_model3" | ||
{qdb.util.mem_model4}, "qdb.util.mem_model4" | ||
""") | ||
self.assertEqual(failures, 0, "Number of failures must be 0") | ||
|
||
# check that the algorithm chooses correct model for ElapsedRaw and | ||
# has 1 failure | ||
bm, options = qdb.util._resource_allocation_plot_helper( | ||
self.df, axs[1], self.cname, self.sname, 'ElapsedRaw', | ||
qdb.util.MODELS_TIME, self.col_name) | ||
bm_name, bm, options = qdb.util._resource_allocation_plot_helper( | ||
self.df, axs[1], 'ElapsedRaw', time_models, self.col_name) | ||
k, a, b = options.x | ||
failures_df = qdb.util._resource_allocation_failures( | ||
self.df, k, a, b, bm, self.col_name, 'ElapsedRaw') | ||
failures_df = qdb.util._resource_allocation_success_failures( | ||
self.df, k, a, b, bm, self.col_name, 'ElapsedRaw')[-1] | ||
failures = failures_df.shape[0] | ||
self.assertEqual(bm_name, 'time_model4', | ||
msg=f"""Best time model | ||
doesn't match | ||
{bm_name} != 'time_model4'""") | ||
|
||
self.assertEqual(bm, qdb.util.time_model1, | ||
self.assertEqual(bm, time_models[bm_name]['equation'], | ||
msg=f"""Best time model | ||
doesn't match | ||
Coefficients:{k} {a} {b} | ||
{qdb.util.time_model1}, "qdb.util.time_model1" | ||
{qdb.util.time_model2}, "qdb.util.time_model2" | ||
{qdb.util.time_model3}, "qdb.util.time_model3" | ||
{qdb.util.time_model4}, "qdb.util.time_model4" | ||
""") | ||
self.assertEqual(failures, 1, "Number of failures must be 1") | ||
self.assertEqual(failures, 0, "Number of failures must be 0") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wondering why this changed from 1 to 0? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now the code chooses 4th model instead of 1st, which has 0 failures. |
||
|
||
def test_MaxRSS_helper(self): | ||
tests = [ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that we did a release this morning so these lines need to be moved to 94.sql.