About this episodeThis show covers R: a language suitable for data mining and machine learning. Book of the Show Jason: The hard thing about hard things…
This show covers R: a language suitable for data mining and machine learning. Book of the Show Jason: The hard thing about hard things http://amzn.to/1UqMjDD Patrick: Steel World http://amzn.to/1JMcsa5
★ Support this podcast on Patreon ★Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
R
goes lang. No, no, I know, but the document that sort of the Go style guide talks about, you know, using tabs and you actually have to do some like trickery to make it support spaces, and I just—I hate tabs. I mean, here's the thing: I use tabs. I will. I like the tab button because usually it does not insert a tab; usually it does something much more useful, like take you to the beginning of a line or something like that. So the Tab key can stay, but the tab character, for me, it's only good for one thing, and that's—I started replacing CSVs, like Comma Separated Value files, with TSVs. And the idea is, like you could have a CSV, and some of those columns could have commas in them. I mean, it could be, you know, last name, comma first name as one of the columns, right? Um, and so now you have to like escape it out and do all sorts of craziness, right? But nobody should have a tab. Like the tab character is like should not exist, in my opinion. And so it's easy for me to just kill all the tabs, like replace tabs to spaces, and all of my data and then use a Tab Separated File, and just know that there's not going to be any weirdness because the actual data isn't going to have tabs in it. So for that, it's good. The tab character has like one purpose, and it's that. But when I see source code with tabs in it, I don't know, it just drives me up the wall, especially open-source projects. Uh, I just—I don't know why they do that. It just drives me crazy. So that's my—that's my tabs versus spaces rant. Use spaces, please, for the love of God.
Probably. Like I've never seen it, but I can imagine like 120 being better. Like and you don't want a complete run-on line. Like that's true, but the only time is a few people I know run like 80-character width terminal windows, and they run like a bunch of them, and then they can like, you know, all their source code they can have side by side. That's just not how I work. So to me, the 80-character is just really short, especially if you get too many indentation levels, which is not too many, but like three or four, right? Like you're in a class or, you know, in a function, you're in a, you know, three, four levels down is easy. And then if you're using two spaces per indent, that's already eight spaces gone, right? Like yep.
Another thing I can't stand, but I don't really know how to fix it, is, you know, Eclipse. I mean, Eclipse does four spaces for an indentation level. Like you can go into the Eclipse settings and change it to two, but then as soon as you reinstall Eclipse or change machines or something, now you're back at four. And so I'm not really sure. Hopefully there's—I could just figure out some way to sort of like maybe tell Eclipse to go look at Dropbox for my style or something like that. You know, that's
So Emacs has support for everything. Like the other day, I needed to do Scala, and Emacs—it just worked. Like I just spent about five seconds, five minutes, you know, finding the Scala package and installing it, and then boom! I had like beautiful character-like, like, you know, syntax highlighting and all that stuff. I mean, like there's no editor that has that kind of support except maybe Sublime Text is getting there, but that's it.
Yeah, I mean, it's nice. Yeah, the problem is like certain parts of the development you just shift it around. So like I do code in C or C++, and bring it up in like an Eclipse or an IDE. You can typically follow like use the 'Go to Definition' or 'Go to Declaration,' and see that. And yes, I know people do this in like Vi or Emacs with what is it, ctags or whatever, but I've seen very few people who are on top of it and doing it well enough that like they actually are as efficient and getting into a new piece of code and understanding it as I can be by, you know, using an IDE and actually going to the definition and whatever. Yeah, that's a good.
Think I think you're—I think if I could get, you know, as I said before, I think if I could get the Eclipse configuration to somehow sit on Dropbox and synchronize between my laptop, my desktop, and if I could find support for all the languages—like Eclipse would have to be able to do Python and, uh, you know, Scala. I think you can do all of those, but you're right. If I could get Eclipse set up correctly, the go-to stuff is totally awesome.
Sure, you're right. You're right. If you could get support for like dot proto files, if you get syntax highlighting for that and you know Python are all the languages, if you could, if Eclipse could be as fully featured as Emacs, then you should use Eclipse. I agree with that because you could just turn on the Emacs keys.
If you use Eclipse, you should still know how to use Vi or Emacs, one, right? So like I still know how to use Vi. So when I'm on another person's computer or doing it's on a computer that's not configured, you still need to know how to do it and be reasonably efficient. Yep, a lot of people aren't, and then that's like a problem so they just use Eclipse because it's the fastest way to get started, I guess, and then they become debilitated when it's not working or they have to—they're using a new computer or whatever. Yep, that's not good either.
Yeah, definitely. Yeah, you should learn. I mean, Emacs is so technically Vi gives you complete coverage. Um, I have been on a few very seldom. I've been on machines that didn't have Emacs, um but yeah, you should definitely learn one of the two. Um and you should change your Eclipse to use spaces instead of tabs, please.
Yeah, we totally set that up. We've been doing this for too long, but yeah, so Hack is pretty cool. I've looked into it. It's basically—I used to use DejaVu for Emacs. Hack is based on DejaVu, which is comforting for me, but it has a few changes which I really like. One is the letters that are very slim, such as i and l; they purposely give them kind of an exaggerated serif that kind of hangs off to the right. And so it kind of makes those kind of letters, you know, stand out a bit more. It's monospace, of course, because it's designed for source code, and so when you have monospace i and l kind of tend to look kind of weird, so it fixes that. Also, I mean just some subtle things. The o and the zero—the zero has a dot in the middle, so you can tell whether it's O or zero. It's just got some things like that which I think are pretty cool. So I ended up actually sticking with DejaVu, not because I didn't like Hack, but because I couldn't really figure out a way without a lot of work to install it on every machine. You actually—to install a font there's not like some command line trick you can do; you actually have to open up the font and go and install it. And so I'm still trying to figure out if there's a way to do that, but overall, if it was as easy as DejaVu to get, I would—I would be
What do they call someone who has a name, but I forget? Really? Then maybe I'll Look it up. All right, speaking of aesthetics, we have another article: The Common Filter in Pictures. So not using common filtering for pictures, but describing how a common filter works using pictures. The first time I saw an explanation for the common filter that was sort of like this—I believe it was in one of the what? The guy who does the Google self-driving car stuff has the online course, Sebastian Thrun. Yes, that one. I think he has a video presentation about common filtering, particle filters, and Bayesian analysis that he does through. And it was really good; that was the first time I'd seen it presented in a similar way to this article. But this article also does a very good job of basically talking about kind of how if you use—if you think about it kind of in the Bayesian way, and like what happens as you take measurements and update them, and graphically showing the kind of distributions in a way that helps you kind of to more intuitively understand what the common filter is doing. I don't know that it gives you enough to where at the end of it you'd be able to go implement it, but kind of understand where—where it's going, and even if you don't read like the actual formulas that are in here—are they look foreign to me, and I don't exactly know what they're saying. I'm sure if I sat down, I could probably work through most of it because I have actually implemented a common filter before, but I've forgotten it all since then. The pictures though do help tell a story and jog my memory enough. And you know, I thought was a good representation of why you would use a common filter—what does it do for you? How is it helpful? And that it's not just magic.
Recommend it. So, common filter and pictures. Yeah, definitely check that out. Who don't know what a common filter is? Oh, so a common filter is a way if you're taking—and there are variations of it, but in the simple form—if you're taking measurements over time, and the measurements have noise in them, and you're trying to say how believable is the measurement at a given point in time? Yep, pretty much. It's
Just it's a recursive Bayesian filter. So the cool thing about it is because of the assumptions a common filter makes—you only need to know the current state to infer the next state. So it's not like you have to store the entire history in memory, and so that part is pretty cool. It's very memory efficient. Yep, and
Yeah. Oh, I've never seen that. There's also ways of doing it where you have multiple measurements. What is that called? Consensus, right? Is that right? Oh, you take kind of voting, similar. Well, you have things that are measuring stuff similarly but differently. Like if you have an Inertial Measurement Unit, you have like two of them, and they'll give you slightly different answers, and you put them both into the common filter in hopes of getting a better answer out if their way that they have error is different from each other.
so that was a bad example but oh like dead reckoning on a car so if you have a car you can count like the rotation of the wheel but the wheel slips a lot right so like how many times the wheel went around isn't a great measurement on its own but if you combine it with like gps you know like the strengths and weaknesses of the two complement each other very well and you end up with
True. Yeah, I mean he really shouldn't have put on us, but—I mean, you know, it's hilarious is what it is. The guy is absolutely hilarious. He has a way of writing like a sense of sarcasm that I really appreciate. Like, I'll just read an excerpt for it. He's talking about getting to work. Yeah, he works in the city; he lives not in SF because he works at a startup, and he goes on about how he can't afford to live in SF and everything. But he said, you know, driving to SF is like a theme park ride, blah blah blah. But then he goes, those with a death wish ride a bicycle to work. It's easy to spot a cyclist if you see a guy with one side of his jeans rolled up to the shin; he's a moron. If you see a guy on a bicycle, he's a cyclist. You gotta read this. It's hilarious. A lot of it is true. Yeah, okay, so this
funny. So definitely check it out. I mean, it does give you insights into working at a startup in SF or just being in the Bay Area in general if you're interested. So there are, you know, there is—there are academic aspects of this article, but as Patrick said, I mean, it's just tongue-in-cheek. Wait.
So the next news article I have is not news but a contest, the Underhanded C Contest. And I must have—I thought I had read something recently about this. And then I saw that I was like looking on their website and I saw they have a new challenge. I must have been reading results of a previous challenge, but I thought this was really clever. So you may have heard of the Obfuscated C Contest. Oh, I remember that. Yeah, it's not—it's like the worst thing ever. It's basically people doing all the things in coding that you should never do, um and like trying to write one-liners.
One of them was #define break to space. And so what that means is there's no compiler errors, but all of your breaks just disappear. It's like all of your case statements and your switches just fall through to the next one. Um you know if you ever have a while true, it just never ends, and but but there's no compiler error.
That. So this is underhanded similarly to those things, I guess. Um but basically they present kind of a scenario that's supposed to be a real-world challenge and it has kind of like a simple solution. It's not like a programming challenge to actually figure out how to do it should be really straightforward and how to actually be able to accomplish the scenario they're putting forth, but then your goal is to try to put um flaws into the code that are very difficult to detect, but you have to send your source code right? So you post your source code and you could do things like kind of Jason is alluding to, like maybe you #define a macro that does something unusual, but it's hard to detect. Or um in any case, you're trying to leak information that you shouldn't be. So in the case they have now, I think you're a nuclear arms inspector working or trying to sabotage nuclear arms inspectors by allowing certain countries to influence the results of nuclear power tests. Um and your code will get inspected, and it needs to kind of—your bugs have to slip through the inspection.
To do, you have to do things like maybe subvert how the date function is working or have a clever integer underflow that when it happens deliberately does something else. Um, and anyways, you can read through previous results. There's several years of previous results, and he kind of—I think it's a professor—he or she posts up kind of like analysis of the best ones. And short and simple ones tend to win because it seems less sinister, and people will, you know, kind of just glance over like, 'Oh, this is so short. How could there possibly anything evil going on here?' versus if you write just mountains and mountains of unreadable text, people are gonna, you know, be suspicious.
So the one line I was thinking about that's in this—what to do before you leave your company—is hide. Yeah, it was pound defining if as a macro that instead of you do 'if' and then you have something inside of the 'if,' instead it does the thing that's inside of the 'if' and a random number is basically that evaluates the true 99% of the time. So 99% of the time, it'll just be whatever you have inside the parentheses. In other words, it'll operate exactly as you intend it, but then one percent of the time, it's just going to return false for no apparent reason. And so then when you debug it, right? Like if—if you're not depending on how you're debugging it, you're likely to just be like, 'Nope, it's right. It's right.' Why is it not working? And then why is it?
I do GDB debugging, and you've pound defined it to something else? I'm trying to think if you're doing it just line by line. I don't think you would ever be able to tell this even if you were like line by line GDB debugging something, right? Yep, but I tend to be really paranoid, and I typically drop to assembly very quickly. Oh, really? And then I would see it.
Looking for is I really wanted, regardless of what optimization level you're at, I wanted something that had a very specific performance. And so I knew I could do it in two instructions taking three cycles, and the compiler was only getting down to like five instructions, seven or eight cycles. And so what I was worried is that someone would later find better optimizations and would change the timing inadvertently, and I needed it to have very specific.
right? If you've ever heard of Andreessen Horowitz, so they—Andreessen, Mark Andreessen, and Ben Horowitz. Both founded Netscape, I believe, or like we were founding engineers on Netscape, I could be wrong about that, but Ben Horowitz was definitely a founding engineer on Netscape, and it's all about actually Ben Horowitz. It's a lot about Ben Horowitz's life. It was pretty interesting. I mean, at one point he was doing a startup. He was feeling really good about the startup, and then he had some family trouble. He had a daughter who was born with severe autism, and he needed medical, you know, benefits things like that. So he was forced to quit the startup that he founded and get, you know, quote unquote, like a corporate job. And then worked there for a while, went back to startups, and all about sort of the crazy volatility. You know, his startup was completely falling apart, and so he had to sell it. So it's this craziness where he's got talented people, so it's kind of worth money, but it's really kind of an acqui-hire because he doesn't have a good product, but people don't know he has a bad product yet. And it's all about how he kind of pulls that off and sells the business for like a ton of money. And it's just—it's amazing. I mean, it talks a lot about even they—they basically this one guy. It talks a lot about B2B, which is for people don't know that's business to business. So most jobs are business to business. Like, for example, like Facebook is business to consumer. There's all these people they come to Facebook, and it actually is Facebook even B2B. I think Facebook is actually business to business because advertisers come to Facebook, and then Facebook, you know, displays their—that's not what
more like Square. Right? Like Square is squarely—oh, I'm so sorry. I didn't mean to do that. Square is very like business to business oriented. Right? There, I mean individuals are using it, but they're really out there to like help small businesses. Exactly, business selling stuff to small business in this case a service, but
so this guy's startup, they literally they had one customer that was 90% of the revenue, and this one customer was complaining to them because he wanted to use this one piece of software, but he couldn't get permission to use it. He only had permission to use their software, which they were orthogonal—it's like they were competing—but he wanted to use this other piece of software, and he was just really mad. And in general, they were saying he hated his life, and he told them he was just like depressed and everything, but yet he was like in control of their whole whole business. So what they did, they bought this company only so that this one client would get access to this company's software without needing approval. So it's like imagine that. I mean, you buy a company just to make this one guy happy. And then because that guy was happy, he funded them for another year, and then they got bought or something. It was just—it's like like crazy things that you never thought would happen at the highest levels of business happen. And this book talks about them. It's very interesting.
Mine is a work of science fiction. Steel? Oh, not the book itself is real, but it's a science fiction book. It's called Steel World by BV Larson, and it's about—I don't I never I don't really want to spoil it, but it is set in the kind of near future, and Earth is only one of many planets that have people on them, and the guy is basically becoming a mercenary to fight battles for other planets. And kind of his going through that, and the storyline actually sounded kind of cheesy. I got the book during an Audible sale, and so I was like, so I because I listen to most of my books—all of my books, I'm not gonna lie—and because I have a terrible commute, so I was listening to it. I was like, I got on sale, I'll try it out. And I was kind of like meh, but then I really got into it, and I was really like digging it by the end. So I really recommend it. Cool. Well, you gave me good advice with Ready.
something. Maybe, maybe I'll finish another book in between. But definitely Steel World was good. It's actually part of a series—the Undying Mercenaries series—which gives a little bit of a clue, but I won't tell you what it was because it was a surprise to me, and I enjoyed finding out what the surprise was once I heard it. But cool, cool, cool. And then as we've talked about previously, if you would like to get this sounds so shilly. Oh well. If you would like to get a free trial to Audible, they're offering one month free subscription where you get one free book and then you get to keep it when your trial's over—just cancel it before the end, and there's no charge to you. And you can do that and support the show by going to www.audibletrial.com/programmingthrowdown. All lowercase, all one word, and that helps support the show. We've had a number of people doing Audible trials through that, and that's really helped us out. Thanks guys, and hopefully you enjoyed whatever books you picked. Write in and tell us what books you picked or give your own Book of the Show recommendations because we read a lot. And yeah.
the show tool of the show. So my tool of the show is Electron, which is made by GitHub. It used to be called Atom Shell, but it's pretty cool. So basically, it's a Node.js library, and the way it works is so simple—a way of saying it is you can take a website and turn it into a desktop app, which is pretty cool. We definitely have some internal websites at work that would be kind of just much better if they were desktop apps because you know, you want them to live on the dock. It's kind of weird if they're just a frame, you know, because they kind of do so much. And so what this thing does is you can actually even just take the example—if you're not like a Node. js expert or anything, it's fine. You can just take their example code, but it has this sort of app-like, it's kind of hard to explain, but it has OS 10, Windows, Linux desktop apps. And in the app is a folder. So in the case of OS 10, apps are folders, so you just put it in the app folder. In the case of Linux and Windows, they do something kind of goofy, but it works. I think it's like some kind of executable zip or something, but you just have this Node.js code which could be as simple as just one line that says open url www.google.com, and now you have the google.com app. But you know typically you would have it point to some internal app for some internal site, or if you have—you can make a Facebook app. It's kind of cool. I'd imagine for things like Google and Facebook they're probably professional versions, like people have probably done all sorts of cool stuff that you can leverage. But if you have, you know, a site of your own, or if you have your company wiki and you want to make a desktop app for that, you could do that. So just think of it as kind of like a desktop wrapper around. So it just
You can choose actually whether you want the address bar or not. Um, so it's just a flag when you write the Node.js code. So yeah, if you don't have any address bar, then—it's literally like it feels a lot like an app. But then also if you if you don't have an address bar and you don't have back and forth, then you as the web developer has to make sure that you allow people to
There is an Android app. There is. Oh, awesome! You should check it out. Apparently, it's telling me get premium checkpoints if I buy, but I'm just saying not now. And what it is is it shows you a little top-down view like—what was that? The original Grand Theft Auto was like that, right? Yeah, that's right. It's like the top-down view of the car, and you basically steer your car left or right through a neighborhood trying to steer a car to a destination, except that once he gets there, you immediately start a new location with a new car, and you need to drive it to a destination, except that time is running in parallel with the previous car you drove, which is now also driving on the street you're trying to drive on. So it's following the path you chose to take, and then you're driving through it, and then you keep doing this over and over again until kind of like a certain number of cars or whatever, but your street is getting more and more busy as all your previous runs are stacking on top of each other. And if you collide with yourself—now there's an accident, you need to drive around the accident, um, and this kind of thing. So it's okay. So,
Stay away. I kind of knew it wouldn't be like that, but anyways for me it's just like I didn't need, like I didn't keep playing it. It was just a really clever idea, and I like playing it for a few minutes. I don't know that I would play it till it was over or the end, right? All the levels. Just check it out for kind of a really cool, clever original concept which don't feel like they come along that often.
Well, you know, we definitely keep track of everything. So we got to you eventually, and also Alfredo Galagos wrote in, and he was kind of wondering what is data science? What is data analytics? And what is R? So we had two people kind of both interested, and this is something we can—we know a lot about. So this is a this is a good topic for us to cover. So I guess...
Science. Yeah, before we get into R, let's kind of talk about data science, data analytics. This is kind of—you hear a lot of different things like Alana Mitt, who's a pretty famous mathematician who worked at Google for a while. He says a data scientist is a statistician who works in San Francisco. That is truth. Yeah.
It's maybe easiest to talk about through some kind of example, right? Let's say you are trying to sell tickets to a baseball game, right? So you want to figure out a good price for tickets. So you have a bunch of data that has—you know, let's say you have all of StubHub's data so you know on the secondary market how much people charged for tickets, how much people paid, you know, how many of those tickets that were on sale were purchased, things like that. And you want to build kind of some model, like you want to understand this data so that you could make your own—you could do price gouging on StubHub or arbitrage on StubHub. So you might say, well, let's just take—you know the name of the team that's playing. Let's just say you just focus on one stadium. The home team's always the same. Let's just take a—you know the away team and take the average of the prices of the tickets. And so, you know for the Cardinals it's $17, and so I'm going to charge $17. Well, that probably won't work, right? Because there's different levels. If you charge $17 for front row seats, then you're giving somebody a great deal, but you're not—you haven't accurately described the price of those tickets, right? So you go back and you say, okay, I'm going to—you know take into account the different levels of seats. And now for each—for each category of seats, I'll have a different price structure. And now you're a little bit better off. And then you found out, oh, when they played on Saturday, you know the tickets were much more expensive, but when they played, you know Tuesday afternoon, the tickets were much cheaper because accessibility—right? People work on Tuesdays. So, from looking at the data, you learn that. And then you decided I need to add day of the week or at least I need to add weekday: yes or no? to to um to my data and so i need to split the model again um and now just look at you know two weekdays with the cardinals and see if that data is more regular and so that's basically what a data scientist does is they take the existing data and just kind of start slicing it up uh to the point where they can end up with very regular you know nice distributions um and you know presumably they could do this on a small subsection of data and that would scale across all the day all the rest of the data so in other words we just talked about how to handle um you know the giant stadium but presumably that same logic applies to every baseball stadium um so that's how a data scientist can can kind of look at small slices of data and hopefully still solve the bigger problem right so um that's a big part of it is is that's the analysis part um there's also uh building models so most of the time there's a goal of of data science so in this case we wanted to um become a ticket arbiter on uh stub hub so we want to know the effective value of a ticket and so that becomes a regression problem right so given um all the things we know about the ticket and then also we can use other data sources we could go to mlb. com and see you know are the giants having a good year or a bad year are the cardinals having good year or bad year because that that affects the sales right so using all this data um can we feed it into some machine learning model and it would just spit out you know oh 57 dollars a ticket for this ticket and uh and be pretty accurate um you might want to not just assign numbers to to data that you don't know about like in this case future tickets you might want to classify them like you might just want to say okay i don't want to know exactly what it's worth i just want to know which ones are you know uh selling for too cheap so that i can go and buy those and then resell them
Exactly. And so that's classification, right? That's more of a categorical task or you want to say is it A or is it B. You also want to do clustering. So for example, let's say you don't know which tickets are—let's say like in the data you don't have low level, high level, like you don't know which seats are front row seats, but you know that people will charge more for front row seats. So you could do a clustering. You could say, okay, given all the tickets at the Cardinals game, I want to cluster it based on price into two groups and I'll just assume the second group is the front row seat group. Then there's also data embedding, which—it's a little bit more complicated, but that's all about understanding the distance between two things. So you might want to know are these two tickets similar or different with respect to their value? And so embedding is a way to do that. And so if you're interested in that kind of stuff, there's data science competitions and they also have tutorials on Kaggle.com. So that's K-A-G-G-L-E.com. It's pretty cool. So that even their tutorials are actually fake competitions. Like they're—they're competitions that where there's no deadline and there's no prize, but you still get a feeling like you're doing this competition, and it kind of gets you set up to do the real competitions. I've done a few of them; they're really fun. I've never been in the top 10 or anything crazy like that. A lot of those people are just extremely good, but—it's definitely worth checking out and you'll have a good time.
Yeah, good question. So well, in undergrad you mainly learn how to—you know get the statistical properties of data. So you learn how to fit to a distribution, you know what the confidence intervals mean, things like that. In most classes, even graduate classes, they don't really talk about how to sort of—I don't know if normalize is the right word.
data? But exactly like how to people will tell you, okay, given some data here's how you can check and see if the data is normally distributed. What that means is that you can find a Gaussian or a normal curve that sort of fits the density of the data. So, you know for example, if there's a lot of data around 20 and as you get further away from 20, there's kind of less and less data. Then you could kind of fit a Gaussian curve where the center is at 20, right? But they don't really tell you—is if your data is not that, then what do you do, right? So that's not really covered. And the answer is kind of as we talked about: you do this segmentation. Also, you have to do, as Patrick said, you have to do a lot of cleanup. Might be, you know some people will post a ticket on StubHub and charge fifty thousand dollars just because they can because they're just crazy or who knows like they just think it's cute or funny or they think oh there's a chance that some insane person is going to buy this ticket. Let me just see what happens. And so, you know what that ends up translating to are just anomalies in the data that you have to filter out otherwise they'll just completely dominate any type of machine learning. Like it will spend so much energy trying to understand this—this ridiculous number that it will forget about the entire problem. So, so data science is about all of that.
Okay, yeah. And it's almost like people have an algorithm which says people won't buy the cheapest used something; they'll buy the second cheapest used something. So find whatever the lowest price used something is and like charge three percent more than it. And so then you end up with this weird race of like two or three people offering used books for sale for like ten thousand dollars. Yep, and it's like but it's not like a rare book; it's just an out-of-print book and for some reason, or like a previous edition of a book, and it's very unclear what caused it, but if you were doing data scraping and trying to say like, hey, books on science fiction, what is it worth? Collecting a random paperback book, and you know you had in your data these things are like ten thousand dollars. But that doesn't mean anyone's actually buying them, so it's not really a good measure of
data. That's right. Yep, you're exactly right now. Yeah, even with board games, there's this game—Beyond the Hill, I think it's called—and it was just, yeah, the game retailed for like fifty dollars, just a normal board game, but it was out of print and they were getting ready to release a new edition. I didn't know all of that. I just went to look it up on Amazon, and yeah, they said it's worth, you know, fifty thousand dollars. It's just ridiculous, but yeah, all of that comes with your data, but
Exactly. I wonder how many high-frequency trading companies have like one or two percent of their revenue are just broken algorithms, and they just expect to lose that? Like they have a budget of $100 million, and every year one or two million just gets invested in a completely bogus way because of some race like this.
Someone said that there's like a group of people kind of doing it. It's not really high-frequency trading because like every frequency training means something slightly different, but algorithmic trading where you know it's just like a computer running a program, not like super high speed, but that basically as humans is right? Yeah, but that means something different. There are other ones that watch for a pattern. If you've seen a stock is up 10 percent in the last month and it's currently down more than two percent in the last day, buy it because chances are it'll be up again, and so it might operate over the course of hours or days. But
It's algorithmic but not high-frequency. Although more frequent than maybe you or I might trade stocks, right? And so if you find them, like you can tell how they behave because they act in a certain way, like not like a human per se. And then basically if you find these people leave the bots running for some period of time because they're initially profitable, then you know basically people figure out whatever is being done and close down the profit by closing the arbitrage. And then for some while they're—they're just like break even, and then they become, you know, get shut down when they basically start losing money. But if you can find the ones that are still lurking out there that have gone break even, you can trick them into like taking the other sides of your orders and like make money off of them. But I've never seen anyone—I've like known firsthand actually demonstrate this phenomenon to me, so maybe it's just urban myth. Yeah.
I don't know a lot of this. There's a lot of stuff in the stock exchange. I don't—you just have to be there, and we're not there. So but I would believe it. I mean, I definitely—I'm not skeptical of that. I'm pretty sure something like that happens. I mean, definitely if you're doing algorithmic trading, you probably are taking advantage of other algorithmic traders. That's my guess. I mean, maybe not—maybe not knowingly, but At any rate, I don't know.
Frustrating. Yeah, you're exactly right. You hit the nail on the head. Yeah, so R is totally open source. Um there's some like RStudio and things like that where they cost money if you're a company, but they're free if you're an individual. So that kind of solves the problem Patrick was talking about. One thing about R that's different than MATLAB is so R is, you know, a matrix-based, you know, kind of linear algebra um, um, you know, based language, but one thing is very different is R supports this thing called data frames, and data frames are awesome. It's basically like think of it as like a SQL database in memory—that's kind of the best way to explain it. Um so imagine if you had the SQL database or many of SQL databases sitting in memory and the entire sort of language that you're that all the code that you're writing can kind of take advantage of that database, like you have these sort of pseudo-SQL statements right inside of your code. So your code might say, 'You know, grab this data and then take all the rows where this one column is greater than 0.5.' And now you have a new SQL database that just has those rows. Um and then you do some other things to it and then do a group by and things like that. So it's really powerful. Um it's very cool, highly recommended. I recently—well, by recently, I mean like three years ago, I switched—not that recently. I switched from MATLAB to R, and I think it's great. I'm a big fan. It has tons of packages. Almost all the packages work on every operating system, so you don't have to worry about that. Um it even has support for Big Data, so there's this thing called RMR. I should never used it, so but it looks pretty cool, looks like it would be—it'd be pretty intuitive. It does MapReduce on R, and so the idea is if you have a big cluster full of machines, um as long as you use the RMR variant of the various functions, it will know to ship that data off to the cloud, um you know crunch on the numbers, and then and then ship back the result. Um some of the cons about R is uh it's like many open source projects. It's got this very fragmented community. Um the documentation is to be honest pretty terrible. Uh the documentation on R itself is great, but R kind of lives or dies by its packages, which is true for most of these languages, and the documentation—like if you're used to, you know, the Apache Commons um kind of documentation and just in general the job the kind of documentation you see on Java products uh projects, you'll be just supremely disappointed. So the documentation R is in R's packages is pretty terrible. Um but you'
mostly using R for it's like difference—like Python. Python is used for scripting, but a lot of people do build applications with it, but I've never—I mean, maybe you have—I've never seen anyone even try to build like an application with R. It's always like a script that runs right, like an application in that it runs from start to finish, but not like what you would normally build with like C or Java or C++.
GUI with it. Exactly. Yep. Um yeah, so there's uh many of the packages kind of lack support. Uh there's front ends that are kind of in various states of disrepair, kind of like we talked about Qt Octave being uh discontinued back on the MATLAB episode. So it's similar to R. I mean, RStudio is actually um has a lot of traction and now it's it's definitely in a good place, but the rest of them are basically defunct. Um yeah, for example, just to sort of like illustrate this, there's this library—there's this package called Zoo for handling time series, and all I wanted to do was I had some data that was not regular across time. So in other words, you know, some of like one of the data might be from Tuesday and then Wednesday and then Friday, and Thursday is just missing. And so I just wanted to linearly interpolate all of the days that were missing, and the Zoo package said it would just do that, and so I thought, 'Oh great, I don't have to do it myself. I'll just use this package.' And it just—it took me a whole day just because the documentation was kind of terrible. I kept getting weird errors, and um and so that's that's just something you kind of have to deal with, but uh then once you get kind of better at R and once you've kind of gone through the rigor, the ringer, then it's it's awesome and it has an incredible power.
It was developed at the University of Auckland by one Russ Ahaka and Robert Gentlemen, using some of the ideas that they got from us. And as Jason pointed out, a big deal with R is finding packages to help you do what you would like to do because everyone likes doing less work. But hopefully your package is easier to use than Jason's anecdotal experience about his time series plotting, and so some ones that we use before. So Jason mentioned Zoo, although his recommendation was kind of weak. Right, there's also Plotting—lots of plotting ones, so ggplot2, which allows you to use GNUplot from within R, or GNUplot. I don't know if people spell it out or say it. And then if you need to do web visualizations, you could use HTML Widgets, and if you're going to do some Markdown, you could use.
R Markdown. Yeah, definitely. So Bell Labs is still going. They had a couple of things pretty recently that were noteworthy. It said in July 2014 Bell Labs broke the broadband internet speed record with a new technology dubbed XG Fast that promises 10 gigabits per second connectivity speeds over what. So, oh, um 10 gigabits a second? That's not that impressive if you're talking about fiber. So I'm assuming they must be talking about the existing, you know, cable, right? I don't know. Yeah, because fiber can—I believe fiber wait. 10 oh no, sorry. 10 gigabits a second? That's a lot.
Code School is so big now that guy. Like he writes—he's really prolific. Either that or he's developed a platform and other people are writing. I don't know what the deal is, right? Every time I'm like, 'Oh, I need to learn a language for the show.' I'm like Code School. Oh, here we go. And it seems really reasonable, like the business model, which is like often basically like the first one is free, and then if you want more advanced ones, you have to pay. Yeah, it looks like they may have changed now.
I'm still sort of torn about R versus um Python with Pandas. So for people who don't know Pandas, adds data frames to Python. So you know how I was talking about data frames the whole like SQL kind of just built into your programming language? Um, Pandas is a library for Python that gives Python that power. And so once you have Pandas, I mean Python is much better documented and things like that. Um, I still I've been using R for so long, like three years now, so it's kind of hard to switch again to something else. Um, and R, R is definitely much more like MATLAB um than NumPy is, but uh um but this is this is pretty cool. Check it out. Definitely try R. You know, try try Python. Did you totally just
The thing is that it's not fair for me to say because I've been using Python for a decade, and so it's easy for me to feel like oh, it's much more comfortable for me to jump into Pandas than R because I've been using Python for so long. That's why I'm kind of torn. So I feel like I'm biased here. So definitely try both. It's easy enough to pick up R and start doing some cool stuff. R can, you know, ingest CSV, TSV, tab-separated files very easily. It's just a one-liner, and so it's easy to get up and running. Just to recap a few things. So the Book of the Show was The Hard Thing About Hard Things is my book of the show. Patrick's Book of the Show was Steel World. My tool of the show is Electron. You can check it out on GitHub. Patrick says that does not commute: the iOS and Android app, and we actually, the Patreon is doing pretty good, which is
End. Yeah, definitely, and thank you so much for your support on Patreon. That's definitely helping us in our bandwidth costs. We recently switched bandwidth—we switched hosting providers, and so let us know, especially if you have issues. So if downloading this episode was very difficult for you and it took three days or something kind of incredulous, tell us. Let us know because we're kind of messing around with the infrastructure right now, and it's important to get that feedback. Yep.
