r/MachineLearning • • Jul 03 '17

Discussion [D] Why can't you guys comment your fucking code?

Seriously.

I spent the last few years doing web app development. Dug into DL a couple months ago. Supposedly, compared to the post-post-post-docs doing AI stuff, JavaScript developers should be inbred peasants. But every project these peasants release, even a fucking library that colorizes CLI output, has a catchy name, extensive docs, shitloads of comments, fuckton of tests, semantic versioning, changelog, and, oh my god, better variable names than ctx_h or lang_hs or fuck_you_for_trying_to_understand.

The concepts and ideas behind DL, GANs, LSTMs, CNNs, whatever – it's clear, it's simple, it's intuitive. The slog is to go through the jargon (that keeps changing beneath your feet - what's the point of using fancy words if you can't keep them consistent?), the unnecessary equations, trying to squeeze meaning from bullshit language used in papers, figuring out the super important steps, preprocessing, hyperparameters optimization that the authors, oops, failed to mention.

Sorry for singling out, but look at this - what the fuck? If a developer anywhere else at Facebook would get this code for a review they would throw up.

  • Do you intentionally try to obfuscate your papers? Is pseudo-code a fucking premium? Can you at least try to give some intuition before showering the reader with equations?

  • How the fuck do you dare to release a paper without source code?

  • Why the fuck do you never ever add comments to you code?

  • When naming things, are you charged by the character? Do you get a bonus for acronyms?

  • Do you realize that OpenAI having needed to release a "baseline" TRPO implementation is a fucking disgrace to your profession?

  • Jesus christ, who decided to name a tensor concatenation function cat?

1.7k Upvotes

471 comments sorted by

View all comments

Show parent comments

22

u/didntfinishhighschoo Jul 03 '17

Such piss-poor approach to life. I keep forgetting that for most people, their job is just their job, even if they’re in an interesting and important field, all that matters are the sticks and carrots the bosses lay out to them.

30

u/Jorrissss Jul 03 '17

their job is just their job,

I think the part you're not emphasizing or appreciating is that their job is just their job and without compensation they aren't necessarily interested in making more readable code for the public. A person can have a tremendous amount of pride or love for their work, but not give a shit about you.

6

u/east_lisp_junk Jul 04 '17

I think the part you're not emphasizing or appreciating is that their job is just their job and without compensation they aren't necessarily interested in making more readable code for the public.

I think the part OP is really missing is that there is absolutely no shortage of work to do. The decision here is not about whether to go put some extra hours in so that there's time to clean up research artifacts for general public consumption. Those extra hours are getting put in, no matter what. The decision is whether the extra hours go towards chasing another research result, or updating the curriculum for some course you're teaching, or serving on some committee for your department, or trying to really give detailed feedback on some students' homework, or writing another grant proposal so that you'll have the resources to get more research done, or making something they've already written more accessible, or giving a more thorough read to some papers they're reviewing, or....

2

u/Jorrissss Jul 04 '17

I think the part OP is really missing is that there is absolutely no shortage of work to do.

I agree, that is certainly more significant than the part I mentioned. There's always a ton to do, and every moment spent documenting code is time not spent on an interesting problem.

8

u/didntfinishhighschoo Jul 03 '17

This is a practical field. Your tools and execution are multipliers of your ideas.

Look, I get that compared to other parts of the academia, DL is moving at a blazing speed. But compared to other parts of the industry - it's like going back in time for me, it feels like doing development in the nineties. Look at the ecosystem and the infrastructure and tools and culture available for web developers and operations people.

34

u/WormRabbit Jul 03 '17

It's not "a practical field", it is an academic study. The point of academic studies isn't to produce practical tools, but to invent new ideas and test approaches. Thus churning out 10 papers with piss poor code and numerous tests is strongly preferrable to a single well-written code example which may not even prove that useful.

0

u/Mr-Yellow Jul 03 '17

invent new ideas and test approaches.

While ensuring those are obfuscated enough that no one will ever dare attempt to duplicate those results.

6

u/WormRabbit Jul 03 '17

It's just a byproduct. See, the sorry part of modern academic administration is that your evaluation, funding and employment crucially depends on you publishing new papers with new results that will get cited. Reproducing someone's results? That gives you no credit, unless you happen to uncover some huge error. Even then it's a matter of the original author losing credibility rather than you gaining it. So why bother at all with reproducibility? You need only to write a solid enough paper that your results don't get disputed. Some groundbreaking results will surely be checked and rechecked. Run of the mill papers? Hell no.

