GithubHelp home page GithubHelp logo

IndexError about pypte HOT 3 CLOSED

Alaylm1016 avatar Alaylm1016 commented on June 12, 2024
IndexError

from pypte.

Comments (3)

patrk avatar patrk commented on June 12, 2024

Thank you for pointing out the potential "IndexError" in the compute_PTE function. I understand the concern about the non-square nature of P_y_x and the possibility of an index mismatch.

The current approach of using the .max() method to determine the size of the arrays might be a source of this error, especially when there's missing data in the sequences. I'll be looking into more reliable ways to set the array dimensions to avoid such indexing issues.

Regarding the delay estimation, while it's a broader concern, I'll take your feedback into consideration and evaluate its potential impact on the accuracy and reliability of the entire procedure.

To help me better diagnose and fix the issue, could you please provide some test data that reproduces the behavior you described?

from pypte.

patrk avatar patrk commented on June 12, 2024

a quick fix would be to ensure that the matrix P_y_x is square

max_dim = max(y.max(), x.max()) + 1
P_y_x = np.zeros([max_dim, max_dim])
np.add.at(P_y_x, [y, x], 1)

I cannot guarantee the correctness of the algorithm at the moment, though.

Checkout this branch: https://github.com/patrk/pyPTE/tree/12-indexerror where I applied this quick fix and let me know if it helps. #

from pypte.

patrk avatar patrk commented on June 12, 2024

I deem the fix as suitable after some testing and incorporated it in the recent refactoring.

from pypte.

Related Issues (17)

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.