Giter VIP home page Giter VIP logo

Comments (4)

ardaegeunlu avatar ardaegeunlu commented on June 13, 2024

Hi,

The error is caused because of the floating point division at the following line,
parent_i = (place_in_level + 1) / 2
The above line returns 1.5 in your case and it was supposed to return 1. I assume you are running the code on python 3.x so you can just change that line to,
parent_i = (place_in_level + 1) // 2
to fix it(making it so called 'integer division'). The problem is I wrote the code on python 2.7 and really did not really think about this back then.

You can check this thread for even more info.

I will go over the code to see if there are any more issues with regards to this case and do the updates.

from x-armed-bandits.

ardaegeunlu avatar ardaegeunlu commented on June 13, 2024

I went over the code and it looks like that was the only problematic division, thanks for pointing it out 🥇

from x-armed-bandits.

alocate avatar alocate commented on June 13, 2024

Hi,

awesome, this fixed it. I also thought it was this problem, my thinking was that two nodes with different "i" obviously need the same parent, so there should be a rounding somewhere.

from x-armed-bandits.

ardaegeunlu avatar ardaegeunlu commented on June 13, 2024

You are definitely right, I used integer division to utilize the floor round in it.

from x-armed-bandits.

Related Issues (3)

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.