Does it suck? Does it break the very foundation of scientific knowledge? Yes, totally. We all understand it, but we are not the ones distributing money. In the end the personal career matters more than confirming that statements known to be true are indeed true.

→ More replies (1)
→ More replies (6)

5

u/nuclearpowered Jul 03 '17

On the same maturity timescale dl development now could be compared to web dev in the 90s. Have had colleagues make the same analogy.

→ More replies (1)

13

u/darkconfidantislife Jul 04 '17

That's a false assumption, I care deeply about my research field, that's why I stick to it and don't go work at some hedge fund for way more money.

Here's the thing though, I want to work on interesting problems, I literally have a backlist of 100+ ideas I want to try out. That takes time. Why would I spend time on making my code look pretty for others and slow that down even more, when I could instead move onto trying out a new idea?

That being said, if people ask politely, I will help them out.

→ More replies (2)

37

u/commisaro Jul 03 '17

Or maybe we'd prefer to spend our time working on those interesting and important problems, rather than doing the boring drudge work of fixing up code we wrote for problems we already solved? But I look forward to the clear, well-documented and commented code you will release along with your own state-of-the art algorithms for currently unsolved problems.

14

u/Mr-Yellow Jul 03 '17

boring drudge work

It's simply good coding habits. Nothing hard about getting things right the first time.

Of course it's extra work if you don't bother following good practice from the start.

1

u/didntfinishhighschoo Jul 03 '17

I bet the guys in the eighties you reinvent and republish from thought the same thing.

13

u/TankorSmash Jul 04 '17

He's got a point man. I advocate great code as much as the next guy but you're here shitting on someone else's code without so much as a pull request to back your claims up.

You're literally just calling out some other devs to make yourself feel better. It would take some real effort but make the pull request with those variable names and try to comment some stuff out and help people instead of being a dick for no constructive reason.

→ More replies (1)

2

u/Lampshader Jul 04 '17

Hey OP, maybe you can come work for me? I won't pay you, but it's an interesting and important field.

3

u/[deleted] Jul 03 '17

Yeah - but if you get scooped and don't get publications then you won't be in the interesting and important field for long.

It sucks, but don't hate the player hate the game...

4

u/evilish Jul 03 '17

Holy shit mate. We'll put, and I completely agree with you.

As a JavaScript developer who has dug into learning DL this year. I'm amazed at how hard DL authors make it.

@Authors, if you don't feel like providing decent documentation? Fine. Don't feel like commenting your code? Fine.

But for the love of all shiny. At the very least, come up with decently named methods, variables, etc. Something that makes your code, a little more self-documenting.

If nothing else, when you come back to look at your code sometime in the future. It'll be much easier to grok what's going on.

2

u/crazylikeajellyfish Jul 03 '17

Remember that these people are also trying to hit deadlines, they can't do everything. Part of why JS tooling quality is so high is that it's a lot of open source passion projects where engineers have the leeway to Do The Right Thing. These Facebook devs probably cut corners because they were in a rush, not because they're lazy.

4

u/Mr-Yellow Jul 03 '17

Don't buy this for a second.

No amount of rushing will cause a person to write unclean or undocumented code. It's always part of the game.

Except when a part of the industry decides it's too hard for some reason and never gets into good coding habits.

6

u/didntfinishhighschoo Jul 03 '17

The deadlines in the industry are fiercer. We write code in weekly sprints that no one outside the company will see. Nothing goes live without a code review from two people, automated checks, mandatory documentation, etc.

9

u/crazylikeajellyfish Jul 03 '17

Nobody outside the company will see it, but plenty of people within the company will have to work it once you're gone. Again, deployed industry code is responding to a very different set of requirements than a research group. You really think any of that code will get used in an actual Facebook product?

8

u/didntfinishhighschoo Jul 03 '17

No. What sucks is that other research groups won't build on top of it. They will have to rebuild and reinvent parts, probably get stuck on the same points the FAIR group hit on but didn't document. Waste of research cycles. If you have an idea you want to check out, see how it improves this model, how much time will it take you just to get to the starting line?

0

u/[deleted] Jul 05 '17

[deleted]

→ More replies (2)

1

u/redrumsir Jul 04 '17 edited Jul 04 '17

In the case above, their product is their paper ... not their code.