Live data from Hacker News

What’s wrong with computational notebooks?

web.eecs.utk.edu

161–170 of 223 posts

Re: What’s wrong with computational notebooks?

#161
post #96

Co-author of the study here. Let me know if you have any questions or how you overcome some of the problems we identified!

> Co-author of the study here. Let me know if you have any questions or how you overcome some of the problems we identified! It's not clear who the audience is. It sounds like most people who complain about them are software people and not researchers/scientists. For someone like me, who once did computational research using MATLAB, and later analyzed data for my job, Jupyter is not worse, and is in most ways superio…

> I honestly have not seen this, and the reason makes no sense. Your browser is not handling the data. The kernel is. I mean yes, if you try to load several GB of data in pandas, it's possible you will have problems if you run out of RAM, but this has nothing to do with notebooks.

This is true nowadays with Jupyter, because it is smart about truncating output. But it used to be possible to OOM the browser by e.g. printing in an long-running loop or displaying too long of a list/table.

Re: What’s wrong with computational notebooks?

#162
I’m surprised no one has mentioned what I see as the biggest failings of notebooks: poor handling of connection loss / re-connection. The kernel will continue to run, but a connection hiccup will often make the notebook UI stop updating (and lose any kernel output).

Re: What’s wrong with computational notebooks?

#163
One thing that I find to be incredibly useful is the keyboard shortcut `00` (press zero twice while focus is outside of a cell), which will restart the kernel, clear all output and re-run the whole notebook.

This way I'm sure that "library code" that I'm editing in parallel in a real text editor is up to date in the notebook and also solves the limits the confusion due to run-out-of-oder problems.

The overall workflow is something like this:

  1. explore using thing., thing?, and %psource thing
  2. edit draft code chunk or function
  3. when chunk 80% done; move it to a module
     and replace it with an import statement
  4. press 00 to re-run everything, then GOTO step 1
The key to preserving sanity is step 3—as soon as the exploration phase is done, move to a real text editor (and start adding tests). Don't try to do big chunks of software development in the notebook. You wouldn't write an entire program in the REPL, would you?

Sometimes I keep around the notebook as a record for failed explorations or as a "test harness" for the code, but most of the time it's throwoutable since all the useful bits have moved into a normal python module/script under version control.

Re: What’s wrong with computational notebooks?

#164
post #6

(A frequent Jupyter Notebook user here. For data exploration, and teaching deep learning - then Colab is indispensable.) The main question is: what are the alternatives, for data exploration (and sharing its results). Similarly, for data science tool demos, Notebooks shine. IMHO the problem is not in the notebooks, but in how they are being used (i.e. the workflow). By writing scripts in py files, and using notebooks…

I recommend nbstripout https://github.com/kynan/nbstripout It eases most of the pain regarding version control. You can use it as a 'git filter', so only inputs would be shown in diffs and committed (and also works with interactive adding!), while keeping outputs in your working tree.

Came here just to make sure this got mentioned!

Re: What’s wrong with computational notebooks?

#165
post #86

Why no Mathematica?

Mathematica is great for symbolic mathematics and terrible for anything else.

The awful control flow syntax makes reading longer scripts pretty much impossible. Plotting is very clunky and by default produces output files that are essentially unreadable.

Of course one can somehow work around these issues, but it is much easier (and free) to just use python.

Re: What’s wrong with computational notebooks?

#166
post #28
post #5

I want a notebook where causality can only flow forward through the cells. I hate notebook time-loops where a variable from a deleted cell can still be in scope. 1. Checkpoint the interpreter state after every cell execution. 2. If I edit a cell, roll back to the previous checkpoint and let execution follow from there. I can't tell you how many times I've seen accidental persistence of dead state waste hours of peopl…

A couple years out of college we finally took a hard look at the credit cards and realized we had fucked up. We were gonna buckle down, pay the cards down hard for a while, 'color' our money so we both had discretionary spending separate from, say, the power bill. She had much more Excel experience than I did so she worked up a spreadsheet. It was bad. We had worked up some 'fair' notion of proportionality and she ba…

One company I sued to work for had this happen there was a magic spreadsheet in the accounting system - one factor in the massive restricting of the company - ICAN was the other

Re: What’s wrong with computational notebooks?

#167
post #69

I don't get why anyone one who knows how to use an IDE would ever use a notebook, the coding experience is garbage in comparison. I understand they started as a way to get STEM kids coding quick, but now they are like a standard in data analysis and data science, with those people needing experienced devs to translate the notebook into production code. This just drives the silo walls up higher.

Doing data science in an IDE would be terrible. With a notebook, you get the chance to load the data, view it, clean it where needed, view it again, analyze it, model it and do anything else you need to it. An IDE means that you can't use the previous output to guide your next operation in a direct fashion like you can with a notebook.

Maybe thinking about the data and what your trying to do before coding might be an idea as well.

Re: What’s wrong with computational notebooks?

#168

One thing that I find to be incredibly useful is the keyboard shortcut `00` (press zero twice while focus is outside of a cell), which will restart the kernel, clear all output and re-run the whole notebook. This way I'm sure that "library code" that I'm editing in parallel in a real text editor is up to date in the notebook and also solves the limits the confusion due to run-out-of-oder problems. The overall workflo…

Another useful tip which doesn't require always doing '00': when editing the library code, import things like this:

    import mylib; importlib.reload(mylib); from mylib import foo
Then in most cases except some very entangled ones, you can simply rerun this cell without having to restart the kernel (especially if it requires reloading all the data).

Re: What’s wrong with computational notebooks?

#169
My main use for notebooks is a simple way to constantly hold a whole large dataset in memory. That way if I want to try some feature reduction or remove some bad result, I can just do that and not wait 10 minutes for my slow PC to rerun my import code. I feel like an easy way to do that in base python would draw me away from notebooks.

Re: What’s wrong with computational notebooks?

#170
post #69

Earlier quoted context omitted.

Doing data science in an IDE would be terrible. With a notebook, you get the chance to load the data, view it, clean it where needed, view it again, analyze it, model it and do anything else you need to it. An IDE means that you can't use the previous output to guide your next operation in a direct fashion like you can with a notebook.

Maybe thinking about the data and what your trying to do before coding might be an idea as well.

'Thinking about the data' most often requires looking at the data from hundreds of different angles, quickly investigating its properties and statistics, maybe plotting or fitting a few things, checking some hypotheses etc (all of the above code you will most likely throw out after the initial stage).

Same with the results - once you've coded something (perhaps outside of a notebook environment) and obtained results, verifying that they are what you expect is much more efficient to do in a notebook.

Post reply on HN