Coder Social home page Coder Social logo

causemap.jl's Introduction

CauseMap

CauseMap is an implementation of Convergent Cross Mapping (CCM), written in Julia.

CCM is a method for causal inference in non-linear dynamics systems.

For more information, feel free to check out the website!

causemap.jl's People

Contributors

cyrusmaher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

causemap.jl's Issues

Add tests

These are typically organized in the test/ directory. Besides your own tests, PackageEvaluator looks for a file named runtests.jl that lists the files in your test suite.

include("test1.jl")
include("test2.jl")

pyplot does not work

Hi, I have tried this with calling from python.
I got erorr:

plt not defined
while loading In[5], in expression starting on line 20

in makeoptimizationplots at /Users/wangjia/.julia/v0.3/CauseMap/src/plotting.jl:342
in anonymous at no file:22

even thought my pycal works with
using PyCall
@pyimport matplotlib.pyplot as plt

and plt.show()

But seems like the program does not work when calling matlab.

Any idea?

jia

Info about upcoming removal of packages in the General registry

As described in https://discourse.julialang.org/t/ann-plans-for-removing-packages-that-do-not-yet-support-1-0-from-the-general-registry/ we are planning on removing packages that do not support 1.0 from the General registry. This package has been detected to not support 1.0 and is thus slated to be removed. The removal of packages from the registry will happen approximately a month after this issue is open.

To transition to the new Pkg system using Project.toml, see https://github.com/JuliaRegistries/Registrator.jl#transitioning-from-require-to-projecttoml.
To then tag a new version of the package, see https://github.com/JuliaRegistries/Registrator.jl#via-the-github-app.

If you believe this package has erroneously been detected as not supporting 1.0 or have any other questions, don't hesitate to discuss it here or in the thread linked at the top of this post.

Differences between `optandcalcCCM` and `makeoptimizationplots`

Hi,

I've been trying to use your library, which I think can be extremely useful. I would like to access the actual results from the calculations (rather than just get the plots using makeoptimizationplots as you describe in the manual), and from your code it seems like this would be done by optandcalcCCM. As I was getting very different results using each function, I went into the source code. There seem to be two differences in how the results are calculated, which makes me suspect one of them can be a bug.

  1. The following code in optandcalcCCM:
libsizemin_12 = max(res12["E"] + b_offset + 1, libsizemin)
libsizemin_21 = max(res21["E"] + b_offset + 1, libsizemin)

corresponds, in makeoptimizationplots, to:

libsizemin_12 = max(res12["E"] + b_offset + 1, 10)
libsizemin_21 = max(res21["E"] + b_offset + 1, 10)

which I suspect might not be desired.

  1. When calling calcCCM in makeoptimizationplots, you set a parameter lib_start=1, which is not done in the corresponding calls in optandcalcCCM.

tau_p

Hi, I have the following error with the example "CCM_example_para_didi.jl"

starting calcCCM1
starting calcCCM2
ERROR: tau_p not defined
in makeoptimizationplots at C:\Users\Jorge.julia\v0.2\CauseMap\src\CauseMap.jl
:642
WARNING: backtraces on your platform are often misleading or partially incorrect
at C:\Users\Jorge.julia\v0.2\CauseMap\examples\CCM_example_para_didi.jl:21

I'm using Julia V.0.2 x64.

Thanks for the help.

Best regards,

Jorge

ERROR: UndefVarError: calcCCM not defined

Hi,
I have been trying to run the example script "CCM_example_para_didi" from CauseMap, by executing the code line by line:
while running the command
" makeoptimizationplots(para, didi,E_vals, tau_s_vals, tau_p_vals,"Para.", "Didi.";nreps=10, eft_E=2, left_tau_p=0, # optional right_E=7, right_tau_p=12, lagunit=.5, unit="days", show_tau_s=false # optional )"

I am getting the following error:

Calculating manifolds

CoordDescent opt1
ERROR: UndefVarError: calcCCM not defined
in CoordDescentOpt at C:\Users\User.julia\v0.4\CauseMap\src\coord_descent_tuning.jl:44
in CoordDescentOpt at C:\Users\User.julia\v0.4\CauseMap\src\coord_descent_tuning.jl:12
in makeoptimizationplots at C:\Users\User.julia\v0.4\CauseMap\src\plotting.jl:76

