4

I am writing my Thesis in finance field and I am using Machine learning methods. Therefore, I wrote many Python and R scripts for collecting data, cleaning it and applying some statstics.

  1. should I reference my own code that I wrote? if yes can you please tell me how?
  2. should I reference all the libraries that I've used during my work?

Thanks

4 Answers 4

2

The standard way is to upload the code in a public repository so that everyone can use your code. In the thesis, you can refer to your repository in the footnote/endnote.

What you really need to cite is the papers/books which introduce the used methods first. The need to cite a library is when it has a specific configuration and it is likely that it outputs different result, such as the method which requires a probabilistic sampling. Here, the output will be different based on the used method.

Back to your case and responding to your questions:

  1. You can publish all the materials of your work in a public repository and refer to it by citing the link (preferably in the footnote). It is unprofessional to add the code in the appendix (unless it is short and in pseudo-code).
  2. You don't need to cite the libraries but the papers of the methods that are implemented in these libraries. If the library has a specific configuration, you can mention it in the text or cite the library (very rare cases).
6
  • 1
    Why is it unprofessional to add the code in the appendix?
    – user68958
    Sep 16, 2018 at 20:59
  • @corey979 Would you read the code? would you retype it? I am pretty sure that no one would do it. Maybe it used to happen in the past, but not with the existence of public repositories and other platforms. Usually, people add algorithms (and only when they are short and developed within the published work) but not programming codes.
    – Yacine
    Sep 16, 2018 at 21:04
  • Copy-paste from a .pdf shouldn't be a problem. But yes, I see that in the past it made more sense, and nowadays we have github. Still, I wouldn't call it unprofessional. And also adding a code snippet (say, 1 page long max) into the appendix might in some situations be justified, e.g. to demonstrate the interested reader (but not too interested) ways of practical implementation of a mathematical concept described in the text – maths and their computer realisations sometimes seem to be from different worlds. I think there might be an exception to every rule.
    – user68958
    Sep 16, 2018 at 21:35
  • @corey979 I don't agree that it is justified depending on the situation. I still cannot imagine a scenario where the prog. code is needed. If a pseudocode, yes it is justified (only under some circumstances). A prog. code needs more than just coding lines, rather other external info (e.g. vrsn of the prog. lang.). Also, prog. style differs from a scholar to another (Here, we are not talking about software developers) and in most of the cases, the code is understood mainly by its developer. For me, the justified situations are very limited and can be considered as outliers of the general case.
    – Yacine
    Sep 16, 2018 at 22:03
  • 1
    You should probably not append all you code, but some of the most important functions may be worth to be in the appendix. Rule of thumb: Put there the code, the reader may want to look at during reading your manuscript, so he can compare the description of the algorithms with the actual implementation.
    – allo
    Sep 18, 2018 at 9:35
1

As others mentioned already, publishing your code in a public repository and indicating the link in your thesis is standard practice nowadays. However you should talk to your supervisor first in order to confirm that there is no IP issue in doing so with your work (e.g. if you use a piece of code by somebody else in the team which is not under a free license).

Also you probably read a few Machine Learning papers when you developed your software; these papers can provide you with good examples of what you need to explain about your code in the thesis itself: not too much technical detail of course, but enough information so that a reader can understand the general method (and ideally reproduce it).

Some ML libraries ask users who publish work based on the library to cite a particular paper, this is usually indicated with the license of the library.

0

In a thesis, you can include your own code as an appendix. For standard libraries there is no need to cite them, but for other things it is a good idea to do so. This enables others to follow up on your work. If in doubt, give a citation.

If your code is too extensive to include, then you can post it to an archive and cite it there, though my preference would be to include it.

You could also cite your own code as unpublished work or work in progress, as appropriate. Anyone needing it would need to follow up with you personally, of course.

0

Your code is not your thesis. You are usually only required to publish the thesis. You may publish your code as well and mention it in your thesis, if you like to do so, though. If you use other (scientific) code and libraries, it is good to mention it, especially in sections which benchmark run-times and similar things.

There you should use the citation suggested on the homepage of the library, which sometimes refers to the source and often to papers which are implemented in the source. If there is no suggested citation, usually refering to the project with an URL is a sufficient solution. You may of course try to write a nice bibliography entry yourself for code that obviously deserves a proper citation, i.e. the authors actually wrote a new algorithm.

You must log in to answer this question.

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