What are the Pros and Cons of working before doing a PhD (in Machine Learning)?
I worked in industry for 3.5 years before starting my PhD. I believe I've been more successful because of this experience. However, there are advantages and disadvantages.

Pros:


You will be more mature and have a better idea of what you want in life (which may not include a PhD).
Better understanding of the needs of industry which can influence your research choices
Connections and business soft skills (being able to sell your research effectively is very important for example)
Often a better work ethic (ie. used to working regular hours, etc)


Cons:


It can be difficult to go back to being a student after making a real salary
Rusty study/exam writing skills
You will be older than your colleagues
If your goal is to remain in academia you may end up getting on the tenure track later with potential consequences for stability, starting a family, etc.
If your goal is to return to industry, the 5+ years of work experience you will miss out on is often worth more financially/promotion wise than a PhD (but this can be field dependent)
You will need to maintain connections with suitable academic references. As time goes forward they may not remember you very well. Strong references are important for getting accepted to top schools.


Many of these things will depend on what you do while in industry and what you want to get out of doing a PhD. 

My biggest piece of advice for time spent in industry: take care of the people part - make connections, work on networking, learn to be effective in meetings, learn to sell ideas/products, how to deliver for clients. Watch and learn from senior people (directors, CEOs, etc). These things will help you be successful in academia and business. Don't just sit at a desk coding.