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

Improvement of the visualization code #68

Merged
merged 11 commits into from
Feb 2, 2024
Merged

Conversation

JanJereczek
Copy link
Contributor

Major changes

  • visualization of SlidingWindowResults changed to one indicator = one row. Gives the following:
    2024-01-24_18-58
  • visualization now supports SegmentedWindowResults and gives the following:
    2024-01-24_18-59. Note that the visualisation of the surrogate change metrics is a bit tricky here, since it is a single value per segment. Suggestions to improve the current solution (scatterplot) are welcome!
  • visualization for SlidingWindowResults and SegmentedWindowResults rely on same functions so that maintenance easier

Minors

  • tutorial.jl adapted to make use of the new visualization
  • tutorial.jl adapted to include segmented windows in the description
  • TITvisualization.jl changed for less ambiguous name TransitionVisualizations.jl
  • fix references in docs

Copy link
Member

@Datseris Datseris left a comment

Choose a reason for hiding this comment

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

looks very good, but i think we can simplify the internal code. i dont think we need a type that contains all this informatuon and you can return and use the figure dirctly.

docs/src/tutorial.jl Show resolved Hide resolved
Comment on lines 15 to 20
if res.config.change_metrics[i] isa PrecomputedRidgeRegressionSlope ||
res.config.change_metrics[i] isa RidgeRegressionSlope
push!(labels, "Regression slope")
else
push!(labels, string(nameof(res.config.change_metrics[i])))
end
Copy link
Member

Choose a reason for hiding this comment

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

This is not maintainable code. We can't afford to add an if clause for any particular change metric. Why is this important here, and why is not important for e.g. difference of means (which in my line of work is a much more freqquently used metric)?

We should have the same code everwhere with string name of. A user should be able to override a keyword andp provide a vector of strings as names.

Copy link
Contributor Author

@JanJereczek JanJereczek Feb 2, 2024

Choose a reason for hiding this comment

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

I agree with you that this is not well-maintainable code. Shorting the names of the regression indicators is however important because simply calling nameof(cha_metric) gives a very long string. This is now much improved by replacing the bit you highlighted by:

default_chametric_label(res::IndicatorsChangesResults) = [shortname(
    cha_metric) for cha_metric in res.config.change_metrics]

shortname(metric) = string(nameof(metric))
shortname(metric::PrecomputedRidgeRegressionSlope) = "Regression slope"
shortname(metric::RidgeRegressionSlope) = "Regression slope"

ext/TransitionVisualizations.jl Outdated Show resolved Hide resolved
ext/TransitionVisualizations.jl Show resolved Hide resolved
docs/src/tutorial.jl Outdated Show resolved Hide resolved
src/visualizations.jl Outdated Show resolved Hide resolved
src/visualizations.jl Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Feb 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (main@9943887). Click here to learn what that means.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #68   +/-   ##
=======================================
  Coverage        ?   45.22%           
=======================================
  Files           ?       17           
  Lines           ?      356           
  Branches        ?        0           
=======================================
  Hits            ?      161           
  Misses          ?      195           
  Partials        ?        0           

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

Copy link
Member

@Datseris Datseris left a comment

Choose a reason for hiding this comment

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

@JanJereczek I don't understand. WHy are we returning both the figure and the axis? didn't we agree that we only utilize the figure in every function and use content instead?

Here is how to access an axis from a figure with multiple axes per position:

julia> fig = Figure()

julia> ax1 = Axis(fig[1,1])
Axis with 0 plots:


julia> ax2 = Axis(fig[1,1])
Axis with 0 plots:

julia> contents(fig[1,1])
2-element Vector{Any}:
 Axis (0 plots)
 Axis (0 plots)

julia> contents(fig[1,1])[1] == ax1
true

@Datseris
Copy link
Member

Datseris commented Feb 2, 2024

also, please add a top-level codecov.yml file that ingores the files with plotting from the test coverage so that we don't get reports of low coverage, similar to here: https://github.com/JuliaDynamics/Attractors.jl/blob/main/codecov.yml

@JanJereczek
Copy link
Contributor Author

My answer above points out that I was missing the use of contents instead of content, which you did not comment. But ok, now it is implemented and should be looking good.

Copy link
Member

@Datseris Datseris left a comment

Choose a reason for hiding this comment

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

looks great!

@Datseris Datseris merged commit b1d3387 into main Feb 2, 2024
2 checks passed
@Datseris Datseris deleted the rowwise-visualization branch February 2, 2024 14:44
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.

3 participants