Skip to content

Conversation

juliohm
Copy link
Member

@juliohm juliohm commented Apr 11, 2020

This PR addresses item (3) of issue #126. It gets rid of the internal Deriv and Deriv2 types previously used to define plot recipes. The new plot recipe is simpler and we can plot different traits of the loss by passing a keyword argument:

using LossFunctions
using Plots

l = L2DistLoss()

plot(l) # default to value
plot(l, fun=deriv) # equivalent to old Deriv
plot(l, fun=deriv2) # equivalent to old Deriv2

As a side note, the plot recipe is not covered by the current test suite. In my own packages I make use of VisualRegressionTests.jl for testing plot recipes. Would you be ok with adding it here as a test dependency as well?

@codecov-io
Copy link

codecov-io commented Apr 11, 2020

Codecov Report

Merging #129 into master will increase coverage by 1.68%.
The diff coverage is 77.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #129      +/-   ##
==========================================
+ Coverage   89.00%   90.68%   +1.68%     
==========================================
  Files          12       12              
  Lines         700      687      -13     
==========================================
  Hits          623      623              
+ Misses         77       64      -13     
Impacted Files Coverage Δ
src/LossFunctions.jl 100.00% <ø> (ø)
src/supervised/io.jl 38.70% <0.00%> (+10.13%) ⬆️
src/devutils.jl 100.00% <100.00%> (ø)
src/supervised/sparse.jl 100.00% <100.00%> (ø)
src/supervised/supervised.jl 91.12% <100.00%> (+1.06%) ⬆️

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 71041fb...4bd9d95. Read the comment docs.

@juliohm juliohm merged commit 46cc745 into master Apr 12, 2020
@juliohm juliohm deleted the plotrecipe branch April 12, 2020 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants