-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Azadkia-Chatterjee coefficient (#385)
* reproducible test for chatterjee coefficient too * be explicit with keyword * Azadkia-Chatterjee coefficient * Fix tests * Fix header * Add missing reference * Show method * More tests based on the original paper
- Loading branch information
Showing
21 changed files
with
434 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name = "Associations" | |
uuid = "614afb3a-e278-4863-8805-9959372b9ec2" | ||
authors = ["Kristian Agasøster Haaga <[email protected]>", "Tor Einar Møller <[email protected]>", "George Datseris <[email protected]>"] | ||
repo = "https://github.com/kahaaga/Associations.jl.git" | ||
version = "4.1.0" | ||
version = "4.2.0" | ||
|
||
[deps] | ||
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/independence_tests/local_permutation/azadkia_chatterjee_coefficient.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function independence(test::LocalPermutationTest{<:AzadkiaChatterjeeCoefficient}, x::AbstractVector, y, z) | ||
est_or_measure, nshuffles = test.est_or_measure, test.nshuffles | ||
# Make sure that the measure is compatible with the input data. | ||
verify_number_of_inputs_vars(est_or_measure, 3) | ||
|
||
Y, Z = StateSpaceSet(y), StateSpaceSet(z) | ||
@assert length(x) == length(Y) == length(Z) | ||
Î = association(est_or_measure, x, Y, Z) | ||
Îs = permuted_Îs(x, Y, Z, est_or_measure, test) | ||
p = count(Î .<= Îs) / nshuffles | ||
return LocalPermutationTestResult(3, Î, Îs, p, nshuffles) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/independence_tests/surrogate/azadkia_chatterjee_coefficient.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function independence(test::SurrogateAssociationTest{<:AzadkiaChatterjeeCoefficient}, | ||
x::AbstractVector, y_and_possibly_z...) | ||
(; est_or_measure, rng, surrogate, nshuffles) = test | ||
|
||
# Create a new instance of the measure with pre-allocated values. We can then | ||
# re-use this struct to avoid excessive allocations. | ||
measure = AzadkiaChatterjeeCoefficient(x, y_and_possibly_z...; | ||
theiler = test.est_or_measure.theiler) | ||
|
||
Î = association(measure, x, y_and_possibly_z...) | ||
sx = surrogenerator(x, surrogate, rng) | ||
Îs = zeros(nshuffles) | ||
for b in 1:nshuffles | ||
Îs[b] = association(est_or_measure, sx(), y_and_possibly_z...) | ||
end | ||
p = count(Î .<= Îs) / nshuffles | ||
|
||
return SurrogateAssociationTestResult(1 + length(y_and_possibly_z), Î, Îs, p, nshuffles) | ||
end |
Oops, something went wrong.
27a2bb8
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.
@JuliaRegistrator register
27a2bb8
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.
Registration pull request created: JuliaRegistries/General/112378
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: