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

Fix for speeding up the execution #3

Open
BouncyButton opened this issue Apr 24, 2023 · 0 comments
Open

Fix for speeding up the execution #3

BouncyButton opened this issue Apr 24, 2023 · 0 comments

Comments

@BouncyButton
Copy link

BouncyButton commented Apr 24, 2023

Hi! Thank you for sharing your implementation of C4.5 (over 10 years ago!!)

I just wanted to point out a simple fix that can improve by order of magnitudes the runtime of the algorithm, in some datasets. I hope this will be useful for people like me that will find this repo in the future.

return {k: [v[i] for i in range(len(v)) if i in ind] for k, v in t.items()}

Here, it is useless to cycle over range and ind. You can simplify as follows:

return {k: [v[i] for i in ind] for k, v in t.items()}

On my machine, running the updated version on the mushroom UCI dataset takes <1s, while before it took about 50 seconds.

I plan to release a repository that will include your updated code. (hoping that's ok!)
Thanks!

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

No branches or pull requests

1 participant