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

Closed
ablaom opened this issue Oct 23, 2023 · 4 comments
Closed

Reduce sigdigits in parameter range display #948

ablaom opened this issue Oct 23, 2023 · 4 comments
Labels
easy good first issue Good for newcomers

Comments

@ablaom
Copy link
Member

ablaom commented Oct 23, 2023

julia> range(Float64, :junk, lower=sqrt(2), upper=sqrt(3))
NumericRange(1.4142135623730951  junk  1.7320508075688772; origin=1.5731321849709863, unit=0.15891862259789102)

I think 4 sigdigits is sufficient.

The display is defined here:

function Base.show(stream::IO,

@ablaom ablaom added good first issue Good for newcomers easy labels Oct 23, 2023
@adarshpalaskar1
Copy link
Contributor

Hello, can I work on this issue?

I think this change should work:

function _repr(r::NumericRange{T}, field) where T
value = getproperty(r, field)

#replacing line 34 with
value = round(getproperty(r, field), sigdigits=4)

New output:

julia> range(Float64, :junk, lower=sqrt(2), upper=sqrt(3))
NumericRange(1.414 ≤ junk ≤ 1.732; origin=1.573, unit=0.1589)

@ablaom
Copy link
Member Author

ablaom commented Jan 30, 2024

Looks good to me, thanks. PR welcome.

@ablaom
Copy link
Member Author

ablaom commented Jan 30, 2024

issue assigned to @adarshpalaskar1

adarshpalaskar1 added a commit to adarshpalaskar1/MLJBase.jl that referenced this issue Jan 30, 2024
This commit addresses issue JuliaAI#948 by updating the display of parameter ranges to include reduced significant digits.
adarshpalaskar1 added a commit to adarshpalaskar1/MLJBase.jl that referenced this issue Jan 31, 2024
This commit addresses issue JuliaAI#948 by updating the display of parameter ranges to include reduced significant digits.
ablaom added a commit that referenced this issue Feb 3, 2024
…-948

Reduce sigdigits in parameter range display #948
@ablaom
Copy link
Member Author

ablaom commented Feb 4, 2024

Closed by #958

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy good first issue Good for newcomers
Projects
Status: Done
Development

No branches or pull requests

2 participants