Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Interpretation probabilistic network #122

Closed
MichielStock opened this issue Nov 12, 2018 · 4 comments
Closed

Interpretation probabilistic network #122

MichielStock opened this issue Nov 12, 2018 · 4 comments

Comments

@MichielStock
Copy link
Contributor

MichielStock commented Nov 12, 2018

This is related to the module information we are building. All methods related to information theory work on distributions, i.e. the adjacency or incidence matrix is transformed in a double stochastic matrix P, where all values are nonnegative and the sum to 1.

The data type ProbabilisticNetwork interprets every interaction however as a probability of a Bernoulli trial, i.e. the restriction is that all values are in [0, 1].

So, for the information theory, either:

  • we might consider a new data type StochasticNetwork, as in the first definition;
  • add a flag normalized to ProbabilisticNetwork, meaning that it satisfies the first definition
  • just let all the information theory indices work with binary, probabilistic and quantitative networks, and just normalize within the function.

Likely, the last option is the best, unless there is some more general reason to work with the representation as a distribution?

@tpoisot
Copy link
Member

tpoisot commented Nov 12, 2018

Well, it's a question I've been pondering for a long while, because it also ties into "neutral" networks, where the probability of an interaction is pi x pj where pi and pj are the relative species abundance, and so the sum of the matrix is 1 too.

The problem is that these are not really networks, or at least that these are not probability, and instead the entire matrix is a distribution.

As far as I can tell, this may be solved by using either Probabilistic or Quantitative networks, but it is important to do some checking internally. I would not add another type at this point, since we would need to make it fall within the type hierarchy (and it's not clear to me where it would fall).

@MichielStock
Copy link
Contributor Author

The discussion is also relevant in terms of the optimal transport stuff. I like to think of it as the fraction of the interactions (or energy) that species i takes from species j etc. The current interpretation is of course a different, but equally relevant, interpretation.

Currently, I wrote functions that take a double stochastic matrix as input to compute the indices, without performing checks. Then I wrapped a function that takes any subtype AbstractEcologicalNetwork, checks that all interactions are nonzero and normalizes it. For example

function entropy(P::AbstractArray)
    return - sum(P .* safelog.(P))
end

function make_joint_distribution(N::NT) where {NT<:AbstractEcologicalNetwork}
    (typeof(N) <: QuantitativeNetwork)  any(N.A .≥ 0) || throw(DomainError("Information only for nonnegative interaction values"))
    return N.A / sum(N.A)
end

function entropy(N::NT) where {NT<:AbstractEcologicalNetwork}
    P = make_joint_distribution(N)
    return entropy(P)
end

However, I think that a new subtype NormalizedQuantitativeNetwork (or something) is worth considering!

@tpoisot
Copy link
Member

tpoisot commented Nov 12, 2018

Can you make a few tests with a new type? I'm not strongly opposed to the idea if it makes the information theory things easier.

@MichielStock
Copy link
Contributor Author

MichielStock commented Nov 12, 2018 via email

@tpoisot tpoisot closed this as completed Jul 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants