#๐ Execution does not stop
14 messages ยท Page 1 of 1 (latest)
@strong linden
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
I implemented a logistic classification to work on MNIST
but execution either too slow or does not stop
I ran it for like 5 hours
Then like 45 minutes on Google Colab until my connexion got interrupted
Oh my... Consider using numpy for fast matrix operations instead of using python lists. Gradients calculation is literally triple nested for loop, so the bigger your size, this can get really really slow
Then I'd say to simplify it first on paper. What can you skip when calculating next step? Maybe formula for difference between two steps is simpler than re-calculating it from the start.
Also the loop with splitting a mini batch - you use two list comprehensions (2*size of the mini batch) to do transposition, while it can be done using zip if you don't need the inner thing to be list (it will be a tuple)
>>> a=[(1,2),(3,4),(5,6)]
>>> list(zip(*a))
[(1, 3, 5), (2, 4, 6)]
Like this
Idk but you are using 6 nested loops
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.