0

I am using Spyder and PyCharm. I would like to know if it is possible to debug on specific line? (Said Line 150)

Because I want to do machine learning, and because it takes a lot of time, I dont wat to repeat the training if I have problem on another line.

Thankyou

2
  • What do you want to achieve by debug? Spawn an interactive python shell? Or pause there and show the variables value in pycharm? The latter can easily be done in pycharm by setting breakpoints Commented Dec 19, 2019 at 14:05
  • Pycharm does not support back stepping yet but there is a thread for this How to go back and forth in debugging mode? Commented Dec 19, 2019 at 14:14

2 Answers 2

1

For machine learning I recommend using Jupyter notebook since it makes your programming and debugging tasks much more modular in the sense that you don't have to execute your full script every time but rather cells. Especially for data wrangling Jupyter notebook gives a much more structured overview. For debugging purposes, being able to run cells in any order works wonders.

Getting used to Jupyter is worthwhile especially if you are working with data science.

Sign up to request clarification or add additional context in comments.

4 Comments

I agree that for this use-case and data science in general Jupyter is a great tool for the job. Though part of me doesn't want to say that because most of the data scientists I work with rely to heavily on the fact that they can run cells in whatever order they want and object oriented goes out the window.
i myself am a part of that group of (datascientist), i rarely use an object oriented paradigm when working with data because of how Jupyter Notebook works. What pitfalls do you in your opinion believe i am prone to fall into by not working object oriented? My motivation for asking is my relatively inexperience in the field. feedback will be much appreciated.
@BillalNaseem It is harder to integrate your code into larger projects. If all you have is one large wall of code that needs to be put into some larger program or API than another developer will have to break it up into objects and functions that can be called in the right order. Similarly the code with have to be blocked into functions and objects to be properly tested in CICD pipelines. It also makes it more difficult to pull out small subsets of your code such as how you call/interact with your model (which is often needed to interact with your model via an API).
Noted, and thanks for the feedback! although terms like CICD pipelines are foreign to me I do see the need for a more structured approach to programming when working on larger projects and/or in groups. As of yet i have only been doing quick and dirty ad-hoc programming tasks that really is just a wall of code. I do plan on moving on to larger projects as it is being commended by my peers, why good programming conduct is a natural next step. I believe this is also why i feel like flask has a steep learning curve.
1

Yes, it's possible, but all the code before has to be executed before. Maybe we have a missunderstand with the "debug" word but this isn't the point. What you can do, is save the weights and architecture of the network, and load them instead of trainning all again, and then make your debug.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.