-
Notifications
You must be signed in to change notification settings - Fork 2
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
classifyarray #10
classifyarray #10
Conversation
0cc195b
to
a1bc588
Compare
src/classifyarray.jl
Outdated
maskedarray = isnothing(classifyMask) ? array : mask!(copy(array)) | ||
nCells = count(isfinite, maskedarray) | ||
boundaryIndexes = ceil(Int, cumulativeProportions * nCells) | ||
boundaryValues = sort(vec(maskedarray))[boundaryIndexes] |
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.
there are two full copies in this function - it must be possible to avoid at least this one
Just realized that using StatsBase: quantile
a,c = rand(1000, 1000), [0.2, 0.4, 0.7, 0.8, 1]
julia> @btime quantile(vec(a), c)
98.238 ms (5 allocations: 7.63 MiB)
5-element Vector{Float64}:
0.20055273960046652
0.40035575057383455
0.7008467088240219
0.8006453000863003
0.9999981820198582
julia> @btime calcBoundaries(a, c)
72.043 ms (7 allocations: 7.63 MiB)
5-element Vector{Float64}:
0.2005524615247647
0.40035544743228324
0.7008461304132632
0.8006452681104108
0.9999981820198582 |
Isn't it because |
Yes totally agree. It was just fun that it took me several readings of the code - and a port PR - to realize that this functionality already exists and has a name :-) |
But I just need to check out that quantile behaves as expected in the presences of NaNs |
a1bc588
to
404a820
Compare
So, if |
a386a79
to
bbda1df
Compare
Codecov Report
@@ Coverage Diff @@
## main #10 +/- ##
==========================================
- Coverage 37.73% 30.30% -7.44%
==========================================
Files 8 9 +1
Lines 53 66 +13
==========================================
Hits 20 20
- Misses 33 46 +13
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Honestly I feel like I should just inline those two helper functions? They're not used anywhere else. |
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.
Can you add an illustration to docs/src/gallery.md
?
I don't feel strongly about that - I might just rename them to start with |
Done. How de we feel about the camelCase? I'm almost inclined to just call it |
d795d81
to
888a16c
Compare
I like |
Is |
530cae7
to
0183fe7
Compare
Ints are often given and then this will fail
0183fe7
to
e5ba25c
Compare
Hi @tpoisot I had a number of issues with conflict - I think I resolved them, but I had to rebase and force-push - hope you wont' get into trouble over at #22 which you branched from this. |
We could just export |
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.
Looks good to me. I use BlueStyle most of the time now so the camelCase is a bit confusing in terms of separating out types and variables, but that's another one for the style guide.
src/classify.jl
Outdated
@@ -0,0 +1,26 @@ | |||
function _w2cp(vec) |
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.
could inline this or give a clearer name, took me a while to figure out what it was
OK, I've exported it again (in the ecosystem only MLBase.jl appears to export a function of that name), and inline the two helper functions - and merged. |
great, I'll be able to deal with #22 (which doesn't need it yet anyways, but the NN cluster does) |
also in favor or not using |
No description provided.