Unsoundness in Pin - <AUTHOR> https://internals.rust-lang.org/t/unsoundness-in-pin/11311 <comment><USER2> (I was the primary designer of the Pin API.)

Since (to a first approximation) every individual who has the expertise and contextual knowledge to really evaluate this issue is a poster on internals.rust-lang.org, its pretty surprising to find this thread on the front page of Hacker News. I imagine some Hacker News users who upvoted this link did so out of technical interest, but I suspect a large portion of the attention comes from some combination of these misconceptions:

\- The misconception that this could have a practical impact on users (the code being discussed on the thread is all obviously pathological & contrived).

\- The misconception that Rust's type system and standard library never contain soundness issues and that this is an exceptional event (in fact we have a number of longstanding soundness issues).

We have a policy of fixing all soundness issues, so this issue will be fixed. In the meantime, while we decide the best solution, it will have no practical impact on Rust users. And none of the solutions we are considering would involve significant breakage to users, or invalidate any real code.

At a high level: the soundness issue occurs because the Pin API was designed based on certain reasoning about the behavior of pointers. This reasoning would be sound but for the fact that we have allowed certain exceptions in relationship to pointers to what are called the "orphan rules" (which usually enable local reasoning like this). These exceptions allow users to introduce code which, while contrived, allows them to violate the guarantees of the Pin API. Such is life.

<comment><USER3> > The misconception that this could have a practical impact on users (the code > being discussed on the thread is all obviously pathological & contrived).

Famous last words?

I mean I'm not an expert in Rust and even less in Pin, but I've seen my share of theoretical bugs thought of not possibly having any impact in the real world because of too theoretical. In other areas, when you debug a _triple_ segfault and you understand the crazy conditions that lead to it, or when you render a piece of C++ code _conforming_ instead of technically UB and it then starts to crash when in its UB form it worked perfectly, you start to consider that everything is possible :)

<comment><USER2> This is exactly the kind of comment that makes me dislike Hacker News so strongly, because I find it endemic here.

The idea that someone could think an issue is theoretical and then discover it is practically significant is obvious and no insight at all - it reduces to "people are sometimes wrong." I am declaring based on my significant relevant expertise that this issue is not practically important. Your comment contributes nothing but baseless contradiction.

</comment></comment></comment><comment><USER4> Simon Peyton Jones initial intuition [0] was that Rust would be full of soundness holes due to not starting with a full formalization. Derek Dryer, Ralf Jung and others in the RustBelt project [1] did amazing work in formalizing Rust's safety guarantees, showing that Peyton Jones' guess was not accurate.

There is nothing wrong about having bugs, of course, but the reaction to the bug in this thread shows that mathematical correctness is not as universally valued as I thought it would be. I agree with the sentiment that this is a bigger issue that shouldn't be discussed in a technical thread about a specific bug. However, after reading this, it is unclear to me whether mathematical correctness is regarded in the Rust project as an explicit goal, an explicit non-goal or an unessential nice-to-have. (I do not mean to insinuate anything with the word "unclear", as I believe all three options are valid and appeal to different use cases. Almost all of the popular languages don't care about this, for instance.)

