Skip to content
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

Improve type-stability for metrices #233

Merged
merged 5 commits into from
Apr 15, 2017
Merged

Improve type-stability for metrices #233

merged 5 commits into from
Apr 15, 2017

Conversation

vchuravy
Copy link
Collaborator

@vchuravy vchuravy commented Apr 14, 2017

_update_single_output needs to be type-stable, therefore move @nd_as_jl over the function barrier

@vchuravy vchuravy requested a review from pluskid April 14, 2017 02:46
@codecov-io
Copy link

codecov-io commented Apr 14, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@68b67e8). Click here to learn what that means.
The diff coverage is 28.23%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #233   +/-   ##
=========================================
  Coverage          ?   68.92%           
=========================================
  Files             ?       24           
  Lines             ?     1860           
  Branches          ?        0           
=========================================
  Hits              ?     1282           
  Misses            ?      578           
  Partials          ?        0
Impacted Files Coverage Δ
src/metric.jl 29.1% <28.23%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68b67e8...349d2a7. Read the comment docs.

@vchuravy
Copy link
Collaborator Author

vchuravy commented Apr 14, 2017

Timings on a M6000:

NullMetric Seq(MSE, MultiACE)
Before 65.5915 85.7034
After 65.2526 66.4901

This is just an arbitrary network I have been working on, but the results are quite stark

@vchuravy
Copy link
Collaborator Author

@pluskid We can also drop the last two commits

end

function get(metric :: MSE)
return [(:MSE, metric.mse_sum / metric.n_sample)]
# Delay copy until last possible moment
mse_sum = mapreduce(nda->copy(nda)[1], +, 0.0, metric.mse_sum)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that each NDArray in mse_sum at this point are actually scalars? Maybe using asscalar will be more efficient than the generic copy function. Otherwise, LGTM.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asscalar only exist on the python side and is uses the same mechanism. We could probably write a more effective mechanism with an unsafe_load.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. OK. Sounds good then.

@vchuravy vchuravy merged commit 4675ace into master Apr 15, 2017
@vchuravy vchuravy deleted the vc/metrics branch April 15, 2017 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants