JuliaDynamics / TransitionsInTimeseries.jl

Transition Indicators / Early Warning Signals / Regime Shifts / Change Point Detection
MIT License
18 stars 5 forks source link

Documentation with minimal example #19

Closed JanJereczek closed 1 year ago

JanJereczek commented 1 year ago

The built documentation is here: https://juliadynamics.github.io/TransitionIndicators.jl/previews/PR19/


Major changes:

Minor changes:

Datseris commented 1 year ago

can you please resolve the conflicts @JanJereczek ? (And please always ensure this is the case when you make a PR, otherwise CI doesn't run)

JanJereczek commented 1 year ago

Should be ok now! I will make sure there is no conflict in the future

Datseris commented 1 year ago

The built documentation is here: https://juliadynamics.github.io/TransitionIndicators.jl/previews/PR19/

which I'll read and give feedback about soon! I promise! Hopefully before monday!

Datseris commented 1 year ago

@JanJereczek thanks a lot for putting the effort into the docs. It looks good, but it also can get better.

Alright, here we go for the review:

the most important part I think is to re-write the tutorial so that it holds the hand of the user step by step all the way through.

Datseris commented 1 year ago

after the meeting: name SignificanceHyperParams is what we thought was best

JanJereczek commented 1 year ago

All comments have been embedded! Ready for review :)

This versions also includes the struct/function dispatch for RidgeRegression. I created FunctionalStruct <: Function as abstract type so that f(x::Vector, metric::Function)accepts such functions. Not sure it is the way to go though...

Datseris commented 1 year ago

The solution is to define

struct YourName <: Function
# .,,.,.,
end

you don't need the extra type hierarchy.

JanJereczek commented 1 year ago

Hahaha, I went rather for: why make things simple when you can make them complicated?

Thanks for the comment, it is now implemented without the introduction of a new type!

Datseris commented 1 year ago

@JanJereczek very important, read this: https://docs.julialang.org/en/v1/manual/style-guide/#Write-functions-with-argument-ordering-similar-to-Julia-Base

practically every function that accepts a function as an argument, this argument should be first, not second. Like in our ...(x, indicator, ...).

Datseris commented 1 year ago

@JanJereczek another very important thing. Stop declaring types. You only should declare types in case of new method definition or in case of mandatory subtyping. This means, you should be as general with your type delcerations as possible. If you can avoid declering a type in a function definition, then you should. If you can use a supertype, you should. Always prefer AbstractVector instead of Vector unless there is an absolutely specific reason to use Vector.

Datseris commented 1 year ago

(I am now workign intensively o nthe PR, please don't push anything)

Datseris commented 1 year ago

Another comment: the function is_equispaced violates the "do 1 thing rule". Its name also suggests that it should return a boolean only.

Datseris commented 1 year ago

Another comment: the way you have defined SignificanceHyperParams is problematic. The significance is tested with the surrogates and a significance test. The SignificanceHyperParams should have nothing to do with the creation of the indicator timeseries. This should be a completely independent step. The significance struct should have the wv_evolution_width stuff.

By the way, the names at the moment are incredibly hard to parse. What is "evolution_width" referring to...? It is very hard to understand that this is about the length of the "change" estimating function, that estimates how much an indicator changes.

Datseris commented 1 year ago

Alright, I will establish the following names:

The change metric timeseries is used to detect significant transitions.

JanJereczek commented 1 year ago

Hi George,

Thanks for all the detailed corrections and explanations! I'll let you finish what you are doing. When you're done let me know and I would gladly correct anything that still should be.

For the future: I'll read more code from JuliaDynamics packages to internalize better the best practices and hopefully reduce the time you spend on corrections!

Datseris commented 1 year ago

Another comment: don't leave TODO comments like "implem,ent lfps". Make them GitHub issues instead.