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

Reduce sigdigits in parameter range display #948 #958

Merged
merged 4 commits into from
Feb 3, 2024

Conversation

adarshpalaskar1
Copy link
Contributor

This commit addresses issue #948 by updating the display of parameter ranges to include reduced significant digits.

This commit addresses issue JuliaAI#948 by updating the display of parameter ranges to include reduced significant digits.
@ablaom
Copy link
Member

ablaom commented Jan 30, 2024

Thanks @adarshpalaskar1 for this contribution. Looks like you need to update a test.

@adarshpalaskar1
Copy link
Contributor Author

adarshpalaskar1 commented Jan 30, 2024

Sorry, I didn't run the tests locally before creating the pull request.
I saw the logs and found this test is failing:

range(Int, :junk, lower=1, upper=10)

Log:

  Expression: String(take!(io)) == "NumericRange(1 ≤ junk ≤ 10; origin=5.5, unit=4.5)"
   Evaluated: "NumericRange(1.0 ≤ junk ≤ 10.0; origin=5.5, unit=4.5)" == "NumericRange(1 ≤ junk ≤ 10; origin=5.5, unit=4.5)"

Should I update the test, or is the updated code incorrect?

@ablaom
Copy link
Member

ablaom commented Jan 31, 2024

I think your changes are good. You just need to update the invalidated test. How about you improve the test by using lower and upper values with more that 4 sigdigits and verifying (with a variation on the existing test) that extra digits get truncated?

@ablaom
Copy link
Member

ablaom commented Jan 31, 2024

Okay, I see. In the <:Integer case, we don't want to apply rounding at all. Sorry I missed that. So you need to add some logic.

This commit addresses issue JuliaAI#948 by updating the display of parameter ranges to include reduced significant digits.
@adarshpalaskar1
Copy link
Contributor Author

adarshpalaskar1 commented Jan 31, 2024

Okay, I have added a check before rounding off. I faced some errors while executing the tests locally so tried some test cases manually.

Update: I was able to run the tests locally, and all of them passed.

Copy link

codecov bot commented Feb 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f3da249) 87.66% compared to head (02af6e0) 88.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #958      +/-   ##
==========================================
+ Coverage   87.66%   88.00%   +0.33%     
==========================================
  Files          28       28              
  Lines        2433     2542     +109     
==========================================
+ Hits         2133     2237     +104     
- Misses        300      305       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ablaom
Copy link
Member

ablaom commented Feb 1, 2024

Can we please add at test here:

r2 = range(Char, :junk, values=['c', 'd'])
?

For example, something for r3= range(Float64, :junk, lower=3.14159, upper=6.283185)

adarshpalaskar1 and others added 2 commits February 2, 2024 16:24
refactored type check

Co-authored-by: Anthony Blaom, PhD <[email protected]>
Added test for one-dimensional range with Float64 values, rounded off to 4 significant digits.
@adarshpalaskar1
Copy link
Contributor Author

adarshpalaskar1 commented Feb 2, 2024

Can we please add at test here:

r2 = range(Char, :junk, values=['c', 'd'])

?
For example, something for r3= range(Float64, :junk, lower=3.14159, upper=6.283185)

Sure, I have added the test and executed it locally. (commit 02af6e0)

julia> include("test\\hyperparam\\one_dimensional_ranges.jl")
Test Summary: | Pass  Total  Time
constructors  |   36     36  1.7s
Test Summary:                            | Pass  Total  Time
range constructors for nested parameters |    1      1  0.6s
Test Summary:       | Pass  Total  Time
Test Summary: | Pass  Total  Time
coverage      |    3      3  0.2s
true

Copy link
Member

@ablaom ablaom left a comment

Choose a reason for hiding this comment

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

Perfect.

Thanks @adarshpalaskar1 for your valuable contribution.

@ablaom ablaom merged commit 831abfa into JuliaAI:dev Feb 3, 2024
5 checks passed
@adarshpalaskar1
Copy link
Contributor Author

Thank you @ablaom for helping me through my beginner doubts; this was my first contribution. If there's anything specific I should keep in mind for future contributions, and if there are more issues where I can help, please point me in the right direction.

@ablaom
Copy link
Member

ablaom commented Feb 4, 2024

Maybe you'd like to take a stab at JuliaAI/MLJDecisionTreeInterface.jl#23 ?

@ablaom
Copy link
Member

ablaom commented Feb 4, 2024

You can find some decision tree examples at https://alan-turing-institute.github.io/MLJ.jl/dev/models/DecisionTreeClassifier_DecisionTree/#Examples .

Once we have that, you'd be in good shape to improve integration with TreePlots.jl.

@ablaom
Copy link
Member

ablaom commented Feb 5, 2024

Congratulations, by the way, on your first contribution 🎈

@adarshpalaskar1
Copy link
Contributor Author

You can find some decision tree examples at https://alan-turing-institute.github.io/MLJ.jl/dev/models/DecisionTreeClassifier_DecisionTree/#Examples .

Once we have that, you'd be in good shape to improve integration with TreePlots.jl.

Thank you! I'll check out the decision tree examples and proceed.

@ablaom ablaom mentioned this pull request Mar 1, 2024
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.

2 participants