I am new in the field of research and am trying to publish my first paper.

I am working on improving a paper that involves Machine Learning. However, in order to make changes to it, wouldn't I need to implement it? Does this require that I implement the paper in my own way and not use their code at all? Do authors usually publish their code along with the paper?

  • 1
    Perhaps they explain the algorithm and leave you to implement that - especially as you may or may not have the same version of software...
    – Solar Mike
    Nov 25, 2019 at 7:12
  • is it frowned upon to ask someone for their code? Nov 25, 2019 at 9:23

2 Answers 2


Even though journals encourage authors to publish their code and make their research easily reproducible, in some fields most authors do not publish their code.

In many cases, publishing code is plenty of extra work with little immediate benefit, as one would have to comment it/improve readability and check all licensing requirements of possibly reused snippets. There is often little motivation to do all this extra work on code that is anyway evolving in the middle of a project. In addition, publishing your code takes away your head start and enables the whole world to beat you to your own "future work" plans, so people might tend to only publish code when a project is finished.

This unfortunately means that you often have to implement state-of-the-art algorithms to be able to improve them or prove that you can beat them. Ideally, the algorithm is completely and unambiguously explained in the paper, so you should be able to implement it. Practically, this is not always the case, but you can always contact the corresponding author of the paper and ask for clarification. There is a reason why most articles include contact information of the corresponding author.

  • 3
    I'd like to add that one shouldn't attribute not publishing the code to malice or trying to maintain a head-start. It's just additional work that has no immediate benefit for graduating (for PhD students), and often code quality of research prototypes is low, meaning that person writing it may not want to show this to the world without a need. Also, publishing would require to look up the licences of all snippets used. Luckily, publishing code is likely to increase citation counts, which is a benefit (not mentioning intrinsic motivation to do science properly).
    – DCTLib
    Nov 25, 2019 at 9:13
  • 1
    @DCTLib I tried to write as neutrally as possible, without implying malice (after all, I do not consider myself malicious ;) ). I added your comment to the answer.
    – wimi
    Nov 25, 2019 at 9:26

You can consider reaching out to the authors of the paper, and asking them if they can provide you personally with the code, since you want to use their work as a benchmark. Being used as a benchmark is a good thing, so the authors are quite likely to be happy about such a request.

When I did my MSc thesis, code quality was not an evaluation criterion. I developed a new algorithm and published a paper about it, but the implementation was basically 35 Matlab files loosely sellotaped together. This is not code that I would like to publish in any form. At some point, however, a group of researchers from another country reached out to me, asking if they could have my code for benchmarking purposes. I sent them the files, they wrote a nice paper, my paper got cited, everybody won!

Your mileage may vary, of course. But it can't hurt to just shoot them an email.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .