Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Euler characteristic + magnitude #606

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Conversation

@vadimlebovici
Copy link

Des retours sur #606

NB : "on" = "avec Olympio"

Documentation Python

URL

Rq : une remarque d'ordre général. Je trouve ce que tu as codé et décrit dans la doc plus clair et intuitif que ce que je propose ci-dessous. Cependant, il me semble que ce qui est ci-dessous a plus de sens mathématiquement (transformée intégrale de la courbe d'Euler). Je pense donc que c'est la meilleure chose à implémenter mais je suis vraiment prêt à changer d'avis.

euler()

1. fonctionnement. Si on suit la définition suivante de transformée :
image

fun est une primitive de k alors il faut pouvoir passer en argument deux réels M et fun_infty à la fonction euler() pour traiter le cas où k n'est pas intégrable sur [0,+\infty), i.e. quand fun n'est pas bien définie en +\infty. On pourrait imaginer un code qui renvoie:
image
et qui correspondrait au cas où fun(+\infty) = fun\_infty si M = None et sinon à prendre pour noyau *k * 1 _{(-\infty, M]}, si M est un réel. Ainsi, la magnitude correspond à fun=lambda x:-math.exp(-x), et on peut la calculer avec euler(fun, M = None, fun_infty = 0).

2. output. Je ne sais pas ce qui est préférable pour la complexité mais il me semble pratique - et c'est du moins comme ça qu'on l'a codé - de pouvoir entrer un noyau fun et avoir comme sortie une fonction T_{fun} : \R_{>0} -> \R plutôt qu'un nombre, que l'on peut du coup appeler sur un np.linspace(a,b,100), par exemple :

import numpy as np
import gudhi as gd
fun = lambda x:np.cos(x)
ht_range = np.linspace(0, 1000, 100)
st = gd.AlphaComplex(X).create_simplex_tree()
ht = get_ht(st, fun) 		# this is a lambda function

eval_ht = ht(ht_range) 		# which can be evaluated on a np.array

il me semble que ça éviterait d'avoir à recalculer la transformée pour chaque valeur t (?). Je ne sais pas si c'est habituel cependant d'avoir une fonction lambda en output.

3. nom : on a pour habitude de l'appeler plutôt hybrid_transform() en référence aux transformées hybrides (arxiv Vad) parce que c'est la restriction à la (multi-)persistence de ces trucs-là. Cependant, dans le cas de la (multi-)persistance, transformées hybrides = transformées intégrales classiques (à une petite renormalisation près), c'est donc un peu superflu et peut-être égocentré, mais on a pas trouvé mieux. Peut-être persistent_transform() ?

4. description : (A terme, j'imagine qu'on pourra citer le papier avec Olympio.)

Computes an integral transform of the Euler curve, i.e. a function of the positive real variable that has an Euler characteristic's flavour.

Parameters:

  • fun (Callable[[float], float]) – kernel of the transform.
  • M (float, default=None) - upper bound for integration. Value None corresponds to integrating over all real numbers.
  • fun_infty (float, default = 0) - value of fun at +infinity (used only if M is None).

Returns: The function that associates to any positive real t, the sum over all simplices of (-1)**d * (fun(t*M) - fun(t* f)) where f is the filtration of the simplex and d its dimension. The Euler characteristic corresponds to the case fun = lambda _:-1, M = None, fun_infty = 0 while magnitude uses fun = lambda x:-math.exp(-x), M = None, fun_infty=0.

Return type: (Callable[[float], float])

euler_characteristic()

RAS

magnitude()

RAS. Seul le point 2. ci-dessus peut avoir également sa place ici s'il est validé pour euler().

@mglisse mglisse marked this pull request as draft May 21, 2022 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants