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

Linrange scaling #294

Merged
merged 3 commits into from
Jan 29, 2019
Merged

Linrange scaling #294

merged 3 commits into from
Jan 29, 2019

Conversation

danmackinlay
Copy link
Contributor

@danmackinlay danmackinlay commented Jan 13, 2019

For this to be a sensible commit to fix #293 , my changes to the test suite should actually cause a test failure. However, they don't; I'm doing it wrong. Hints gratefully accepted.

@codecov-io
Copy link

codecov-io commented Jan 13, 2019

Codecov Report

Merging #294 into master will increase coverage by 0.09%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #294      +/-   ##
=========================================
+ Coverage   47.71%   47.8%   +0.09%     
=========================================
  Files          21      21              
  Lines        1071    1071              
=========================================
+ Hits          511     512       +1     
+ Misses        560     559       -1
Impacted Files Coverage Δ
src/scaling/scaling.jl 45.04% <0%> (+0.9%) ⬆️

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 ebe5044...5915bda. Read the comment docs.

@dkarrasch
Copy link
Contributor

I think tests don't fail because your very own fix from within this PR is applied. You should run your tests against master to make it fail. But I think it's a good sign that tests don't fail. That means any previously intended functionality is preserved by your modification, and your fix works.

@howthebodyworks
Copy link

@dkarrasch that would be great - but the first commit in the PR that introduces the test but not the fix still causes no failures, so I haven't really covered it 😞

@dkarrasch
Copy link
Contributor

I didn't read carefully enough. It should be

zip(LinRange(-3,1.5,91), 1:.1:10)

in the test. You missed to replace the StepLenRange -3:.05:1.5 with your LinRange.

test/scaling/scaling.jl Outdated Show resolved Hide resolved
rescale_gradient(r::StepRangeLen, g) = g / step(r)
coordlookup(r::AbstractRange, x) = (x - first(r)) / step(r) + oneunit(eltype(r))
boundstep(r::AbstractRange) = 0.5*step(r)
rescale_gradient(r::AbstractRange, g) = g / step(r)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there potentially more instances that need a consistent change? Something like rescale_hessian for instance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. AFAICT no, rescale_hessian_components, for example, uses steps, which accepts any AbstractRange subtype. We should not have changed any behaviour. It presumably can't hurt to test the hessian scaling also though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Generally, I think you have found an oversight. #165 was marked as resolved by #226. So it indeed could be that this had been fixed in some places but not all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are now tests for hessians specifically.. I'm not sure if they are useful tests.

tests/scaling.jl also tests for iteration behaviour and other float types when interpolating; but I don't think we especially want to clone those also for LinRange


itp = interpolate(1:1.0:10, BSpline(Linear()))

sitp = @inferred(scale(itp, LinRange(-3,1.5,91)))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This duplicates most of the previous test but with a different LinRange.
possibly this is wasteful? But it does fail without the fix as desired.

rescale_gradient(r::StepRangeLen, g) = g / step(r)
coordlookup(r::AbstractRange, x) = (x - first(r)) / step(r) + oneunit(eltype(r))
boundstep(r::AbstractRange) = 0.5*step(r)
rescale_gradient(r::AbstractRange, g) = g / step(r)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are now tests for hessians specifically.. I'm not sure if they are useful tests.

tests/scaling.jl also tests for iteration behaviour and other float types when interpolating; but I don't think we especially want to clone those also for LinRange

@danmackinlay
Copy link
Contributor Author

I'll rebase and squash these if they make sense.

@timholy timholy merged commit 73afe12 into JuliaMath:master Jan 29, 2019
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.

scaling using a LinRange unsupported
5 participants