BUT
i found the function "calcCCM" to be exported in line 9 of causemap.jl and the corresponding function defined in line 311 of the same file.

The only difference i could find is:
var1 and var2 are defined as "var1::AbstractVector, var2::AbstractVector," in line 311 of causemap
whereas
in line 44 of "coord_descent_tuning.jl"
they are passed as " librange, res12 = calcCCM(source_series, target_series, "
in line30 of the same file the function CoordDescentOpt they are defined as
"function _CoordDescentOpt(source_series::Vector{Float64}, target_series::Vector{Float64}, ......."

I could not figure out whether this is the reason for the error or rather how to overcome this error.
(I am using julia Version 0.4.5 (2016-03-18 00:58 UTC)
/ |'|||'| | Official http://julialang.org/ release
|_/ | x86_64-w64-mingw32)
and windows 10; 64bit

Please help
thanks in advance

[PkgEval] CauseMap may have a testing issue on Julia 0.4 (2014-10-08)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.4

  • On 2014-10-05 the testing status was Tests pass.
  • On 2014-10-08 the testing status changed to Package doesn't load.

Tests pass. means that PackageEvaluator found the tests for your package, executed them, and they all passed.

Package doesn't load. means that PackageEvaluator did not find tests for your package. Additionally, trying to load your package with using failed.

Special message from @IainNZ: This change may be due to breaking changes to Dict in JuliaLang/julia#8521

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("CauseMap")' log
INFO: Installing CauseMap v0.0.1
INFO: Installing PyCall v0.4.9
INFO: Package database updated

>>> 'using CauseMap' log

WARNING: deprecated syntax "{a=>b, ...}" at /home/idunning/pkgtest/.julia/v0.4/CauseMap/src/CauseMap.jl:465.
Use "Dict{Any,Any}(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/CauseMap/src/CauseMap.jl:469.
Use "Dict(a=>b, ...)" instead.

WARNING: deprecated syntax "[a=>b, ...]" at /home/idunning/pkgtest/.julia/v0.4/CauseMap/src/CauseMap.jl:471.
Use "Dict(a=>b, ...)" instead.
Julia Version 0.4.0-dev+998
Commit e24fac0 (2014-10-07 22:02 UTC)
Platform Info:
  System: Linux (x86_64-unknown-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

ERROR: syntax: missing last argument in "1:2:" range expression 
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at ./loading.jl:152
 in _require at ./loading.jl:67
 in require at ./loading.jl:52
 in require_3B_3964 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so
 in include at ./boot.jl:245
 in include_from_node1 at loading.jl:128
 in process_options at ./client.jl:293
 in _start at ./client.jl:362
 in _start_3B_3789 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so
while loading /home/idunning/pkgtest/.julia/v0.4/CauseMap/src/CauseMap.jl, in expression starting on line 689
while loading /home/idunning/pkgtest/.julia/v0.4/CauseMap/testusing.jl, in expression starting on line 2

>>> test log
no tests to run
>>> end of log

CCM finds causal link between two random walks

Looks like CCM finds spurious causal links in random data.

using CauseMap

# specify parameter ranges to test over
E_vals     = 2:10  # range to test of system dimensionality
tau_s_vals = 1:1 # range for lag length for manifold reconstruction
tau_p_vals = 0:15  # range to test for time lag of causal effect

random1 = cumsum(randn(100))
random2 = cumsum(randn(100))

# run analysis
makeoptimizationplots(random1, random2,  
                                        E_vals, tau_s_vals, tau_p_vals, 
                                        "random1", "random2"; 
                                        nreps=10, left_E=2, left_tau_p=0,   # optional 
                                        right_E=7, right_tau_p=12, lagunit=.5, # optional
                                        unit="days", show_tau_s=false # optional
                                    )

Both series random1 and random2 are entirely random and independent, but the output suggests there are causal effects both ways.

random

I think this is not an implementation fault, but rather a shortcoming of the CCM method itself. Posting it here for reference.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.