another master's degree or just single courses?
Given both of those stated goals, I would not pursue additional coursework to learn the material. Your current masters degree is likely good enough for either teaching or getting into a machine learning PhD program, and no degree is necessary for independent research. I would recommend that you use other resources to learn the material.



EDIT: Given that the question in the above link was deleted, I'm reproducing it here:


  There are many ways to learn new topics. Taking a university-level
  course is only one option. Other alternatives are:
  
  
  read textbooks
  online video tutorials (Khan academy, youtube)
  online pre-recorded lectures (e.g., iTunes U, but many, many others exist)
  talking to peers
  reading publications (for specialized topics)
  
  
  Taking a non-required university course is usually not the most
  optimal approach, for a number of reasons:
  
  
  You will spend a lot of time learning material not relevant to your problem, simply because it's part of the syllabus and the teacher
  found it interesting
  The requirement to pass will require you to spend likely (disproportionately too much) time doing homework, studying for tests,
  etc.
  It is very expensive
  
  
  This isn't to say that self-study doesn't require homework, or that
  learning topics not directly related to your research is a bad thing.
  I'm simply suggesting that by pursuing more self-directed learning
  opportunities you will be able to make better use of your time.