Git Product home page Git Product logo

Comments (5)

ulupo avatar ulupo commented on June 3, 2024 2

But, I modified some weeks ago flagser library to better manages this arguments. Daniel already merged the changes.
I would prefer to make a PR integrating the new changes added in flagser, update the bindings, and we shall not encounter this issues in the future.

Go for it! Thanks :)

from pyflagser.

ulupo avatar ulupo commented on June 3, 2024

@gtauzin flagging this for your interest.

from pyflagser.

MonkeyBreaker avatar MonkeyBreaker commented on June 3, 2024

@ulupo thanks for reporting, I tried directly on flagser to see if it also encounter this interminable run.

With the following code, I added a print for the generated vertices and edges in function flagser_weighted::_extract_weighted_graph

#!/usr/bin/env python

import numpy as np
import pyflagser

x = np.random.random((5, 5))
np.fill_diagonal(x, 0.)
print(x)
pyflagser.flagser_weighted(x, coeff=3)

Intermediate print:

x = [[0.         0.84707679 0.18398522 0.96259247 0.54167621]
 [0.34772313 0.         0.97810088 0.72855808 0.27364796]
 [0.18882756 0.89481899 0.         0.52133444 0.17973438]
 [0.38915903 0.56670509 0.07425402 0.         0.60400914]
 [0.81306144 0.907335   0.23578294 0.27208927 0.        ]]
vertices = [0. 0. 0. 0. 0.]
edges = [[0.         1.         0.84707679]
 [0.         2.         0.18398522]
 [0.         3.         0.96259247]
 [0.         4.         0.54167621]
 [1.         0.         0.34772313]
 [1.         2.         0.97810088]
 [1.         3.         0.72855808]
 [1.         4.         0.27364796]
 [2.         0.         0.18882756]
 [2.         1.         0.89481899]
 [2.         3.         0.52133444]
 [2.         4.         0.17973438]
 [3.         0.         0.38915903]
 [3.         1.         0.56670509]
 [3.         2.         0.07425402]
 [3.         4.         0.60400914]
 [4.         0.         0.81306144]
 [4.         1.         0.907335  ]
 [4.         2.         0.23578294]
 [4.         3.         0.27208927]]

Then I created a file to pass it directly to flagser test.txt.
And then run flagser with coefficients enable:

./flagser-coefficients --out result_coeff_3.txt --modulus 3 --max-dim -1 --min-dim 0 --filtration max test.txt

The program finish almost instantly, you can check the result in result_coeff_3.txt

Seems that the issue is on pyflagser let me know if there's an error in my procedure, I'll investigate if there's an error with the bindings.

from pyflagser.

ulupo avatar ulupo commented on June 3, 2024

@MonkeyBreaker thank you! Indeed I do not think this issue has a mathematical basis, and since the C++ code is immune it must be about the bindings. Thanks for looking into this.

from pyflagser.

MonkeyBreaker avatar MonkeyBreaker commented on June 3, 2024

Okay, seems I found out the issue.

In the past, flagser manages options by command line arguments, and it forwards everywhere this arguments.
And of course, again, I failed on checking all possible functions that received a certain argument. I did not add test for different coeffthan 2, so I did not catch this.

The issue can be resolved by adding this in src/flagser_bindings.cpp starting at line 29:

// Passing coeff as a command line argument
std::string str_modulus = std::to_string(modulus);
named_arguments["modulus"] = str_modulus.c_str();

If it's urgent I can create a PR just for adding this + a test of course :).

But, I modified some weeks ago flagser library to better manages this arguments. Daniel already merged the changes.
I would prefer to make a PR integrating the new changes added in flagser, update the bindings, and we shall not encounter this issues in the future.

What do you think ?

from pyflagser.

Related Issues (20)

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.