From 3997281255ad4a218fdba989e5730a3caa35f2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poisot?= Date: Tue, 27 Jun 2023 21:31:00 -0400 Subject: [PATCH] refactor: rm ported code --- _OLD/rand/linfilter.jl | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/_OLD/rand/linfilter.jl b/_OLD/rand/linfilter.jl index b0bb8ef9..0f220523 100644 --- a/_OLD/rand/linfilter.jl +++ b/_OLD/rand/linfilter.jl @@ -1,41 +1,3 @@ -""" - linearfilter(N::BinaryNetwork, α::Vector{Float64}=[0.25, 0.25, 0.25, 0.25]) - -Given a network `N` compute the linear filter scores according to Stock et al. -(2017). High scores for negative interactions indicate potential false negative -or missing interactions. Though this it returned as a probabilistic network, -score do not necessary convey a probabilistic interpretation. - -The values of α give the *relative* weight of, in order, the measured -interaction value, the out-degree of the species, the in-degree of the species, -and of network connectance. The default parameterization is to have all four at -equal importance. - -#### References - -Stock, M., Pahikkala, T., Airola, A., Waegeman, W., Baets, B.D., 2018. Algebraic -Shortcuts for Leave-One-Out Cross-Validation in Supervised Network Inference. -bioRxiv 242321. https://doi.org/10.1101/242321 - -Stock, M., Poisot, T., Waegeman, W., Baets, B.D., 2017. Linear filtering reveals -false negatives in species interaction data. Scientific Reports 7, 45908. -https://doi.org/10.1038/srep45908 -""" -function linearfilter(N::T; α::Vector{Float64}=fill(1.0, 4)) where {T <: BinaryNetwork} - @assert length(α) == 4 - @assert all(α .≥ 0.0) - α = α ./ sum(α) # This ensures that α sums to 1.0 - - # Get the new weights - W = α[1]N.edges .+ α[2]mean(N.edges; dims=2) .+ α[3]mean(N.edges; dims=1) .+ α[4]mean(N.edges) - - # Prepare a return object - return_type = T <: AbstractBipartiteNetwork ? BipartiteProbabilisticNetwork : UnipartiteProbabilisticNetwork - F = return_type(W, EcologicalNetworks._species_objects(N)...) - - return F -end - """ linearfilterzoo(N::BinaryNetwork, α::Vector{Float64}=[0.25, 0.25, 0.25, 0.25])