[0] [https://youtu.be/t0mhvd3-60Y?t=130](https://youtu.be/t0mhvd3-60Y?t=130) [1] [https://plv.mpi-sws.org/rustbelt/](https://plv.mpi-sws.org/rustbelt/)

<comment><USER5> > However, after reading this, it is unclear to me whether mathematical > correctness is regarded in the Rust project as an explicit goal, an explicit > non-goal or an unessential nice-to-have. (I do not mean to insinuate > anything with the word "unclear", as I believe all three options are valid > and appeal to different use cases.)

It's a balance. We cannot drop everything, nor stop all development, in order to get proofs. However, we are actively working toward formalizing the language itself, because we do see value in it.

<comment><USER4> Totally reasonable stance, in my opinion, since Rust moves quickly and formalizing things takes time. But what is the stance on soundness bugs? Are they sometimes acceptable as permanent parts of the language, or is it a goal to eventually fix any soundness bugs that show up?

<comment><USER5> Soundness bugs are the only thing we make an exception in our stability policy for. In general, unsoundness is treated as a serious issue. However, "unsoundness" can mean a few different things; in the "semantics of the language" sense, they're taken very seriously. In the "there's a compiler bug" sense, they're taken seriously, but in accordance with how likely they are to affect end users, and how much work they are to fix. For example, an incorrect type signature in the standard library was fixed one day after release by changing it to the correct one and re-releasing; an issue where casting between floating points and integers causes some problems has still not been fixed, because it partially has to do with LLVM's semantics combined with our semantics, and it's not clear how to do the right thing while not seriously regressing performance. (That being said that particular issue has had a flurry of activity in the past week...)

The GitHub label for these bugs is A-Unsound, which has the description "A soundness hole (worst kind of bug), see: [https://en.wikipedia.org/wiki/Soundness"](https://en.wikipedia.org/wiki/Soundness").

<comment><USER4> Compiler bugs are not what I had in mind, so this answer is very reassuring! The original thread led me to believe this was not an absolute, official policy of the Rust project, but I am happy to hear it is.

<comment><USER5> For more details, here's the written part of this: [https://github.com/rust- lang/rfcs/blob/master/text/1122-lang...](https://github.com/rust- lang/rfcs/blob/master/text/1122-language-semver.md#soundness-changes)

Please note that threads on internals are able to be posted to by anyone; things expressed there may not represent the way that the team feels about things.

</comment></comment></comment></comment></comment></comment><comment><USER6> For the uninitiated: Rust differentiates between safe and unsafe code (safe being the default and unsafe needing the unsafe keyword). The unsafe code is like C/C++: it's more powerful than safe code, allowing you to do more things, including allowing you to trigger undefined behavour. Any mistake can possibly mean UB with all the consequences of crashes, wrong behaviour and nasal demons. Safe Rust on the other hand, is not supposed to be allowed to trigger such UB, no matter what you write. If you _are_ able to trigger UB in 100% safe code, it's considered a bug in the language, an unsoundness bug.

Note that it was known that Pin/Generators had soundness problems when you turned on noalias optimization flags [1]. They have however decided to stabilize it without fixing those problems as they could be fixed afterwards as well. I'm not entirely sure yet about the impact of this one, will have to read the thread I guess.

[1]: [https://github.com/rust- lang/rust/issues/62149#issuecomment-...](https://github.com/rust- lang/rust/issues/62149#issuecomment-521149328)

</comment><comment><USER7> Personally I am not convinced Pin is a good idea as it works now. Not because of this soundness bug but because it is too hard to understand. Just look at how much explanation is required in the manual and how large the code examples are.

[https://doc.rust-lang.org/beta/std/pin/index.html](https://doc.rust- lang.org/beta/std/pin/index.html)

<comment><USER8> Agreed that `Pin` is imposing by dint of trying to provide "more fundamental" guarantees than Rust was originally designed for (see my sibling comment on this topic). Though ideally in the long run I'd hope that no regular user would ever have to encounter it (right now I think it may show up in some contexts related to futures, but as Rust's async story matures I would hope to see that need diminish).

<comment><USER9> Pretty much anybody writing `async` code, using `Futures`, etc. needs to deeply understand `Pin`, pinning, etc.

Otherwise it is impossible to become productive with that part of the language.

<comment><USER5> End users will almost never need to deal with pinning whatsoever; they'll be writing code with async/await.

<comment><USER10> Even with async await it's not hard to run into it. The moment you end up wanting to box a future you run into pin.

</comment></comment></comment></comment></comment><comment><USER11> Unsoundness in Pin aside, I think the conversation between Boats and Ralph is more interesting - are soundness issues going to be so strange and edgecasey that they can be addressed as one-offs, or does rust need a more formal model to ensure edge cases are covered?

I have no answer, it's just the only interesting part of that discussion imo. Everything else is just details of an issue that's too weird to really fully understand for me, and not novel or interesting enough to invest into understanding, anyway.

</comment><comment><USER12> I am new to Rust, but this:

        for<'a, T: ?Sized> &'a T !: DerefMut

Seems like a hunk of unreadable code. Is this valid Rust?

[https://internals.rust-lang.org/t/unsoundness-in- pin/11311/3...](https://internals.rust-lang.org/t/unsoundness-in-pin/11311/33)

<comment><USER13> No, it's bits of valid syntax thrown together informally to express an idea. There is no `!:` in Rust, and that `for` quantification never applies to types or bounds that way.

<comment><USER14> `for` used in a bound (in conjunction with a lifetime) is the syntax for Higher-Rank Trait Bounds (HRTB):

[https://doc.rust-lang.org/beta/nomicon/hrtb.html](https://doc.rust- lang.org/beta/nomicon/hrtb.html)

<comment><USER13> Yes, but it's not used that way in this snippet...

</comment></comment></comment></comment><comment><USER8> For those who haven't heard of `Pin` before (which is reasonable even for Rust users, for whom this is a rather obscure corner of the standard library): it's essentially a trait that indicates that a value cannot be moved from its current location in memory.

Here's an analogy: Rust already differs from most languages in that the behavior that you get "by default" when defining a new type is very limited. For example, if I define a type `struct Foo`, then by default this type can't be copied around: `let x = Foo; let y = x;` is a simple operation that in most languages would involve copying memory, but in Rust involves a _move_ instead. You can think of a move as a copy where the original value is no longer accessible (whether or not any bytes in memory _actually_ get copied as a result of a move is an implementation detail, and is (hopefully) often optimized away). In order to make our type copyable, we would add an implementation of the `Copy` trait.

The observation is that moving is a more fundamental operation than copying, therefore, it is easier for types to opt _in_ to copying than to opt _out_.

When Rust was released in 2015 this was a relatively radical concept for a language targeting a mainstream audience (we're essentially describing Rust's entire concept of ownership here, after all). But it turns out that it's possible that Rust may not have been radical enough! Consider: what if you want a type that not only can't be copied, but can't be _moved_ as well?

Before Rust 1.0 it wasn't clear that such a concept of "unmoveability" would be generally useful. There were certainly cases, such as self-referential structs, that could have benefited from such a concept, however making moveability opt-in rather than opt-out would have required all types that _do_ want to be moveable to explicitly announce that fact (via something like `#[derive(Move)]`), which is an annotation burden on all other code that must be considered.

It wasn't until the async/await work that another, more critical need for unmoveability was found: if the generators interally produced by `async` are capable of moving, then that means that generators are incapable of containing references, which means that async/await would become drastically less useful; there would be an entire fundamental part of the language that simply couldn't be used with it. Thus `Pin` was born in order to denote things that cannot be moved (and whose design is itself a very, very long discussion).

For this reason I'm somewhat amused by one of the comments in the OP asking something like "if `Pin` had remained unstable for an additional year, would this particular instance of unsoundness have been caught?" Because, conversely, we could ask whether Rust itself could have remained unstable for another five years and found a design that would have obviated `Pin` entirely by making moveability opt-in. However, of course, such things are easy to ask in hindsight, and stability is a prerequisite for having a broad base of adoption. Finding a balance between immediate stability and eventual perfection is the holy grail of industrial language design.

(Regarding the bug in the OP itself, I think it's unfortunate but I'm not especially worried by it at this juncture. The fact that Ralf Jung's team is looking into it gives me confidence that formal methods will eventually be applied here to more thoroughly explore the soundness of `Pin` in general (Ralf being one of the people who shaped `Pin` originally), and in the meantime I wouldn't be opposed to a band-aid fix, given that working extensively with `Pin` in the way shown in the OP is rare for normal users.)

<comment><USER15> > Before Rust 1.0 it wasn't clear that such a concept of "unmoveability" would > be generally useful

I'd like to ask, why is moving generally useful? Why would I want to move x to y and invalidate x?

<comment><USER5> We can go back to the reason that Pin even exists in the first place. With Rust, you create a computation, and it implements the Future trait. When you want it to execute, you give it to an executor. This often moves the data structure that represents the computation to the heap, so that it has a stable address, and can continue running after the current stack frame is over. So, before the future starts executing, it can be moved around in memory (and probably will at least one time), but after it starts executing, it must never move again.

Does that make sense?

<comment><USER15> So the main use is convenience to seamlessly make stack variables permanent? Intuitively that doesn't sound worth the language design troubles compared to making the programmer declare these things on the heap manually. I'm not that familiar with Rust though.

<comment><USER5> That's one use case, it's not the only one. And it's not always "put it on the heap", so you can't solve the issue that way.

</comment></comment></comment></comment></comment><comment><USER16> I didn't follow all of it, but it sounds not so bad.

1 & 2 both involve unsafe code that, while possibly reasonable in a complex application, is obviously wrong in the simple case. Of course turning a reference into a mutable reference will cause trouble. Was Pin SUPPOSED to be resilient to unsafe code? In any case, seems like a bug in DerefMut and Clone, not Pin.

The others are a bit more esoteric and do seem potentially concerning, but I'm not sure.

But still, I'm left with my earlier question: just how resilient is Pin supposed to be?

<comment><USER5> > Was Pin SUPPOSED to be resilient to unsafe code?

Remember, unsafe does not mean "I can do whatever I want," it means "I am promising to uphold some guarantee on my own." That is, let's assume we have a function:

      /// Makes a new Foo.
      ///
      /// # Safety
      ///
      /// x must never be greater than 5
      unsafe fn new(x: i32) -> Foo {

and you write

      let x = 6;
      unsafe {
          new(x);
      }

You have a bug, even though new is marked unsafe.

In my understanding of the unsafe examples above, the unsafe code was upholding the invariants that it was required to uphold, and so would be more like having written `let x = 2;` in the above example, if that caused an issue, clearly there's a bug.

<comment><USER16> I think this is a little too dumbed down for me to see the relevance to the actual problem.

Also, I believ 1&2 both require unsafe code to implement the trait that allows the unsoundness.

For what &T can I safely implement DerefMut? Is it the fault of Pin that a type has DerefMut implemented that the unsafe block of that implementation doesn't uphold safety?

<comment><USER5> The relevance to the problem is that even if these examples needed unsafe code, that doesn't mean that there's no problem. "resilient to unsafe code" is not the right way to think about unsafe.

> For what &T can I safely implement DerefMut? Is it the fault of Pin that a > type has DerefMut implemented that the unsafe block of that implementation > doesn't uphold safety?

It is the fault of Pin's safety guidelines, which suggest a contract that is not actually enough to uphold safety. That's why this is considered an unsoundness in Pin, and not a problem with the code written with unsafe. That is:

> that the unsafe block of that implementation doesn't uphold safety?

is not correct, the unsafe block does everything it's supposed to to uphold safety.

<comment><USER16> I can see the argument that Pin should be safe if you meet the contract it claims to need. The requirements are not sufficiently tight. Fair enough.</comment></comment></comment></comment></comment>


Static Memory JavaScript with Object Pools (2013) - <AUTHOR> https://www.html5rocks.com/en/tutorials/speed/static-mem-pools/ <comment><USER2> That isn't reading the graph correctly. The saw tooth pattern means that memory is being allocated, but not that it's slow. The CPU usage graph tells you if it's slow.

Object pooling is generally considered to be the worse approach, because it's tricky to know when to put object back in the pool. Realistically this mean ref counting. The code will get more complicated and bugs will happen when an object is returned to the pool but is still used. Each object will get bigger, since now it has to have an extra word associated with it.

Also, this puts undue stress on the GC. Collections won't pick up pooled objects, even when they could have been. This causes memory pressure because the program may actually need to allocate a large amount of memory, but none could be freed up.

I think the real answer here is to just do less work. Don't try to change a program to let it keep using lots of memory. Instead, make it so it needs hardly any memory in the first place.

<comment><USER3> > I think the real answer here is to just do less work. Don't try to change a > program to let it keep using lots of memory. Instead, make it so it needs > hardly any memory in the first place.

I mean sure, if you can. Fundamentally games need to maintain a fairly large a mount of state you can't wave that away. For a lot of games that means rapidly changing state too for example bullet hells constantly instantiating and destroying each bullets can get crazy expensive.

Object pooling is pretty simple for games because the logic is already there. Whatever game logic was causing the game object to be destroyed moves it back into the pool instead.

</comment></comment><comment><USER4> Probably want a (2013) in the title. JS GC is a lot better now than back then.

There's 2 main challenges to a pool based approach

1) Knowing up front how much memory you'll need 2) Complex DOM object pooling

In practice 1 gets solved by growing your pool, this also solves the problem with startup delays due to pre-allocation, but you need some way of knowing when to stop growing the pool and potentially evicting/re-using pool members. You can easily find yourself simply having written a much worse garbage collector of your own.

#2 is the realm of things like React-Virtualize. You need to be cognizant of acquiring handles to browser resources, and how to manage those life-cycles. You can end up in a case where your pool is 95% properly managed, but the leaky 5% still makes costly GC pauses.

<comment><USER5> Memory management/garbage collection is not defined by the JavaScript language specification.

It is 100% vendor specific. As such, each Garbage Collector implementation can behave in any way arbitrary way they see fit.

</comment></comment><comment><USER6> Important to note: this effectively disables garbage collection, and therefore obviously can lead to a LARGE increase in memory usage.

In C++, there are kinds of programs where "#define free(x)" results in the same effect, including the large speedup.

But this is an important trick that also works in Java, C++ and Go.

It can be combined further. For instance, where you're keeping track of many small pieces of a big chunk of data, having the big chunk somewhere with a big primitive type array containing the actual data and then having Flywheel pattern accesses to it can result in incredible speeds.

</comment><comment><USER7> When you are finding tricks to do manual memory management in a GC language its probably time to use a different language.

<comment><USER8> Shit on the language all you want. Not only is it irrelevant, but also ill informed since a lot of performance critical things need to happen in the web environment. As such it is bound to happen in JS. No escaping it.

<comment><USER7> It is not "shitting" on any language to point out that there are many tools and using the right tool for the job at hand is the way to go.

> a lot of performance critical things need to happen in the web environment

Can you provide a single example of a real world web app that uses manual memory management as described in this article?

<comment><USER8> How is that relevant? There are definitely cases were it would be beneficial.</comment></comment></comment></comment>


Cancer in America Is Way Down, for the Wealthy Anyway - <AUTHOR> https://www.bloomberg.com/news/articles/2019-01-08/cancer-in-america-is-way-down-for-the-wealthy-anyway <comment><USER2> I am currently reading the book "The Hundred-Year Lie: How to Protect Yourself from the Chemicals That Are Destroying Your Life" by Randall Fitzgerald. It details the crazy amount of synthetic or toxic chemicals in our daily lives, pesticides on our food, and a list of other pollutants to the body. Just from reading that this article it doesn't surprise me, and I would be surprised if this trend doesn't continue and accelerate. The poorest Americans are deceived into a false sense of wealth by being able to purchase cheap, synthetic, and toxic alternatives to quality products that only the well off can likely afford. Everything from natural furniture, organic foods, natural material clothing, cosmetics and care products, and medicine are much more costly than their toxic, cheap alternatives. This will also increase the divide between the wealth and the poor since the brain is affected by the chemicals that we are exposed to resulting in lack of concentration, poor memory, irritability, impulsiveness, and even the resulting gut bacteria affects the brain through the vagus nerve. The poorest Americans also have jobs, and live in areas which expose them to more pollutants than the wealthy, and the bigger issue is that a lot of these people don't even realize that this is an issue. Trust in institutions like the FDA, aggressive marketing by corporations like deceitful labeling of foods to try and make them "sound" healthy, and general lack of education make them super vulnerable and at the whims of the highly education, profit-obsessed, shareholder-serving, psychology-understanding, resource-rich, lobbying elite

<comment><USER3> There are certainly issues of this sort. I've seen references to "environmental racism" where poor neighborhoods like Altgeld Gardens in Chicago are built on top of reclaimed landfills, and the water pipes are all made of lead. And Camden, New Jersey had very similar problems being a site of major industrial pollution.

On the other hand, the upper middle class obsession with purity and organic stuff verges on neuroticism and New Age mysticism. Much of the panic over chemicals involves only trace amounts. Like how formaldehyde in vaccines is extremely tiny compared to formaldehyde in pears, yet it is used as a reason not to vaccinate. Or how sea salt has been replacing iodized salt, even though rates of iodine deficiency in the West are rising, and this is a major problem for cognitive development.

<comment><USER2> One of the arguments in the book I mentioned was that yes the trace amounts are "safe", but in some cases the body cannot detox certain synthetic chemicals, so they build up in the body until they reach a level that begins to cause health issues

<comment><USER4> Broadly, this corresponds to the use "threshold model" and "linear no- threshold model" in toxicology, which describe whether the risk/harm from a substance has a safe 'cliff' or declines smoothly down to 0 dose.

It's well understood that carcinogens are LNT hazards. The old quip that "even breathing causes cancer" is literally true, so there's no such thing as a safe dose of a carcinogen, just an acceptable dose. (Interestingly, effectively- safe doses decline as lifespans - and therefore cumulative risk - rise.) Increasingly, we seem to be finding that non-carcinogenic risks which have been filed under 'threshold' are actually LNT threats for which the low-end risk gets lost in other noise.

I'm not particularly sold on the 'synthetic' framing here, though. Lead exposure is almost certainly LNT at least in childhood. Copper and zinc are linked to Alzheimer's in some uncertain-but-suspicious way. While endocrine disruptors like BPA are synthetic, they're acting on the same pathways as 'natural' disruptors like phytoestrogens. 2.5nm particulate pollution now appears to be not only carcinogenic but also development-inhibiting; the primary sources are man-made but the primary agents (NOx, SO2) are naturally occurring at much lower doses.

Very broadly, I do expect many thing we're exposed to today will eventually be viewed as horrible errors like leaded gasoline (if hopefully less severe). But I'm not sure 'synthetic' is a meaningful metric, and I'm not sure bioaccumulation of the compound is actually a very common pathway relative to accumulative damage.

</comment></comment></comment></comment><comment><USER5> From the source:

> _" Population‐based cancer incidence data in the United States have been > collected by the National Cancer Institute's (NCI's) Surveillance, > Epidemiology, and End Results (SEER) Program since 1973 and by the Centers > for Disease Control and Prevention's (CDC's) National Program of Cancer > Registries (NPCR) since 1995. The SEER program is the only source for > historic population‐based incidence data. Long‐term (1975–2015) incidence > and survival trends were based on data from the 9 oldest SEER areas > (Connecticut, Hawaii, Iowa, New Mexico, Utah, and the metropolitan areas of > Atlanta, Detroit, San Francisco–Oakland, and Seattle–Puget Sound), > representing approximately 9% of the US population."_ > [https://onlinelibrary.wiley.com/doi/full/10.3322/caac.21551](https://onlinelibrary.wiley.com/doi/full/10.3322/caac.21551)

So, looks like the headline chart[1] is only using data from the 9 original SEER regions (Connecticut, Hawaii, Iowa, New Mexico, Utah, and the metropolitan areas of Atlanta, Detroit, San Francisco–Oakland, and Seattle–Puget Sound). Also, some new data source was added in 1995, which is about when we see that peak in incidence/mortality. So we have some room for systematically biasing the data here, especially when we consider the various pitfalls of "age-adjustment".

They also say much of the mid-1990s spike in incidence for males was due to detection of asymptomatic prostate cancer:

> _" Cancer incidence patterns reflect trends in behaviors associated with > cancer risk and changes in medical practice, such as the use of cancer > screening tests. The volatility in incidence for males reflects rapid > changes in prostate cancer incidence rates, which spiked in the late 1980s > and early 1990s (Fig. 3) due to a surge in the detection of asymptomatic > disease as a result of widespread prostate‐specific antigen (PSA) testing > among previously unscreened men"_

[1] [https://wol-prod- cdn.literatumonline.com/cms/attachment/4799...](https://wol-prod- cdn.literatumonline.com/cms/attachment/479916e1-e899-4965-a35d-7517620064cf/caac21551-fig-0002-m.jp)

</comment><comment><USER6> There is no data (or even a link to a study) in this article that gives the the reader any sense of what the mortality gap between the wealthy and poor is, or even how "wealthy" and "poor" are defined. I come away from this article with a better idea of the male/female mortality gap than the wealthy/poor gap (one of the article's two headline claims).

I've noticed that politicized headlines in non-editorials that aren't suppprted by any facts or data are an increasing media trend in the past few years. I saw this in another article I commented on a few days ago.

[https://news.ycombinator.com/item?id=18794757](https://news.ycombinator.com/item?id=18794757)

If it's a real problem (which I believe it probably is), journalists shouldn't ignore "show, don't tell" in their writing.

<comment><USER4> I agree that this is common and troubling.

I ended up on this soapbox after a recent study showing academic-performance harm from fine particulate matter in the air. The article had no numbers, so the HN thread was full of (weirdly politicized) speculation about American intelligence. Meanwhile, the underlying study showed modest effects in parts of China where daily particulate levels average 10x higher than the very worst "stay indoors" days in America. It was an interesting study, but the headlines it produced were actively making people less informed.

It's a particularly damning problem in this article because there are so many different ways to read this result. It could be that rich people get better or more intensive care after diagnosis. Or that they're more likely to get regular checkups and so are on average treated at an earlier stage. Or that with HPV vaccine not on the scheduled list, many insurers won't cover it and so the rich face less cervical cancer. Or simply that rich people are less likely to smoke and live with smokers. Or, especially since the long-term data here comes from a small set of disproportionately-urban regions, wealth is acting as a strong proxy for environmental exposure.

And even lay readers can discern those things! If rich people have lower incidence, that's different than lower mortality per incidence. Major risk factors like smoking can be adjusted for. We're told that wealth used to correlate with cancer, but the only summary of the change is the vague "in part to changes in diet and smoking as well as screening and treatment rates". This article needed, at minimum, a graph of incidence and mortality by income.

</comment></comment><comment><USER7> Wow, the disparity in male vs female incidence and mortality is astonishing - almost twice as many men as women get and die of cancer every year.

<comment><USER8> I wonder if it's because men are much more likely to smoke and drink heavily...

<comment><USER9> Probably also because unlike women..men will wait a long time to go to the doctor

<comment><USER10> More likely it's due to the fact that men are more likely to work in fields that force them into contact with carcinogens. Road workers, oil rig workers, construction workers, etc.

</comment></comment></comment></comment><comment><USER11> Hypothesis: Some significant fraction of the wealthy/poor disparity is because the poor now smoke significantly more than the rich.

<comment><USER12> And statistically speaking, the poor are overwhelmingly very obese, whereas the wealthy are fit/thin. Fitness is a new class indicator.

Over 80% of Americans are obese or overweight, largely due to lifestyle choice, food addiction, and food abuse. Obesity and related disease are by far the leading cause of death and illness in the USA, it's an extraordinarily costly epidemic that nobody wants to acknowledge.

<comment><USER13> can i get a citation on that 80%? i know we're fat but..

<comment><USER14> The numbers I can find are closer to 70 than 80%, but still. The really scary number is that the obesity rate is closing in on 40%. So the majority of people who are overweight or obese are in fact obese!

[https://www.niddk.nih.gov/health-information/health- statisti...](https://www.niddk.nih.gov/health-information/health- statistics/overweight-obesity)

[https://www.cdc.gov/nchs/data/databriefs/db288.pdf](https://www.cdc.gov/nchs/data/databriefs/db288.pdf)

</comment></comment></comment></comment><comment><USER15> For those of you who just want main point:

 _There's a caveat, however: Those gains have been reaped mostly by the well- off. While racial disparities have begun to narrow, the impact of limited access to treatment for the poorest Americans has increased wealth-based inequality, according to the American Cancer Society's annual update on trends and statistics._

<comment><USER16> Metal cutlery was only available to the wealthy in the middle ages. At some point they became widely available for everyone.

Such is the way with most technological advances, where the high price initially payed by the rich is turned into more productivity and lower production costs, resulting in greater availability.

<comment><USER17> Ah yes, the past 40 years of wealth gains will trickle down on us any day now!

<comment><USER13> that's been the pattern for all of our industrialized history, there's no reason to be skeptical that it will suddenly stop happening</comment></comment></comment></comment>


Comcast and other internet services seem a bit broken nationwide this morning - <AUTHOR> https://techcrunch.com/2017/11/06/comcast-xfinity-slow-outage/?ncid=rss <comment><USER2> Sure seems that way. Just ask any Azure customer using the North and South central data centers.

</comment><comment><USER3> can't even use restore NuGet :( damn.</comment>


Ex-Palantir Employees Are Struggling to Sell Their Shares - <AUTHOR> https://www.buzzfeed.com/williamalden/ex-palantir-employees-are-struggling-to-sell-their-shares <comment><USER2> Complete newbie question - If a company isn't yet in public market, where and how do the ex-employees sell their stock? Who controls/decides the prices and who are allowed to buy such stocks?</comment>


The Home Depot confirms payment systems breach - <AUTHOR> http://ir.homedepot.com/phoenix.zhtml?c=63646&p=irol-SECText&TEXT=aHR0cDovL2FwaS50ZW5rd2l6YXJkLmNvbS9maWxpbmcueG1sP2lwYWdlPTk3OTYwNDImRFNFUT0wJlNFUT0wJlNRREVTQz1TRUNUSU9OX0VOVElSRSZzdWJzaWQ9NTc%3d

<comment><USER2> (1) Don't use debit cards. You're much better protected as a consumer when you use a credit card. [http://www.bbb.org/blog/2013/11/do-debit-cards-and-credit- ca...](http://www.bbb.org/blog/2013/11/do-debit-cards-and-credit-cards-hav- the-same-protection/)

(2) Use BillGuard [https://www.billguard.com/](https://www.billguard.com/)

(3) Review your transactions every week or so via a personal finance tool (I use [https://www.mint.com/](https://www.mint.com/))

I don't particularly care if my payment credentials are compromised as it's highly unlikely a fraudulent charge would go unnoticed by me just using the advice above. It's quick, easy to set up, and stuff you really ought to be tracking anyway.

<comment><USER3> Or use cash and forget about all this other stuff ;)

<comment><USER4> Oh the irony of how using cash is safer these days. You expose yourself to an internet full of thieves using plastic, but with cash it's only to the handful of people you actually cross paths with.

<comment><USER5> Only if you get the cash via bank teller though. Skimmers make using ATMs risky as well.

</comment></comment></comment></comment><comment><USER6> Love the EMV plug, as if it'd actually have helped. EMV transmits the card information in the clear, it only makes physical copying of the cards harder (Which really doesn't matter since credit cards can be used online).

The only thing EMV would achieve is making this data slightly less valuable, but still worth it for the attacker. Replacing the EMV cards would also be more expensive by an order of magnitude.

tl;dr: if you use your EMV card on a compromised POS, you'll be as fucked as you'd be with a magstripe card. Your bank will be ten times as fucked.

<comment><USER7> > Which really doesn't matter since credit cards can be used online

Don't you need the printed CVV for that? Which isn't stored on either the magstripe nor the chip.

edit: 3DSecure would also help if banks cared to push it harder (for instance my bank now disallows all online debit card charges that don't use 3DSecure)

<comment><USER6> No, you really don't need the printed CVV for that. And several cards have actually had the CVV on the chip.

Also, in many cases the chips actually contain enough information to replicate the magnetic stripe. (Which is well, bad.)

<comment><USER8> EMV tag 57 [1] generally contains the "Track 2 Equivalent Data", and 5A the account number (PAN) [2]

[1] [http://www.emvlab.org/emvtags/show/t57/](http://www.emvlab.org/emvtags/show/t57/) [2] [http://www.emvlab.org/emvtags/show/t5a/](http://www.emvlab.org/emvtags/show/t5a/)

<comment><USER9> That's not the same CVV.

Edit: Even having the track 2 data won't do you any good in reproducing an EMV card. The only way reproducing a mag stripe EMV card is useful, is if it is used at a non-EMV terminal and mag stripe is the only option.

I believe Europe has complete banished mag stripe now.

</comment></comment></comment></comment></comment><comment><USER10> I wonder if this will be less of an issue here in Canada with our euro-style chip & PIN setup. _In theory_ the attackers wouldn't have long-lived access to any of the payment information. I suppose we'll see.

The attackers probably have my name/email address/mailing information, which kind of sucks.

<comment><USER3> It is not clear to me why they would have your name, email address, and mailing information? For example, I recently purchased some items from home depot and used my debit card + pin, other than rolling the pin, what else should we be doing?

Do you have a home depot CC?

<comment><USER10> I don't have a Home Depot CC, but I've used their e-receipts in the last couple of months and I'm reasonably sure that I've ordered online from them in the past.

I certainly hope they didn't compromise the PIN pads in the stores. That could be a Very Bad Thing.

<comment><USER8> From what I've read so far, this was another case of memory scraping malware[1], most likely running on each POS. The pinpads typically have tamper protection, though I wouldn't completely discount the possibility that we'll see malware at the pinpad level at some point in the future.

[1] [http://krebsonsecurity.com/2014/09/home-depot-hit-by-same- ma...](http://krebsonsecurity.com/2014/09/home-depot-hit-by-same-malware-as- target/)

</comment></comment></comment></comment><comment><USER4> > The Home Depot is offering free identity protection services, including > credit monitoring, to any customer who used a payment card at a Home Depot > store in 2014, from April on.

This is absolutely not acceptable, and I deplore how this has become the status quo. I reject these services and want nothing less than a full lawsuit.

<comment><USER6> A lawsuit which you would lose. Especially considering you most likely suffered no damages.

<comment><USER4> I'm pretty sure the card processors would be on my side of the lawsuit, along with a few million other home depot customers.

I don't care about damages to me. I want the problem fixed. This Laissez-faire attitude towards online commerce security needs to end. Standards like PCI and PA-DSS are not enough. Corporations need to be liable for leaking everyone's information. A year of free credit monitoring is a slap in the face.

<comment><USER6> Card processors might have a case, but the customers really mostly wouldn't.

The PAN that belongs to your credit card company that was assigned to you by your credit card company was compromised and someone tried to defraud your credit card company using it. Yet it's you complaining, why?

<comment><USER4> I've been screwed by identity theft before.

<comment><USER6> Sure, but the only real solution would be not accepting cards. Does that sound like a good solution to you?

<comment><USER11> Not sure you are being productive.

<comment><USER6> Not sure about that either, but trying to blame Home Depot for fundamental flaws of the system isn't productive either. You should blame the card design for allowing this, not the people that accept cards.

<comment><USER11> While the card design could be better, those that accept them have a responsibility. The bigger you are and the more cavalier with card data, the more likely you will get targeted. I have yet to see one of these data breaches where the victim (if we call it that) company was doing a very good OpSec job.

You both have a point, but lean towards more punishment. This isn't something that should just be 'charged' away.

</comment></comment></comment></comment></comment></comment></comment></comment></comment><comment><USER12> It seems to me like the breach may still be ongoing/the vulnerability may still exist. In the announcement, they use "have been" as in its actively occurring. Additionally, in the press release ([http://ir.homedepot.com/phoenix.zhtml?c=63646&p=irol- newsArt...](http://ir.homedepot.com/phoenix.zhtml?c=63646&p=irol- newsArticle&ID=1964976&highlight=)), they don't indicate that the breach has stopped; they only say they have taken aggressive action.

It seems unlikely that the attack would continue since the attackers have lost their cover, but the wording is a bit strange.

<comment><USER8> I also found it strange how they worded things around the identity protection, "from April on", rather than something like, "From April XX, 2014 until September XX, 2014". Perhaps they just simplified the wording to make it clear that they're providing protection, and I'm reading too far into things :)

</comment></comment><comment><USER13> encouraging that they are using this as a motivator to "roll out EMV "Chip and PIN" to all U.S. stores by the end of this year" ahead of the prescribed deadline.

edit: "Chip and PIN" is taken directly from the sec filing that is linked.

the described deadline of october 2015 for the liability shift comes from banks[1] and not a US law or similar.

[1] [http://en.wikipedia.org/wiki/EMV#United_States](http://en.wikipedia.org/wiki/EMV#United_States)

<comment><USER14> Would it actually have helped, though? I was under the impression that the Chip and PIN POS terminals don't do anything differently as far as the part between themselves and the authorizer goes - if somebody hacks one, they can still get everything they need to charge against the card. If so, it's more of an issue of firewalling properly at the individual store and corporate level.

<comment><USER15> Your impression is incorrect. Current EMV cards do something called DDA, so charging the card (as a card-present transaction) requires the card to be physically present or you to have cloned the application off the card (which the card is designed to prevent you from doing.)

You can still get the _magstripe_ data if you compromise the terminal, but the network will (eventually) reject magstripe transactions made by a chip-capable card in a chip-capable reader. You can get the transaction certificate for one transaction, but that TC is protected from replay attacks.

<comment><USER16> Yup you are correct. The chip acts as a proof of presence and a second factor of authentication. It is technically possible to export the cert off of the chip but it would cost several hundred thousand dollars and a lab with a Focused Ion Beam :)

</comment></comment></comment></comment><comment><USER17> Official SEC Edgar filing: [https://www.sec.gov/Archives/edgar/data/354950/0000354950140...](https://www.sec.gov/Archives/edgar/data/354950/000035495014000034/hd_8-kx982014.htm)

</comment><comment><USER18> Some home depots let you pay with paypal as well.

<comment><USER8> It will be interesting to see if any Paypal account compromises can be attributed to this breach. From what I've read, this type of malware typically scrapes the memory of processes on the POS, looking specifically for what appears to be track data, and which passes a Luhn check.</comment></comment>


Get your Google calendar into tmux - <AUTHOR> https://blog.hauck.io/get-your-google-calendar-into-tmux/

<comment><USER2> FYI: Your blog only shows a spinner unless the user allows Javascript for no reason at all.

<comment> hauck-d Hey, thanks, Yesterday I changed the theme, which does this... thanks for the hint! ;)

<comment><USER3> You also don't advertise your RSS feed[1] in the headers (or otherwise).

[1] [https://blog.hauck.io/feed/](https://blog.hauck.io/feed/)

<comment> hauck-d Ok, I switched back to the non premium version, I got RSS-Feed back again and no weird scrolling stuff :)

Thanks for the hint!

</comment></comment></comment></comment><comment><USER4> As a sidenote, gcalcli is the best way to manage your google calendar. I always found creating calendar entries through apps or web such a nuisance that I just didn't bother.

<comment> hauck-d Same to me but with owncloud or davical. But now I needed to use gcal for work. Graphical nonsensestuff ...

</comment></comment><comment><USER5> This is really useful. I've always wondered (but never bothered to search) if there was a cli interface for Google calendar. Integrating it into tmux is a nice bonus.

I really should setup my gmail account in mutt, it could save me a lot of alt- tabbing time.

</comment><comment><USER6> Also on topic: khal is a pretty good cli calendar app:

       https://github.com/geier/khal/

It's designed to work with CalDAV, though IIRC, google is moving away from standard protocols and onto their own, regrettably.

</comment><comment><USER7> Unfortunately, I couldn't get this to work. Here is the traceback: [http://hastebin.com/yibusifogi.vhdl](http://hastebin.com/yibusifogi.vhdl)

Also, nice function name `BowChickaWowWow` :)

<comment><USER8> Looks like you may need to upgrade six (dependency of the Google API library). `pip install six --upgrade` may do the trick

</comment></comment><comment><USER9> Your bash looks like something that can be fixed by a well-placed sed one- liner :)

<comment> hauck-d Yes, I know, I will give it a try, and update my post ;) Thanks!

</comment></comment><comment><USER10> Oh my god, this is awesome! I guess it would became my fav command line tool.

</comment><comment><USER11> Now to hook it up to twilio and get my sms notifications back.

</comment><comment><USER12> You mention:

> Be sure to replace GOOGLE_USERNAME with your accountname(everything in front > of @gmail.com).

Where are you replacing GOOGLE_USERNAME?

<comment><USER12> Figured it out

set -g status-right '📅 #(gcalcli --nostarted --calendar "GOOGLE_USERNAME" agenda --nocolor | cut -d " " -f 4- | head -2 | tail -1 | sed "s/^ *//g" | sed "s/ / /g" | cut -c1-19)'

</comment></comment><comment><USER13> Getting a "daily limit exceeded" error from the Google API client.

<comment><USER8> Hi, we are working on getting that lifted (I'm one of the maintainers.) Right now you're best bet is to sign up for your own API key/secret and supply those via either a config file or command line arguments:

      --client_id API client_id
      --client_secret API client_secret

See [https://github.com/insanum/gcalcli/issues/65#issuecomment-13...](https://github.com/insanum/gcalcli/issues/65#issuecomment-13911462) for details on how to get those.

<comment><USER13> Hey, thanks for the info. I've tried that, but now I get a "Error: redirect_uri_mismatch" error.

edit: I got it working. When creating a new client id, you need to choose "Installed application" as the application type.

</comment></comment></comment><comment><USER14> hmmm interesting</comment>


San Francisco Technology Humor Meetup - <AUTHOR> http://www.comedyvsnerds.com/?show=3

<comment><USER2> looks cool but one of the "comedians" is a girl. and we all know they can't be funny

<comment><AUTHOR> I think girls in Tech ARE funny

<comment><USER2> Good point, I agree. Girls in tech are hilarious, like shrimp in ice cream</comment></comment></comment>


Ask HN: How to get started with machine learning? - <AUTHOR> How should a software engineer with no machine learning background get started on the subject? Do you think that getting started by learning a framework like TensorFlow is a good idea or should I gain a background knowledge first? <comment><USER2> If you want to jump right in with "hello world" type TensorFlow (a tool for machine learning), see [https://news.ycombinator.com/item?id=12465935](https://news.ycombinator.com/item?id=12465935) (how to fit a straight line using TensorFlow)

If you like to study/read: the famous Coursera Andrew Ng machine learning course: [https://www.coursera.org/learn/machine- learning](https://www.coursera.org/learn/machine-learning)

If you just want course materials from UC Berkeley, here's their 101 course: [https://news.ycombinator.com/item?id=11897766](https://news.ycombinator.com/item?id=11897766)

If you want a web based intro to a "simpler" machine learning approach, "decision trees": [https://news.ycombinator.com/item?id=12609822](https://news.ycombinator.com/item?id=12609822)

Here's a list of top "deep learning" projects on Github and great HN commentary on some tips on getting started: [https://news.ycombinator.com/item?id=12266623](https://news.ycombinator.com/item?id=12266623)

If you just want a high level overview: [https://medium.com/@ageitgey/machine- learning-is-fun-80ea3ec...](https://medium.com/@ageitgey/machine-learning-is- fun-80ea3ec3c471)

<comment><USER3> What is a good "hello world" _project_ for machine learning? That is, what problem can I solve or question can I answer with minimal ceremony, and ideally with multiple techniques / technologies so that I can compare them? Is it this house price estimation like in your last link, or is there something better than that?

<comment><USER4> Kaggle has a number of starter challenges. See [https://www.kaggle.com/c/titanic](https://www.kaggle.com/c/titanic) for one related to predicting the survival of passengers on the Titanic.

<comment><USER5> Lol. Predicting the survival of passengers on the Titanic is meaningless and misleading - there is literally no connection to reality, despite the framing of the task which suggests a certain connection. There is absolutely nothing that could be predicted. It is just a simulation of oversimplified model which describes nothing, but an oversimplified view of a historical event. It is as meaningless as the ant simulator written by Rich Hickey to demonstrate features of Clojure - it has that much connection to real ants.

<comment><USER6> It's very closely correlated to reality.

If you work through the data, you'll find things like women, children and first class passengers had a higher survival rate than men with lower class tickets[1].

This matches exactly the stories of what happened: Staff took first class passengers to the lifeboats first, then women and children. Then they ran out of lifeboats.

So the data shows correlation, and eye-witness accounts shows causation. That's close to the ideal combination: eyewitness accounts can be unreliable because we can't know how widespread they are, and correlation doesn't show causation.

But the combination of them both is pretty much the best case for studying something which can't be replicated.

[1] See examples like [https://www.kaggle.com/omarelgabry/titanic/a-journey- through...](https://www.kaggle.com/omarelgabry/titanic/a-journey-through- titanic)

<comment><USER5> This is only one of many aspects of that event. The data reflects that the efforts of organized evacuation in the beginning were efficient.

But any attempt to frame it as a "prediction", an accurate model of the event or adequate description of reality is just nonsense.

To call things by its proper names (precise use of the language) is the foundation of the scientific method. This is mere oversimplified, non- descriptive toy model of one aspect of historical event, made from of statistics of partially observable environment. A few inferred correlations reflects that there was not a total chaos, but some systematic activity. No doubt about it. But this is absolutely unscientific to say anything else about the toy model, let alone claim that any predictions based on it have any connection to reality.

<comment><USER6> That is absolute nonsense.

There is clear correlation between gender and survival rates. Given the data, a decent prior would absolutely take that into account.

Yes, there are other factors. But the foundation of statistical models is simplification, and descriptive statistics are an important foundation of that.

In any case, it isn't exactly clear that there are magical hidden factors which predicted survival. It appears you maybe unfamiliar with the event, because basically those who got into a lifeboat survived, and those who didn't, didn't survive.

To quote Wikipedia:

 _Almost all those who jumped or fell into the water drowned within minutes due to the effects of hypothermia.... The disaster caused widespread outrage over the lack of lifeboats, lax regulations, and the unequal treatment of the three passenger classes during the evacuation..... The thoroughness of the muster was heavily dependent on the class of the passengers; the first-class stewards were in charge of only a few cabins, while those responsible for the second- and third-class passengers had to manage large numbers of people. The first-class stewards provided hands-on assistance, helping their charges to get dressed and bringing them out onto the deck. With far more people to deal with, the second- and third-class stewards mostly confined their efforts to throwing open doors and telling passengers to put on lifebelts and come up top. In third class, passengers were largely left to their own devices after being informed of the need to come on deck._

Even more tellingly:

 _The two officers interpreted the "women and children" evacuation order differently; Murdoch took it to mean women and children first, while Lightoller took it to mean women and children only. Lightoller lowered lifeboats with empty seats if there were no women and children waiting to board, while Murdoch allowed a limited number of men to board if all the nearby women and children had embarked_

All this behavior matches exactly what the model tells us about the event.

I'd be very interested if you can point to something specific that is wrong about it.

All models are wrong, but some are useful.

<comment><USER5> > All models are wrong, but some are useful.

Exactly.

All predictions are wrong and make no sense for partially observable, multiple causation, mostly stochastic phenomena. It will never be the same.

<comment><USER6> Except that this model was useful.

The Titanic's sister ship (the Brittanic) was torpedoed during WW1 and sunk. However, the lesson of the Titanic (too few lifeboats) had been learnt, and only 26 people died.

I don't know what point you are trying to make - yes, I agree that history never repeats, but lessons can be learnt from it, and they can be quantified and they can be useful.

[https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1291331/](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1291331/)

<comment><USER7> >> The Titanic's sister ship (the Brittanic) was torpedoed during WW1 and sunk. However, the lesson of the Titanic (too few lifeboats) had been learnt, and only 26 people died.

This happened because they made a _statistical_ model of the Titanic disaster, and learned from it? Like, they actually crunched the numbers and plotted a few curves etc, and then said "aha, we need more boats"?

I kind of doubt it, and if it wasn't the case then you can't very well talk about a "model", in this context. It's more like they had a _theory_ of what factor most heavily affected survival and acted on it. But I'd be really surprised to find statistics played any role in this.

<comment><USER6> _This happened because they made a _statistical_ model of the Titanic disaster, and learned from it?_

No - statistics as the discipline that we think of today wasn't really around until the work of Gosset[1] and Fisher[2] which was done a few years after this.

I'm sure you noted that I was very careful with what I claimed: "the lesson of the Titanic (too few lifeboats) had been learnt".

These days we'd quantify the lesson with statistics. Then, they didn't have that tool.

Instead, we have testimony[3] relaying the same story: _Just one question. Have you any notion as to which class the majority of passengers in your boat belonged? - (A.) I think they belonged mostly to the third or second. I could not recognise them when I saw them in the first class, and I should have known them if there were any prominent people. (Q.) Most of them were in the boat when you came along? - (A.) No. (Q.) You put them in? - (A.) No. Mr. Ismay tried to walk round and get a lot of women to come to our boat. He took them across to the starboard side then - our boat was standing - I stood by my boat a good ten minutes or a quarter of an hour. (Q.) At that time did the women display a disinclination to enter the boat? - (A.) Yes. "_

So yes, I agree - it was a theory, which our modern modelling tools can show matched well with what the statistics showed happened.

My whole point is that this is very useful, unlike the OP who dismissed it as useless.

[1] [https://en.wikipedia.org/wiki/William_Sealy_Gosset](https://en.wikipedia.org/wiki/William_Sealy_Gosset)

[2] [https://en.wikipedia.org/wiki/Ronald_Fisher](https://en.wikipedia.org/wiki/Ronald_Fisher)

[3] [http://www.titanicinquiry.org/BOTInq/BOTInq33Header.php](http://www.titanicinquiry.org/BOTInq/BOTInq33Header.php)

</comment></comment></comment></comment></comment></comment></comment></comment></comment></comment></comment><comment><USER8> I wrote a blog post exactly on that: [http://p.migdal.pl/2016/03/15/data- science-intro-for-math-ph...](http://p.migdal.pl/2016/03/15/data-science- intro-for-math-phys-background.html) (including the data science part).

I strongly advice for:

\- using Python in the interactive environment Jupyter Notebook,

\- starting with classical machine learning (scikit-learn), NOT from deep learning; first learn logistic regression (a prerequisite for any neural network), kNN, PCA, Random Forest, t-SNE; concepts like log-loss and (cross-)validation,

\- playing with real data,

\- it is cool to add neural networks afterwards (here bare TensorFlow is a good choice, but I would suggest Keras).

Links:

\- [http://www.r2d3.us/visual-intro-to-machine-learning- part-1/](http://www.r2d3.us/visual-intro-to-machine-learning-part-1/)

\- [http://hangtwenty.github.io/dive-into-machine- learning/](http://hangtwenty.github.io/dive-into-machine-learning/)

\- [https://github.com/leriomaggio/deep-learning-keras- euroscipy...](https://github.com/leriomaggio/deep-learning-keras- euroscipy2016)

</comment><comment><USER6> DON'T LEARN NEURAL NETWORKS FIRST.

Instead, learn decision trees and more importantly enough statistics so you aren't dangerous.

Do you know what the central limit theorem is and why it is important? Can you do 5-fold cross validation on a random forest model in your choice of tool?

Fine, now you are ready to do deep learning stuff.

The reason I say not to do neural networks first is because they aren't very effective with small amounts of data. When you are starting out you want to be able to iterate quickly and learn, not wait for hours for a NN to train and then be unsure why it isn't working.

<comment><USER9> Thanks. Can you recommend any statistics books to be safe?

<comment><USER10> [http://www-bcf.usc.edu/~gareth/ISL/](http://www-bcf.usc.edu/~gareth/ISL/) is not an statistics book. its a statistical machine learning book.

"All of statistics" is really a great book if you have time work through he exercise.

</comment></comment></comment><comment><USER11> Courses You MUST Take:

1\. Machine Learning by Andrew Ng ([https://www.coursera.org/learn/machine- learning](https://www.coursera.org/learn/machine-learning)) /// Class notes: ([http://holehouse.org/mlclass/index.html](http://holehouse.org/mlclass/index.html))

2\. Yaser Abu-Mostafa's Machine Learning course which focuses much more on theory than the Coursera class but it is still relevant for beginners.([https://work.caltech.edu/telecourse.html](https://work.caltech.edu/telecourse.html))

3\. Neural Networks and Deep Learning (Recommended by Google Brain Team) ([http://neuralnetworksanddeeplearning.com/](http://neuralnetworksanddeeplearning.com/))

4\. Probabilistic Graphical Models ([https://www.coursera.org/learn/probabilistic-graphical- model...](https://www.coursera.org/learn/probabilistic-graphical-models))

4\. Computational Neuroscience ([https://www.coursera.org/learn/computational- neuroscience](https://www.coursera.org/learn/computational-neuroscience))

5\. Statistical Machine Learning ([http://www.stat.cmu.edu/~larry/=sml/](http://www.stat.cmu.edu/~larry/=sml/))

If you want to learn AI: [https://medium.com/open-intelligence/recommended- resources-f...](https://medium.com/open-intelligence/recommended-resources- for-learning-ai-3ab4023cfa85#.1fe21r9fj)

<comment><USER12> If you want to get started with machine learning you MUST take computational neuroscience? I don't think so.

</comment></comment><comment><USER13> My favorite textbook: Elements of Statistical Learning by Hastie. It's free, too!

If you don't understand something in the book, back up and learn the pre-reqs as needed.

[http://web.stanford.edu/~hastie/ElemStatLearn/printings/ESLI...](http://web.stanford.edu/~hastie/ElemStatLearn/printings/ESLII_print11.pdf)

<comment><USER14> This book is great, but if your stats background isn't quite up to snuff, it can be an intimidating first-read.

Personally, I studied Duda & Hart's pattern recognition [1] and Casella & Berger's statistics text [2] simultaneously. This took about the equivalent of 2 semesters. Duda's text gets the main ideas across without being as heavy on the probability theory / stats.

Afterwards, I studied "Elements ..." by Hastie et al., which was far more readable after going through Casella & Berger's text. Now Hastie et al. is my go-to reference. I also should note that this all assumes that you also have the requisite math background: up to calc 3, linear algebra, and maybe some exposure to numerical methods (in particular, optimization).

[1]: [https://books.google.com/books?id=Br33IRC3PkQC&lpg=PP1&pg=PR...](https://books.google.com/books?id=Br33IRC3PkQC&lpg=PP1&pg=PR7#v=onepage&q&f=false)

[2]: [https://books.google.com/books/about/Statistical_Inference.h...](https://books.google.com/books/about/Statistical_Inference.htm)

</comment></comment><comment><USER15> I took the summer off to learn enough ML to transition from a career in software engineering & product / leadership type roles to ML. I suggest for a first round learning practical tools and techniques so you can start applying supervised learning techniques right away while also starting to build a more solid foundation in probability & statistics for future deeper understanding of the field. I've written about my curriculum here with lot's of specific resources here:

[http://karlrosaen.com/ml/](http://karlrosaen.com/ml/)

<comment><USER16> So, any luck getting a job?

Not sure whether I should do this too.

<comment><USER15> Yeah, I'm recently started as a research engineer in a lab at University of Michigan doing self-driving car stuff, will update the website with more info and post-summer reflections within a couple weeks.

<comment><USER16> Get that job thru connections or a public job listing when you're competing against other applicants?

That's the key question.

<comment><USER15> Ha, well it was a publicly listed job, but I got pointed to it and eventually introduced to the profs in the course of networking with ML folks in town. I can't speak to how many applicants.

</comment></comment></comment></comment></comment><comment><USER17> I very much like Michael Nielsen's book Neural Networks and Deep Learning. It has a great introduction with examples and code you can run locally. Really nice to get started. [http://neuralnetworksanddeeplearning.com](http://neuralnetworksanddeeplearning.com)

Also Fermat's Library is going to be annotating the book, which should make it even more accessible: [http://fermatslibrary.com/list/neural-networks-and- deep-lear...](http://fermatslibrary.com/list/neural-networks-and-deep- learning)

</comment><comment><USER18> It depends on what your goals are. If you'd like to become an ML Engineer or Data Scientist, Tensorflow should be last thing you learn. First, develop a solid foundation in linear algebra and statistics. Then, familiarize yourself with a nice ML toolkit like Scikit-Learn and The Elements of Statistical Learning (which is free online). The rest is a distraction.

In addition to the linear algebra and statistics MOOCS mentioned, I'll also add:

* No bullshit guide to Linear Algebra: [https://gumroad.com/l/noBSLA](https://gumroad.com/l/noBSLA)

* Statistical Models: Theory and Practice: [https://www.amazon.com/Statistical-Models-Practice-David-Fre...](https://www.amazon.com/Statistical-Models-Practice-David-Freedman/dp/0521743850)

</comment><comment><USER19> Gain background knowledge first, it will make your life much easier. It will also make the difference between just running black box libraries and understanding what's happening. Make sure you're comfortable with linear algebra (matrix manipulation) and probability theory. You don't need advanced probability theory, but you should be comfortable with the notions of discrete and continuous random variables and probability distributions.

Khan Academy looks like a good beginning for linear algebra: [https://www.khanacademy.org/math/linear- algebra](https://www.khanacademy.org/math/linear-algebra)

MIT 6.041SC seems like a good beginning for probability theory: [https://www.youtube.com/playlist?list=PLUl4u3cNGP60A3XMwZ5se...](https://www.youtube.com/playlist?list=PLUl4u3cNGP60A3XMwZ5sep719_nh95qOe)

Then, for machine learning itself, pretty much everyone agrees that Andrew Ng's class on Coursera is a good introduction: [https://www.coursera.org/learn/machine- learning](https://www.coursera.org/learn/machine-learning)

If you like books, "Pattern Recognition and Machine Learning" by Chris Bishop is an excellent reference of "traditional" machine learning (i.e., without deep learning).

"Machine Learning: a Probabilistic Perspective" book by Kevin Murphy is also an excellent (and heavy) book: [https://www.cs.ubc.ca/~murphyk/MLbook/](https://www.cs.ubc.ca/~murphyk/MLbook/)

This online book is a very good resource to gain intuitive and practical knowledge about neural networks and deep learning: [http://neuralnetworksanddeeplearning.com/](http://neuralnetworksanddeeplearning.com/)

Finally, I think it's very beneficial to spend time on probabilistic graphical models. Here is a good resource: [https://www.coursera.org/learn/probabilistic-graphical- model...](https://www.coursera.org/learn/probabilistic-graphical-models)

Have fun!

</comment><comment><USER20> I think you should start with a real world problem that is really important to a company that you work for. The problem might be one common to many businesses but unique to that business. For instance, demand forecasting, every business is different as are the signals needed for accurate demand forecasting.

So you could start with some really simple example code for demand forecasting but where you put in your data and your signals. In this way you can learn what you need to solve a particular problem, 'getting lucky' from only having to adapt examples. Sure it might be nice to learn all the fundamentals first but it is sometimes nice to scratch an itch, every company has plenty, choose one and see how far you get and learn along the way.

</comment><comment><USER21> If you are interested in deep learning or visual problems, I recommend the notes at:

[http://cs231n.github.io/](http://cs231n.github.io/)

Really great content from Andrej and his coworkers. This guy is great.

You can easily find all classes videos on YouTube too.

</comment><comment><USER22> This link appeared on HN a few days ago:

[https://github.com/ZuzooVn/machine-learning-for-software- eng...](https://github.com/ZuzooVn/machine-learning-for-software-engineers)

Has some great links if you already have some knowledge about software engineering and want to get into Machine Learning

Josh Gordon from Google also has a extremely nice handson "how to start with Machine Learning" course on YouTube featuring scikit-learn and TensorFlow:

[https://www.youtube.com/playlist?list=PLOU2XLYxmsIIuiBfYad6r...](https://www.youtube.com/playlist?list=PLOU2XLYxmsIIuiBfYad6rFYQU_jL2ryal)

</comment><comment><USER23> I'd be more interested in real life results on a small scale first.

I too felt like ML is something new to try, but the lack of real world use cases on a small scale ( not google, Microsoft, ... ) Has kept me from trying/doing.

I only saw the farm with image recognition for vegetables as an example for now.

Anyone has other examples?

<comment><USER24> I come from finance, so for me it is always market prediction (however, the important thing is to approach this as a learning opportunity, not as a way to make profits -- for that, there are many orthogonal technical issues to solve).

Numerous ML competitions also provide enough fun to get started.

</comment></comment><comment><USER25> Get some background knowledge; I think with a topic like machine learning it's important to understand _why_ certain algorithms work better than others on different kinds of data. I would recommend following a structured course. Andrew Ng's, or the UC berkley one are good. Tom Mitchell's Machine Learning book is a great intro too to supplement the online course of your choice.

If you're a python dev, maybe download scikit-learn and see what kinds of things you can put together after a few lectures.

</comment><comment><USER7> By all means get some "background knowledge" (linear algebra, statistics, calculus etc), play around with libraries and follow some MOOC, but primarily I'd suggest you go get yourself a post-graduate degree from a brick-and-mortar university, and in a course called "Data Science" or "Artificial Intelligence" and the like.

You can learn on your own, of course, but a university course will focus your learning, provide rich feedback, and give you a strong foundation on which to build. You'll also get to learn from other students, which is not often the case in MOOCs. And there's nothing like having a teacher on your payroll (which is essentially what paying for a course is) to answer your questions, clarify obscure areas in books and generally support you throughout the course.

For the record- I did exactly what I say above. After five years working in the industry as a dev, I took a Masters part-time, sponsored by my employer. I think I got a good foundation as I say above, and I certainly didn't have the time, or the focus, to learn the same things on my own.

And I did try on my own, with MOOCs-and-books for a while. I did learn useful stuff (the introductory AI course from Udacity for instance, was really helpful) but after starting the Masters it felt like all this time I'd been crawling along without aim, and now I was running.

</comment><comment><USER26> Skimmed through this and didn't see Kaggle. They have a great intro competition to take part in. Great community and great way to get stuck in. [https://www.kaggle.com](https://www.kaggle.com)

</comment><comment><USER27> Here's a previous Ask HN with more resources: [https://news.ycombinator.com/item?id=12374837](https://news.ycombinator.com/item?id=12374837)

</comment><comment><USER28> While some people might not agree with me, I'd say focus on the Math. Machine learning may be easy to use with these toolkits but doing something useful with it will require deeper understanding.

</comment><comment><USER29> Some resources to get you started - not including any coursera or udacity courses since others have already mentioned it.

Mathematical Monk - [https://www.youtube.com/user/mathematicalmonk#p/c/0/ydlkjtov...](https://www.youtube.com/user/mathematicalmonk#p/c/0/ydlkjtovx5c) (includes a probability primer)

Awesome Courses - [https://github.com/prakhar1989/awesome- courses](https://github.com/prakhar1989/awesome-courses) \- its a very extensive list of university courses including subjects apart from Machine Learning as well

Programming Collective Intelligence - [http://www.amazon.com/programming- collective-intelligence-bu...](http://www.amazon.com/programming-collective- intelligence-building-applications/dp/0596529325) \- heard very good reviews about this

Many other resources available apart from the above. You can access more such resources at [http://www.tutorack.com/search?subject=machine%20learning](http://www.tutorack.com/search?subject=machine%20learning)

I think its a good idea to go through one or more beginner level courses like that offered by Andrew Ng on Coursera and then do an actual project.

[Disclaimer - I work at tutorack.com mentioned in the comment]

</comment><comment><USER30> You can start with free coursera course [https://www.coursera.org/learn/machine- learning/](https://www.coursera.org/learn/machine-learning/), it starts 17 oct

and then continue with [https://www.coursera.org/learn/neural- networks/](https://www.coursera.org/learn/neural-networks/)

</comment><comment><USER31> This specific topic/question comes us frequently enough that I feel like we should either make this thread the canonical answer or have another pointer that we can generally agree upon to point people in that direction.

I think it's important for people to know where to go for good resources, but this exact question keeps coming up incessantly.

</comment><comment><USER32> Take a class on linear algebra. Learn how to use matlab or octave. Knowing these two interdependent subsets of knowledge before diving into machine learning is absolutely indispensable as far as I can tell. I would've gotten so much more out of Ng's class if I knew this stuff beforehand

</comment><comment><USER33> To get intuition and the right foundation read Society of Mind. For me the book is more about thinking in terms of computation which is what (IMO) ML is about instead of statistics (of which is important to know too!).

Now practical: I think the best way to learn is pick an algorithm & representation and implement it in your favorite language. Bonus if you have your own language to work with.

I would start looking into Decision Trees first, implement them and then implement some use cases(, which follow after implementing them). Do this for other approaches, like ANN, which you can have it beat you at checkers which is strangely satisfying.

But keep in mind Minsky. I think he is like Archimedes doing "Calculus"-type approaches without fully realizing. Maybe you could be Newton?

</comment><comment><USER34> It depends on what your starting point is. I created a short blog with some resources that helped me - [https://techflux.github.io/beginners-guide-to- learning-data-...](https://techflux.github.io/beginners-guide-to-learning- data-science.html)

I'd also check out Alice Zheng's books: [http://shop.oreilly.com/product/0636920049081.do](http://shop.oreilly.com/product/0636920049081.do) [http://www.oreilly.com/data/free/evaluating-machine- learning...](http://www.oreilly.com/data/free/evaluating-machine-learning- models.csp)

</comment><comment><USER35> If you're wanting to do ML text processing using python (ala NLTK) I recommend: [http://textblob.readthedocs.io/en/dev/index.html](http://textblob.readthedocs.io/en/dev/index.html)

</comment><comment><USER36> Here's how I got started:

[https://medium.com/learning-new-stuff/machine-learning- in-a-...](https://medium.com/learning-new-stuff/machine-learning-in-a- week-a0da25d59850#.1lx2tvwnv)

</comment><comment><USER37> A good start in "classical" methods" (i.e.: before deep learning and convolutional neural networks) is the old standby, the Weka Data Mining library [1]. Along with the textbook, it will make you comfortable with methods like k-nearest neighbor, support vector machines, decision trees, and the like.

[1] [http://www.cs.waikato.ac.nz/ml/weka/](http://www.cs.waikato.ac.nz/ml/weka/)

</comment><comment><USER38> I liked this one quite a lot: [http://neuralnetworksanddeeplearning.com](http://neuralnetworksanddeeplearning.com)

</comment><comment><USER10> How is your programming background? Do some contest on hackerrank and gauge your skill because machine leaning uses lots of algorithm from math + computer science (eg computational geometry). Machine learning is basically writing some math in code and running experiment and statistically reason about result. If you really want to do that then you need to have a background in math + statistics + software development.

<comment><USER39> Or some challenge problems on SPOJ ([http://www.spoj.com/problems/challenge/](http://www.spoj.com/problems/challenge/))

</comment></comment><comment><USER40> Here's an alternative suggestion — try a machine learning contest on one of the programming challenge problem sites.

HackerRank (YC S11) has one coming up in 2 weeks (filter by Domains > AI) [1].

I plan to participate as well just to explore the space. Feel free to shoot me a message if you'd like to discuss more.

[1]: [https://www.hackerrank.com/contests](https://www.hackerrank.com/contests)

</comment><comment><USER41> Hello, I am a Python programmer and daily I am working using Python to extract, analysis and mount data sets in my job.. I am trying to study machine learning alone using udacity and the books programming collective inteligence as my materials from study. What the recommendation to understand and learn math and statics that are used in machine learning concepts ?

</comment><comment><USER42> Here's a friendly introduction to the main concepts of machine learning. No background required. (Feedback is always welcome!) [https://www.youtube.com/watch?v=bYeteZQrUcE&list=PLAwxTw4SYa...](https://www.youtube.com/watch?v=bYeteZQrUcE&list=PLAwxTw4SYaPknYBrOQx6UCyq67kprqXe3&index=1)

</comment><comment><USER43> I highly recommend the Udacity courses on machine learning. They even have ones on how to become a self driving car engineer.

</comment><comment><USER44> [https://www.coursera.org/specializations/jhu-data- science](https://www.coursera.org/specializations/jhu-data-science) If you wish to go deep and learn R as well as data science and machine learning fundamentals, then this is a great specialization course on Coursera.

</comment><comment><USER45> I have compiled a list of the best resources for getting started with ML, I highly recommend it, it is a great place to get started:

[http://blog.digitalmind.io/post/artificial-intelligence- reso...](http://blog.digitalmind.io/post/artificial-intelligence-resources)

</comment><comment><USER46> If you just want to jump right in with minimal theory and then learn as you progress. Here is how I did it: [https://blog.asadmemon.com/shortest-way-to- deep-learning-41e...](https://blog.asadmemon.com/shortest-way-to-deep- learning-41e704d65ef)

</comment><comment><USER47> This is a great article about learning machine learning: [https://medium.com/learning-new-stuff/machine-learning- in-a-...](https://medium.com/learning-new-stuff/machine-learning-in-a-year- cdb0b0ebd29c#.8jvs9lr7q)

</comment><comment><USER48> Learn statistics. Otherwise you will get yourself into trouble using techniques you do not understand.

</comment><comment><USER49> You will find absolutely everything you need here : [https://www.feedcrunch.io/@dataradar/](https://www.feedcrunch.io/@dataradar/). Just type what you want to know in the search engine.

i.e : Tutorial, Getting Started, ...

</comment><comment><USER50> udacity free machine learning course is a nice way to get the basics [https://www.udacity.com/course/intro-to-machine-learning-- ud...](https://www.udacity.com/course/intro-to-machine-learning--ud120)

</comment><comment><USER51> Here is my take on that: [https://medium.com/machine-intelligence-report/how- to-learn-...](https://medium.com/machine-intelligence-report/how-to-learn- machine-learning-6fa1c66bf039#.asdxfvenl)

</comment><comment><USER52> Shameless Self-promotion

[http://blog.adnansiddiqi.me/how-i-wrote-my-first-machine- lea...](http://blog.adnansiddiqi.me/how-i-wrote-my-first-machine-learning- program-in-3-days/)

</comment><comment><USER53> Slight tangent, so bare with me. Every other week, posts such as this come up, asking how to learn X, so I was wondering if there is any Github repo or some website that keeps track of all the resources posted here?

<comment><USER45> There's a very interesting project:

[https://metacademy.org](https://metacademy.org)

"Your package manager for knowledge".

(mostly focused around ML)

<comment><USER53> Wow, thanks for linking to the site. It seems like an amazing resource!

</comment></comment></comment><comment><USER54> There is a nice example of machine learning with python and R in Analytics Vidhya and other tutorials, also ISLR introduction to statistical learning with R gives you an overview of some standard methods.

</comment><comment><USER55> You need to learn the basic concepts before you start with coding. Take your time and view Andrew Ng's course. It is good for the first timers.

</comment><comment><USER56> It depends on what you really want to do in the future. Learning a framework could be useless if you don't know how to do correctly basic things as creating a train, test and validation set.

There are basic things I think you must know before jumping into a framework or int any specific algorithm. First thing you probably will have to do is to collect the data and clean it. In order to do this correctly you need some basic statistics. For example you need to know what is a gaussian distribution and collect samples in a way that are representative of your problem. Then you may need to clean the samples, remove outlines, complete blank data, etc. So it is basic you know some statistics to do this right.I have seem people with a lot of knowledge of tools than then they are not able to create a train/test/validation set correctly and the experiment is completely invalid from here no matter what you do next ([http://stats.stackexchange.com/questions/152907/how-do- you-u...](http://stats.stackexchange.com/questions/152907/how-do-you-use-test- data-set-after-cross-validation), [https://www.youtube.com/watch?v=S06JpVoNaA0&feature=youtu.be](https://www.youtube.com/watch?v=S06JpVoNaA0&feature=youtu.be) ). You also need to know how are you going to test your results, so again you need to know how to use a statistical test (f-test, t-test). So first thing, jump into statistics to understand your data.

The next step I think is to know some common things in machine learning as the no free lunch theorem, curse of dimensionality, overfitting, feature selection, how to select the current metric to asses your model and common pitfalls. I think the only way to learn this is reading a lot about machine learning and making mistakes by your own. At least now you have some things to search in google an start learning.

The third step would be to understand some basic algorithms and get the feeling of the type of algorithms, so you know when a clustering algorithm is needed or your problem is related classification or with prediction. Sometimes a simple random forest algorithm or logistic regression is enough for your problem and you don't need to use tensorflow at all.

Once you know the landscape of the algorithms I think it is time to improve your maths skills and try to understand better how the algorithms works internally. You might not need to know how a deep network works completely, but you should understand how a neural network works and how backpropagation works. The same with algorithms as k-means, ID3, A*, montecarlo tree search or most popular algorithms that you are probably are going to use in day to day work. In any case you are going to need to learn some calculus and algebra. Vectors, matrix and differential equations are almost everywhere.

You would probably have seen some examples when learning all the stuff I talked about, then it is time to go to real examples. Go to kaggle and read some tutorials, read articles about how the community of kaggle has faced and winning the competitions. From here is just practice and read.

You can jump directly into a framework, learn to use it, have 99% accuracy in your test and 0% accuracy with real data. This is the most probably scenario if you skip the basic things of machine learning. I have seen people doing this and end up very frustrated because they don't understand how their awesome model with 99% accuracy doesn't work in the real world. I have also seen people using very complex things as tensorflow with problems that can be solved with linear regression. Machine learning is a very broad area and you need maths and statistics for sure. Learn a framework is useless if you don't understand how to use it and it might lead you to frustration.

</comment><comment><USER57> ML class by Andrew Ng is a good start. Then find task with application of ML, or use Kaggle...

</comment><comment><USER58> You should have the equivalent of an undergraduate degree in mathematical statistics (calculus, linear algebra, et al). It should take about 4 years of full time study to achieve that.

Forget about the code part. It's the least difficult part.

<comment><USER45> I think that this is a horribly impractical advice, and I keep seeing it everywhere.

With modern tools and frameworks you can start learning and applying what you know on practice almost immediately.

Check out Keras and the book "Deep Learning with Python"[1]. They have enabled me to train my first ANN in 2 days, and get to the point of building a MNIST recognizer in a month(and I was reading it pretty slowly).

Sure, if you're coding it from scratch and must understand every signle detail, you do need like 10 years and 3 PhD's. But that's not a wise way to learn.

I recommend to take the simplest tools, and apply them to practical projects immediately. That will give you the general overview of how things work, and then you will learn the details as needed.

[1] [https://machinelearningmastery.com/deep-learning-with- python...](https://machinelearningmastery.com/deep-learning-with-python/)

<comment><USER59> If you don't understand how it works your won't understand how to optimize things, how to do error analysis, how to implement better features and weights out of the box, how to choose the right algorithm from the start, how to do good cross validation ...

Yes, you can take a library and implement it in 10 minutes, but then you're really not learning machine learning, are you?

I will argue you do not need four years of math by any stretch, though. The stumbling block will be notation more than anything else. Relatively basic calculus and linear algebra will suffice.

They were right about one thing: the code is the least important part.

</comment></comment></comment><comment><USER60> IMO the best way to get started (like with anything) is by getting started. I think the way you make progress is going to come down to you personally as an individual and what your motivations are. Before learning ANYTHING new i would invest some time in learning how to learn. There is a good coursera course on this [https://www.coursera.org/learn/learning-how-to- learn](https://www.coursera.org/learn/learning-how-to-learn) and the book by the course authors is incredibly useful for putting a framework with some techniques that can help the approach to learning any new skill. This is not meant to be condescending advice but for me personally it's changed the way i go about learning any new skill now.

I think as well it really depends where you are coming from / what your background is. The reason i say this is i have recently gone through a similar transition into machine learning 'from scratch' except once i got there i realised i knew more than i thought. My academic background is in psychology / biomedical science which involved a LOT of statistics. From my perspective once i started getting into the field i realised there are a lot of things i already knew from stats with different terms in ML. It was also quite inspiring to see many of the eminent ML guys have backgrounds in Psychology (for instance Hinton) meaning i felt perhaps a bit more of an advantage on the theoretical side that many of my programming peers don't have.

I realise most people entering the field right now have a programming background so will be coming at things from an opposite angle. For me i find understanding the vast majority of the tests and data manipulation pretty standard undergraduate stuff (using python / SK Learn is incredible because the library does so much of the heavy lifting for you!). Where i have been struggling is in things that an average programmer probably finds very basic - it took me 3 days to get my development environment set up before i could even start coding (solved by Anaconda - great tool and lessons learned). Iterating over dictionaries = an nightmare for me (at first anyway, again getting better).

I think (though i may be biased) it's easier to go from programming to ML rather than the other way around because so much of ML is contingent on having decent programming skills. If you have a decent programming skill set you can almost 'avoid' the math component in a sense due to the libraries available and support online. There are some real pluses to ML compared to traditional statistics - i.e. tests that are normally ran in stats to check you are able to apply the test (i.e. shape of the data: skewness / kurtosis, multicollinearity etc) become less of an issue as the algorythms role is to deliver an output given the input.

I would still recommend some reading into the stats side of things to get a sense of how data can be manipulated to give different results because i think this will give you a more intuitive feel for parameter tuning.

This book does not look very relevant but it's actually a really useful introduction to thinking about data and where the numbers we hear about actually come from

[https://www.amazon.co.uk/Risk-Savvy-Make-Good- Decisions/dp/1...](https://www.amazon.co.uk/Risk-Savvy-Make-Good- Decisions/dp/1846144744)

In conclusion if you can programme and have a good attitude towards learning and are diligent with efforts I think this should be a simple transition for you.

</comment><comment><USER61> Thanks!

</comment><comment><USER62> Contrary to the other advice around here, I would strongly advise NOT taking a course. I think it is a good idea at some point, but it is not the first thing you should be doing.

The very first thing you should do is play! Identify a dataset you are interested in and get the entire machine learning pipeline up and running for it. Here's how I would go about it.

1) Get Jupyter up and running. You don't really need to do much to set it up. Just grab a Docker image.

2) Choose a dataset.

I wouldn't collect my own data first thing. I would just choose something that's already out there. You don't want to be bogged down by having to wrangle data into the format you need while learning NumPy and Pandas at the same time. You can find some interesting datasets here:

[http://scikit-learn.org/stable/datasets/](http://scikit- learn.org/stable/datasets/)

And don't go with a neural net first thing, even though it is currently in vogue. It requires a lot of tuning before it actually works. Go with a gradient-boosted tree. It works well enough out of the box.

3) Write a classifier for it. Set up the entire supervised machine learning pipeline. Become familiar with feature extraction, feature importance, feature selection, dimensionality reduction, model selection, hyperparameter tuning using grid search, cross-validation, ....

For this step, let scikit-learn be your guide. It has terrific tutorials, and the documentation is a better educational resource than beginning coursework.

[http://scikit-learn.org/stable/tutorial/](http://scikit- learn.org/stable/tutorial/)

4) Now you've built out the supervised machine learning pipeline all the way through! At this point, you should just play:

4a) Experiment with different models: Bayes' nets, random forests, ensembling, hidden Markov models, and even unsupervised learning models such as Guassian mixture models and clustering. The scikit-learn documentation is your guide.

4b) Let your emerging skills loose on several datasets. Experiment with audio and image data so you can learn about a variety of different features, such as spectrograms and MFCCs. Collect your own data!

4c) Along the way, become familiar with the SciPy stack, in particular, NumPy, Pandas, SciPy itself, and Matplotlib.

5) Once you've gained a bit of confidence, look into convolutional and recurrent neural nets. Don't reach for TensorFlow. Use Keras instead. It is an abstraction layer that makes things a bit easier, and you can actually swap out Tensorflow for Theano.

6) Once you feel that you're ready to learn more of the theory, then go ahead and take coursework, such Andrew Ng's course on Coursera. Once you've gone through that course, you can go through the course as it actually has been offered at Stanford here (it's more rigorous and more difficult):

[https://see.stanford.edu/Course/CS229](https://see.stanford.edu/Course/CS229)

I will also throw in an endorsement for Cal's introductory AI course, which I think is of exceptionally high quality. A great deal of care was put into preparing it.

[http://ai.berkeley.edu/home.html](http://ai.berkeley.edu/home.html)

There are other good resources that are more applied, such as:

[http://machinelearningmastery.com/](http://machinelearningmastery.com/)

I hope this helps. What I am trying to impart is that you will understand and retain coursework material better if you've already got experience, or better yet, projects in progress that are related to your coursework. You don't need to undergo the extensive preparation that is being proposed elsewhere before you can start PLAYING.

</comment><comment><USER63> Newton's method and other numerical methods are the hello world of machine learning.

Why numerical methods?

* They might produce the right answer

* They frequently do

* They are easy to visualize or imagine

* You get used to working with a routine that is both fallible but quite simple and remarkably able to work in a wide variety of situations. This is what machine learning does, but there are more sophisticated routines.

At some point you need to make a decision to go down the road more focused on analysis & modelling vs machine learning & prediction. It's not that the two are exclusive, but they really do seek to address really big forks in the problem space of using a computer to eat up data and -- give me _predictions_ or give me _correct answers_

Google needs lots of prediction to fill in holes where no data may ever exists. Analysis and modeling can really fall down when there is no data to confirm a hypothesis or regress against.

An engineer needs a really good model or the helium tank in the Falcon 9 will explode one time in twenty vs one time in a trillion. The model can predict, based on the simulation of the range of parameters that will slip through QA, how many tanks will explode. Most prediction methods are not trying to solve problems like this and provide little guidance on how to set up the model.

On the prediction side, you will learn all the neural net and SVM stuff.

On the analysis and modelling side, get ready for tons of probability and Monte Carlo stuff.

They are all fun.

<comment><USER64> > Newton's method and other numerical methods are the hello world of machine > learning.

Newton's method and other similar numerical methods are the hello world of a branch of mathematics known as 'numerical analysis' and scientific computing. This is not Machine Learning.

<comment><USER63> ShhhHHHhhhhhhh! I'm tricking the questioner into learning some math.

</comment></comment></comment><comment><USER65> There is a great introductory article with examples on how the reasoning behind distributed machine learning works. All in javascript too! It might be "too early" for some people though: [http://myrighttocode.org/blog/artificial%20intelligence/part...](http://myrighttocode.org/blog/artificial%20intelligence/particle%20swarm/genetic%20algorithm/collective%20knowledge/machine%20learning/gun- db-artificial-knowledge-sharing)

</comment><comment><USER66> Everybody learns differently, but I would suggest starting with the how, not the what. Compare: How do I sort a list? With: What is exactly happening when I sort a list? Application before theory.

Start with a tutorial/pre-made script for one of the Kaggle Knowledge competitions. Move on to a real Kaggle competition and team up with someone who is in the same position on the learning curve as you. Use something like Skype or a Github repo to learn new tricks from one another.

</comment><comment><USER5> The classic Andrew Ng's course on Coursera. Then ML courses on Udacity.</comment>