-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
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 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.
ext/TransitionVisualizations.jl
Outdated
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 |
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.
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.
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.
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"
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
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.
@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
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 |
My answer above points out that I was missing the use of |
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 great!
Major changes
SlidingWindowResults
changed to one indicator = one row. Gives the following:SegmentedWindowResults
and gives the following:. 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!
SlidingWindowResults
andSegmentedWindowResults
rely on same functions so that maintenance easierMinors
tutorial.jl
adapted to make use of the new visualizationtutorial.jl
adapted to include segmented windows in the descriptionTITvisualization.jl
changed for less ambiguous nameTransitionVisualizations.jl