
返回原文英文原文:How to implement an algorithm from a scientific paper
This article is a short guide to implementing an algorithm from a scientific paper. I have implemented many complex algorithms from books and scientific publications, and this article sums up what I have learned while searching, reading, coding and debugging. This is obviously limited to publications in domains related to the field of Computer Science. Nevertheless, you should be able to apply the guidelines and good practices presented below to any kind of paper or implementation.
1 – Before you jump in
| There are a few points you should review before you jump into reading a technical paper and implementing it. Make sure you cover them carefully each time you are about to start working on such a project. | 译者信息 译者信息 Grisson 翻译于 1年前 0人 顶 此译文 这是一篇关于如何实现科研论文中算法的简要指南。作者曾实现过很多书本上和科研论文中的复杂算法,在这篇文章中作者总结他在研究,阅读,编码和调试时积累的大量经验。很显然,这篇文章主要集中在和计算机科学相关的研究领域中。 然而,你也可以在其他任何领域的论文中使用下面提及的准则。 1. – 开始之前 在你开始阅读一篇论文和实现它之前,有几个你需要注意的地方。并请确保每次你要开始类似的项目之前,都仔细的注意过这几个方面。 | ||
| 1.1 – Find an open source implementation to avoid coding it Unless you want to implement the paper for the purpose of learning more about the field, you have no need to implement it. Indeed, what you want is not coding the paper, but just the code that implements the paper. So before you start anything, you should spend a couple of days trying to find an open source implementation on the internet. Just think about it: would you rather lose two days looking for the code, or waste two months implementing an algorithm that was already available? 1.2 – Find simpler ways to achieve your goal Ask yourself what you are trying to do, and if simpler solutions would work for what you need. Could you use another technique – even if the result is only 80% of what you want – that does not require to implement the paper, and that you could get running within the next two days or so with available open source libraries? For more regarding this, see my article The 20 / 80 Productivity Rule. | 译者信息 译者信息 Grisson 翻译于 1年前 0人 顶 此译文 1.1 – 看看是不是已经有开源软件实现过 除非你是为了纯粹的学习目的而去实现一篇文论中的算法, 否则你不必一定要实现它。实际上,你所需要的不是自己去实现它的过程,而是已经实现了这个算法的代码。所以在你开始编码之前,你应该花一些时间去找找网上是不是已经有实现了这个算法的开源软件。想想你是愿意花两天时间去找到已经完成的代码,还是浪费两个月的时间去实现一个别人已经实现的了算法呢? 1.2 – 用最简单的方法达到你的目的 你要先搞清楚你想要达到的目标是什么,以及是不是有简单的方法已经可以达到你的目标。 或许你可以尝试使用另外的技术,即使它只能达到你80%的目标,但它不需要你去实现一篇论文。然后你可以再花几天的时间去尝试是不是可以用开源软件运行起来。关于这个更多的详情,请参考我的另外一篇文章 The 20 / 80 Productivity Rule. | ||
| 1.3 – Beware of software patents If you are in the U.S., beware of software patents. Some papers are patented and you could get into trouble for using them in commercial applications. 1.4 – Learn more about the field of the paper If you are reading a paper about the use of Support Vector Machines (SVM) in the context of Computational Neuroscience, then you should read a short introduction to Machine Learning and the different types of classifiers that could be alternatives to SVM, and you should as well read general articles about Computational Neuroscience to know what is being done in research right now. 1.5 – Stay motivated If you have never implemented a paper and/or if you are new to the domain of the paper, then the reading can be very difficult. Whatever happens, do not let the amount and the complexity of the mathematical equations discourage you. Moreover, speed is not an issue: even if you feel that you understand the paper slower than you wish you would, just keep on working, and you will see that you will slowly and steadily understand the concepts presented in the paper, and pass all difficulties one after the other. | 译者信息 译者信息 Grisson 翻译于 1年前 0人 顶 此译文 其它翻译版本:1(点击译者名切换) IdleMan 1.3 – 注意软件的专利 如果你再美国, 你需要注意软件的专利问题。有一些论文是注册了专利的,你可能因为在商业软件中使用了它的算法而惹上麻烦。 1.4 – 关注更多该领域的论文 如果你正在研究一篇关于在计算神经学领域中使用支持向量机(SVM)的论文的话,那你应该再读一些关于机器学习以及其他可替代支持向量机(SVM)的分类算法的介绍。同时,你还可以读一些关于计算神经学领域的文章,看看学术界正在研究什么. 1.5 – 保持积极性 如果你还没有实现过一篇论文或你正在研究一个新领域内的论文,这样的阅读研究是很困难的。不管发生什么,不要让那些复杂的数学公式吓到你。而且,不要去担心进度的问题,即使你感觉理解这篇论文要比你预计的要慢很多, 坚持做下去你会发现你慢慢的就理解了这篇论文中所要表述的概念。 | 译者信息 译者信息 IdleMan 翻译于 1年前 0人 顶 此译文 其它翻译版本:1(点击译者名切换) Grisson 1.3 – 注意专利权 如果你在美国,请注意专利权.一些论文需要专利授权后才能用于商业应用程序,否则会给你带来麻烦 1.4 –了解与论文主题相关或类似的知识 如果你正在阅读的是一篇关于神经信息学背景下的支持向量机(SVM),你可以阅读一些关于机器学习或者其他能够代替支持向量机的文章,当然,也可以直接阅读神经信息学方面的文章了解其问题研究的方向。 1.5 – Stay motivated 如果你从未实现过论文算法或者对论文所涉及的领域陌生,可能很难理解论文的内容. 但无论如何,都不要让复杂繁多的数学公式阻碍你继续阅读. 也不要为阅读速度比预期慢而赶到沮丧,只要坚持并一个概率一个概率地理解和消化,终会全部掌握论文中的知识 | |
| 2 – Three kinds of papers It is never a good idea to pick a random paper and start implementing in right away. There are a lot of papers out there, which means there is a lot of garbage. All publications can fit into three categories: 2.1 – The groundbreaking paper Some really interesting, well-written, and original research. Most of these papers are coming out of top-tier universities, or out of research teams in smaller universities that have been tackling the problem for about six to ten years. The later is easy to spot: they reference their own publications in the papers, showing that they have been on the problem for some time now, and that they base their new work on a proven record of publications. Also, the groundbreaking papers are generally published in the best journals in the field. | 译者信息 译者信息 Grisson 翻译于 1年前 0人 顶 此译文 2 – 三种类型的论文 随便选一篇论文,马上开始实现绝对不是一个好注意. 世界上有很多很多的论文,这也意味着有很多很多的垃圾论文。所以发表的论文可以分成三类。 2.1 – 创新型论文 这是一些非常有趣的,写的很好的,原创性的论文。大部分这类论文来自世界顶尖大学或者是已经研究某个领域很久的小学校的研究团队。后者很好区分,他们往往都在自己论文中引用自己之前的研究成果,已展示他们对这个问题的研究已经很长时间了, 而且他们最新的研究工作都是基于已经证实了的论文之上。 同时,这类型的论文基本都在该领域内最好的期刊杂志上发表。 | ||
| 2.2 – The copycat paper Some research group that is just following the work of the groundbreaking teams, proposing improvements to it, and publishing their results of the improvements. Many of these papers lack proper statistical analysis and wrongly conclude that the improvements are really beating the original algorithm. Most of the time, they really are not bringing anything except for unnecessary additional complexity. But not all copycats are bad. Some are good, but it’s rare. 2.3 – The garbage paper Some researchers really don’t know what they are doing and/or are evil. They just try to maintain their status and privileges in the academic institution at which they teach. So they need funding, and for that they need to publish, something, anything. The honest ones will tell you in the conclusion that they failed and that the results are accurate only N% of the time (with N being a bad value). But some evil ones will lie, and say that their research was a great success. After some time reading publications, it becomes easy to spot the garbage paper and ditch them. | 译者信息 译者信息 hexleo 翻译于 1年前 0人 顶 此译文 2.2-模仿型论文 一些研究群体仅仅只是跟随哪些有突破性创新的团体,他们的目的就是提高已经发表的论文(算法),并且发表他们提高后的结果。很多这样的论文缺少合适的统计分析和错误的结论,这样的提高其实是破坏了原有的算法。很多时候,他们这样做并没有带来任何东西,除了带来不必要与而外的复杂性。但也并不是所有的模仿是不好的,有些还是不错的,但却很稀少。 2.3-垃圾型论文 一些研究者并不知道他们做的事情是非常不好的。他们仅仅是为了维持他们在自己学术领域中的状态与。所以他们需要资金,并且他们需要出版任何他们需要的东西。比较诚实的研究者会告诉你,在结论中他们失败了,在结果中只有N%的时间(N是有比较差的值)。但一些心怀不轨的研究员会说谎话,他们会说他们的研究取得了巨大的成功。在阅读出版物一段时间以后,很容易就能发现那些垃圾型论文,并抛弃他们。 | ||
| 3 – How to read a scientific paper A lot has already been written on the topic, so I am not going to write much about it. A good starting point is: How to Read a Paper by Srinivasan Keshav. Below are a few points that I found useful while I was reading scientific publications. 3.1 – Find the right paper What you want to implement is an original paper, one that started a whole domain. It is sometimes okay to pick a copycat paper, if you feel that it brings real improvements and consistency to a good but immature groundbreaking paper. So let’s say you have a paper as your starting point. You need to do some research in its surroundings. For that, the strategy is to look for related publications, and for the publications being listed in the “References” section at the end of the paper. Go on Google Scholar and search for the titles and the authors. Does any of the papers you found do a better job than the paper you had originally? If yes, then just ditch the paper you were looking at in the first place, and keep the new one you found. Another cool feature of Google Scholar is that you can find papers that cite a given paper. This is really great, because all you have to do is to follow the chain of citations from one paper to the next, and you will find the most recent papers in the field. Finding the good paper from a starting point is all about looking for papers being cited by the current paper, and for papers citing the current paper. By moving back and forth in time you should find the paper that is both of high quality and fits your needs. Important: note that at this stage of simple exploration and reckoning, you should not be reading and fully understand the papers. This search for the right paper should be done just by skimming over the papers and using your instinct to detect the garbage (this comes with experience). | 译者信息 译者信息 你还未够水准呢 翻译于 1年前 0人 顶 此译文 3-如何阅读科技论文 这个话题已经讨论过很多次,因此不打算继续写很多关于这个问题的探讨。一个好的出发点可以参见这篇文章:How to Read a Paper ,下面的一些观点是我在阅读科技论文时候发现的有用的观点。 3.1-找到正确的论文 原始论文就是你想实现的是什么,描述的是这个领域的开端。有时候也可以选择相似的论文,前提是你觉得这篇论文是能带来算法上本质的提升并且有良好的一致性却不成熟的创新的文章。 那么让我告诉你以该论文作为出发点。你需要在该论文相关领域做些研究。对此,方法就是寻找相关联的论文,即是那些在该论文引用部分里面所提到的论文。再去Google Scholar依据论文题目和作者搜索。你找到的论文是否比你现在看的论文所做的效果更好呢?如果是,那么就去研究找到的新论文。Google Scholar还有个优点就是能标注论文的引用。这个非常棒,因为你能从一篇论文的引用链接找到另外的论文,这样可以找到某个研究领域最新的成果。总体来说就是从当前论文的引用中寻找新的论文。通过这样来回搜索,就会找到适合你的高质量的论文。 重点:在这个搜索论文过程中,你不需要从头到尾仔细阅读理解论文。只需要大体浏览论文并用你的直觉去判断论文的价值。 | ||
| 3.2 – Do not read on the screen Print the publication on hard paper and read the paper version. Also, do not reduce the size in order to print more on each page. Yes, you will save three sheets of paper, but you will lose time as you will get tired faster reading these tiny characters. Good font size for reading is between 11 and 13 points. 3.3 – Good timing and location Do not read a paper in the middle of the night, do it at a moment of the day when your brain is still fresh. Also, find a quiet area, and use good lighting. When I read, I have a desk lamp pointing directly at the document. 3.4 – Marker and notes Highlight the important information with a marker, and take notes in the margin of whatever idea that pops in your head as you read. | 译者信息 译者信息 IdleMan 翻译于 1年前 0人 顶 此译文 3.2 – 不要在屏幕上阅读 打印成纸质阅读,打印时不要降低字体大小,如果你降低了字体大小可能节省了几页纸却使你在阅读时因为眼睛更易疲劳而浪费了更多的时间,字体大小一般建议在11pt-13pt 3.3 –选择恰当的阅读时间和地点 不要在半夜阅读,最好在大脑清醒时才阅读.也应该找一个安静、光线适中的地方。我通常都在台灯下阅读。 3.4 – 注意标记和备注 标记重要信息,并在重要信息旁写下阅读时脑袋中浮现的各种想法。 | ||
| 3.5 – Know the definitions of all the terms When you are used to read mostly news articles and fiction, your brain is trained to fill-in meaning for words that you do not know, by using context as a deduction device. Reading scientific publications is a different exercise, and one of the biggest mistake is to assume false meaning for a word. For instance in this sentence “The results of this segmentation approach still suffer from blurring artifacts”. Here two words, “segmentation”, and “artifacts”, have a general meaning in English, but also have a particular meaning in the domain of Computer Vision. If you do not know that these words have a particular meaning in this paper, then while reading without paying attention, your brain will fill-in the general meaning, and you might be missing some very important information. Therefore you must (i) avoid assumptions about words, and whenever in doubt look up the word in the context of the domain the publication was written, and (ii) write a glossary on a piece of paper of all the concepts and vocabulary specific to the publication that you did not know before. If you encounter for the first time concepts such as “faducial points” and “piece-wise affine transform”, then you should look-up their precise definitions and write them down in your glossary. Concepts are language-enabled brain shortcuts, and allow you to understand the intent of the authors faster. | 译者信息 译者信息 mr.questionmark 翻译于 1年前 0人 顶 此译文 3.5 知道所有术语的定义 通常你阅读大多数文章和小说时,对于生词你的大脑会象计算机一样根据上下文自动得出意思。但是科技出版物完全不同,其中最多的错误就是单词意思的错误假设。比如说句子“The results of this segmentation approach still suffer from blurring artifacts”中“segmentation”和“artifacts”通常有着“分割”和“手工品”的意思,但是在计算机视觉领域有着特殊的意思。如果你阅读这篇论文时没有注意这个,你的大脑用了他们的通常意义去理解,你会漏掉很重要的信息。因此你必须(1)避免假设单词的意思,任何时候有疑问需查阅专业词典(2)抄写一张你不熟悉的专业生词概念表做参考。如果你遇到概念比如“faducial points”和“piece-wise affine transform”,首先你应该查出他们的准确的专业含义,然后加在你的生词表里。概念是语言式的大脑快捷键可以帮助你更快理解作者的意图。 | ||
| 3.6 – Look for statistical analysis in the conclusion If the authors present only one curve from their algorithm and one curve from another algorithm, and say “look, it’s 20% more accurate”, then you know you’re reading garbage. What you want to read is: “Over a testing set of N instances, our algorithm shows significant improvement with a p-value of 5% using a two-sample t-test.” The use of statistical analysis shows a minimum of driving from the author, and is a good proof that the results can be trusted for generalization (unless the authors lied to make their results look more sexy, which can always happen). 3.7 – Make sure the conclusions are demonstrating that the paper is doing what you need Let’s say you want an algorithm that can find any face in a picture. The authors of the paper say in the conclusion that their model was trained using 10 poses from 80 different people (10 x 80 = 800 pictures), and that the accuracy of face detection with the training set was 98%, but was only 70% with the testing set (picture not used during training). What does this mean? This means that apparently, the algorithm has issues to generalize properly. It performs well when used on the training set (which is useless), and perform worse when used in real-world cases. What you should conclude at this point is that maybe, this paper is not good enough for what you need. | 译者信息 译者信息 IdleMan 翻译于 1年前 0人 顶 此译文 3.6 – 关注结论中的统计分析 如果论文作者仅仅用曲线展示他的算法和其他算法的差异,并且说“你看,比原有算法准确了20%”,这种论文就一垃圾论文. 你应该阅读的是那种在论文中说: “在N个实例的测试集中,我们的算法在两个样本测试中检验值提升了5%(这句真不好翻译)” 统计结论更多的证据应该来自数据而不是作者的个人想法 (除非作者撒谎夸大他的结论). 3.7 – 请确定论文所展示的结论是你所需要的 假设你需要一个能够从图片中人脸识别的算法.作者在论文结论中说他的模型用80个人不同照片(10x 80 = 800张图片)进行训练, 对训练集进行测试时人脸识别准确率达到98%,但是对测试集(测试的图片没有被用于训练集)进行人脸识别时准确率只有70%。这样的描述是什么意思呢?它以意味着该算法仍然存在问题(这句真不好翻译)——该算法当用于对训练集进行识别时是非常不错的(但种情况没有任何实际意义),但是用于对测试集进行识别时就会非常糟糕。你也可以通过这点,来判断一篇论文是否是你所需的 | ||
| 3.8 – Pay attention to the input data used by the authors If you want to perform face detection with a webcam, and the authors have used pictures taken with a high-definition camera, then there are chances that the algorithm will not perform as well in your case as it did for the authors. Make sure that the algorithm was tested on data similar to yours or you will end up with a great implementation that is completely unusable in your real-world setup. 3.9 – Authors are humans The authors are humans, and therefore they make mistakes. Do not assume that the authors are absolutely right, and in case an equation is really hard to understand or follow, you should ask yourself whether or not the authors made a mistake there. This could just be a typo in the paper, or an error in the maths. Either case, the best way to find out is to roll out the equations yourself, and try to verify their results. | 译者信息 译者信息 mr.questionmark 翻译于 1年前 0人 顶 此译文 3.8 注意作者用的输入数据 如果你想用网络摄像头做脸部识别,而作者的输入数据用的是出自高清相机的相片,那么算法结果可能会完全不同。必须保证你的输入数据近似与算法测试数据,否则会造成算法完全无用在你的case。 3.9 作者也是人 人都会犯错,不要认为作者是神。特别是算式真的很难理解,你应该问问你自己是否作者写错了。这可能仅仅是论文的抄写错误或一个数学计算错误。不管怎么说,最好的方法是自己做做计算去验证结果。 | ||
