<p>This is a subtle issue, and I think you have it right, but it will always be tricky in practice.  My own guideline for what is on-topic is (conceptually) straightforward:  <em>What does the OP need explained?</em>  If what they don't know / misunderstand is something about how the code works (e.g., in that language), then this is ultimately a programming question and should be considered off-topic here (but it is potentially on topic on <a href="https://stackoverflow.com/">Stack Overflow</a>).  On the other hand, if what they don't understand is a topic in machine learning (statistics, etc.), then the question is on-topic here.  </p>

<p>There are a few difficulties in practice, though.  One is that it can be hard for someone to read a thread and recognize that the real issue is a conceptual misunderstanding.  This will be true if your background is in, say, statistics and the question is about a machine learning topic with which you aren't very familiar (e.g., neural networks).  It will be even more true if the question is only / primarily stated in code you don't read.  I sometimes worry that we are liable to close threads that we should answer because the users in the close vote queue are unfamiliar with the topic / language.  For example, we seem to have better coverage of statistics than machine learning among our active users on CV.  Something you can do, if you come across such a case, is to leave a comment that this appears to be an on-topic machine learning issue, not actually about the code.  You might also prompt the OP to explain their question more clearly and in a software-neutral way.  Indeed, when I am faced with such a thread in the close vote queue, I look for a comment from a user who I know has expertise on the topic / language, and/or try to see if any have voted to close or leave open.  </p>

<p>Another issue is what to do if a question is based on several misunderstandings that constitute a mixture of conceptual and programming issues.  In this case, the thread should be considered on-topic due to the existence of issues we should address.  It is perfectly fine to not address the programming issues (or <em>to</em> do so) as answerers choose.  It would presumably be most helpful to the OP to point out that those topics should be asked on SO, though.  </p>
