Sure, you can do the same in R or python, but the whole process is very quick and easy in q.
481 karma · joined June 22, 2010
Sure, you can do the same in R or python, but the whole process is very quick and easy in q.
Having used CMUCL/SBCL for a while, I always found ocaml's "well, you can compile your code, but then you can't run it in the REPL" to be off-putting. (For my purposes the CLR JIT compiler for F# is good enough.)
I'm still doing all of my model estimation in R, and data.table + ggplot2 is still my go-to solution for interactive exploration and plotting, but I'm putting more and more of the process-csv, write-hdf5, remove out-of-bounds values, backfill, stratified sampling/bootstrap, etc., logic into python.
I may end up moving more of the estimation itself into python, now that statsmodels and sklearn are more mature, but R does that pretty well.
I've not tried Julia, but I have experimented with Java for some of the data-processing, but it's never seemed worth it, over python. Basic CSV processing is faster in python than in Java (although the python version uses much more CPU), so I haven't felt the need. (I'm probably limited more by disk bandwidth than CPU, but I've not done the tests required to prove that.)
Julia seems nice, but it seems intent on copying all the questionable design choices of matlab, rather than using ideas from the numpy/kdb+/apl worlds.
If I assume a std deviation of 1 (which seems low), that's 2-sigma, total, top-to-bottom.
It's funny, I found it to be very emotionally evocative. I loved my IIci so, back in the day. The tinkering with the background images, recording everyone on the dorm hall making funny noises, replacing the system sounds, making the shutdown sound be HAL, etc.
It definitely helped that campus was pretty much all-Mac, so we all could tweak the same silly noises, and all try to find the joke that sounded silliest when told by the Talking Moose.
I don't have the same connection to my Mac these days. I wonder if it's just me, if the college freshmen have the same experience in 2013, or if it's somehow just an artifact of that particular era in computing.
I keep these things in a dated "Notebook" file, like "Notebook/2013-07", just to hold all my one-offs.
Why do I keep them? Well, often it takes a while for me to set up the particular environment I need. If there's a problem with the calculation for X, I need to load the right data, set up the context for X, run through the individual bits until I see what the issue is.
I save the ipython notebook where I go through all that, and then if I need to go back to the calculation, for example to demonstrate to someone else my example that something has gone wrong, then I can just load up the notebook. If something is supposed to have been fixed, I can load up the notebook and repeat the calculation and see if it works now.
Unlike emacs org-mode, I can easily save the graphs as part of this. ("Look, if I plot the distribution, there's this big extra lump over there. Where's that coming from?")
If I go back to a file, it typically takes me a bit of thought to remember exactly what I was doing there. Once I figure it out again, I add sentence or two of markdown.
It's a useful thing to have around.
I had a bit of exposure to A+ then, trying to debug bits of the interest rate model subsystem. I hated it. We were mostly using A+ as the wire protocol at that point, and I had endless problems getting the APL fonts set up, and so on. Non-ASCII was a huge black mark.
Once we got the license and expanded the team working on the models, we decided to switch over to using kdb+ for the basic data store. That switch was like going from night to day. I could operate over the entire dataset, rather than just on a subset. I could query things on the fly with real aggregations. Things that were a huge pain (and slow) using SQL were suddenly fast and easy, like "calculate the average default rate grouped by FICO in 25-point buckets, for loans issued after 2005" or "backfill missing data from the first non-missing observation."
The first example can be done in SQL, but it takes a whole lot more typing and is (IMHO) much more error-prone. The last, I'm sure you can do it, but it's a nuisance.
I first got comfortable with kdb+ as a database query language. I read "q for mortals" by Jeff Borror, and we actually had Jeff around for a while for questions.
After that, it we started actually using q to estimate the models. It was great at the data aggregation and was a pretty natural fit. It didn't have anything built-in, but so we wrote a few functions for multinomial logistic regression, and that was good enough. That part didn't have a huge advantage over using something like R. However, the interaction with the large data store was far superior, better enough that it was worth it to write our own routines to do the estimation.
We even used q to run the models in production. That was more of a reach, but it worked pretty well.
So, I liked kdb+'s ability to handle large data sets in a speedy way. It makes a fantastic query language. I liked q's conciseness. It doesn't matter much for actual in-production code, but if you're doing research, every character counts. It seems shallow, but I think it's a real effect. Writing a half-line of q to do a paragraph of SQL is a huge win. I liked q's array operations, but by then I'd already been using Numeric and numpy and such for a decade, so those weren't really new. It was nice to be able to write them easily, as opposed to something like "np.concatenate((foo,bar))", but it wasn't really novel.
Basically, it was kdb+ that sold me on q.
K itself isn't as consistent as I'd like (odd corners like the auto-casting arrays, especially dict arrays to tables, and skipping NaNs in sums), but it's a great place to start.
J really needs a table or dictionary data type, or at least the tools to make one yourself.
Snark aside, this would be a more interesting post if the author gave some reason why this was a good idea. As far as I can tell, it's strictly worse than a text editor. I mean, it is an interesting hack, but the post doesn't frame it at all.
I think I've used scheme implementations that have the same "feature", with less of an excuse.
It's a similar "failure of GC" if you create an object with two fields, like "obj={a: giant_value, b: 5}" then had your closure return obj.b. I bet the "a" slot would not be GC'd, even though there's no way to reach it.
If your mental model is that you're holding onto the lexical frame, it's a pretty much the same behavior.
It's nice that JavaScript will do enough tree-shaking that it will eliminate the single-closure case, but that's an optimization, not something you should be counting on.
Similarly, I bet if you had a call to "eval" in there, you'd keep the entire frame, but I don't understand the exact semantics of JavaScript's eval enough to really say.
I suppose this boils down to whether your mental model is more "frame-like" or more "upvalue-like". If you think of keeping around the containing frame, it's not at all surprising that you retain the variable. If you think of the closure as a discrete set of upvalues, then it's a surprise.
Note that I'm not saying it's a good practice, but you need to come up with another name for it than "phishing", because that one's already taken.
I've never seen refcounting overhead show up in callgrind, so I think the choice to uniformly use the most general version is OK.
For example, I may just be a heathen, but Nietzsche's whole style seemed to be boldly asserting things, making fun of anyone who thinks otherwise, yet rarely bothering to make an actual argument.
I like the idea that everyone should take a semester's worth philosophy course somewhere along the way, but I don't know if it would do most people any good. An actual rhetoric course, with a focus on logical argument, may do better.
Am I misunderstanding the thrust of this article?
Edit: deleted comment about cycles, since they are discussed a bit at the end.
- There were very few numerical libraries, and those that existed either had a high overhead (compared to, say, calling NAG from C++), or weren't very robust (didn't degrade well in edge cases).
- A windows license for a server machine with > 32 GB of RAM cost an arm and a leg, so server farms got very expensive very quickly. (Oddly, the price of the license depended on the RAM of the machine involved.)
It looks like NAG now has a .NET version, so hopefully things have improved. For a while, it seemed like math in .NET was strictly amateur hour, but I'm sure it's better now. I don't have the strength of will to research if the licensing cost has improved at all.
That option is long gone, but I don't know when it disappeared. Does anyone know when this happened? If anything, that's a sign of when it jumped the proverbial shark.
I never look at Fabozzi's book these days, but I still break out the Guide to MBS for its appendix on mortgage amortization formulas. That's a pretty weak recommendation.
It still had the best reader experience. I don't know why modern email clients, for example, don't look more like trn.
If you're not trying to make your Twitter handle anonymous, then why not tweet your phone number?
I'd rather have R/data.table at the prompt and python/pandas in my script, but if you have to err on one side, the python/pandas "low magic" is the side to err on. Pandas does have its own strange corners, though. For example, it seems like it tries hard to stick similar-typed columns into contiguous matrices, which leads to some unexpected casting, and I have no idea what the supposed benefit is over just keeping distinct columns.
It's trickier to use, because blindly applying it can lead to immense classes, but I find it a useful thing to keep in mind.