News for hackers. Stuff that matters.
Re:Is “data scientist” the new “programmer”? by stochastic_monk on Tuesday September 18, 2018 @06:42PM (#18019920)
Even the Stanford NLP Java implementations don’t always match the code they’re meant to be a translation of. I think R is a worse offender than Python.
Re:Is “data scientist” the new “programmer”? by darkhorn on Tuesday September 18, 2018 @08:40PM (#18020686)
In Python 0.1 + 0.2 is not equal to 0.3 because the result is 0.30000000000000004.

In R 0.1 + 0.2 is equal to 0.3.

Re:Is “data scientist” the new “programmer”? by dekhn on Wednesday September 19, 2018 @09:01AM (#18023843)
Not only is this technically wrong, but Python has a decimal module for performing these kinds of calculations. It uses floats/doubles for the native float type which produces exactly the type of results you see above.
Re:Is “data scientist” the new “programmer”? by darkhorn on Wednesday September 19, 2018 @03:35PM (#18027055)
What is the result of 3/2? In R it is 0.5. In Python it is 1.
Re:Is “data scientist” the new “programmer”? by dekhn on Wednesday September 19, 2018 @07:12PM (#18028406)
You mean, in Python2, which uses integer division by default, it's 1 (as expected), and in Python3, which uses float division by default, it's 1.5.

If R is giving you 0.5, you should find another language (I assume you meant 1.5?)

Re:Is “data scientist” the new “programmer”? by sampo on Wednesday September 19, 2018 @04:19PM (#18027374)
In Python 3 it's 1.5.
Re:Is “data scientist” the new “programmer”? by sampo on Tuesday September 18, 2018 @08:58PM (#18020786)
Not on my R:

    > (0.1 + 0.2) == 0.3
    [1] FALSE
Re:Is “data scientist” the new “programmer”? by darkhorn on Wednesday September 19, 2018 @11:36AM (#18024964)
The result for 0.1 + 0.2 is 0.3. https://imgur.com/xWpx1Cg

Why do you compare point to point? I have never once in my Statistics education compared point to point. You always need to see the probability of the result if it is within 2 points.

But if you want to compare use all.equal(0.1 + 0.2, 0.3)

Re:Is “data scientist” the new “programmer”? by sampo on Wednesday September 19, 2018 @03:34PM (#18027046)

    > all.equal(0.1 + 0.2 + 0.000000003, 0.3)
    [1] TRUE
Re:Is “data scientist” the new “programmer”? by j7ake on Wednesday September 19, 2018 @03:05AM (#18022343)
Try this:

> print(.1+.2, digits=18) [1] 0.300000000000000044

Re:Is “data scientist” the new “programmer”? by darkhorn on Wednesday September 19, 2018 @11:42AM (#18025022)
In R 0.1 + 0.2 returns 0.3. In Python 0.1 + 0.2 returns 0.30000000000000004

Why do you compare point to point? I have never once in my Statistics education compared point to point. You always need to see the probability of the result if it is within 2 points.

But if you want to compare use all.equal(0.1 + 0.2, 0.3)

Re:Is “data scientist” the new “programmer”? by detaro on Tuesday September 18, 2018 @08:51PM (#18020744)
R:

    > 0.1+0.2 == 0.3
    [1] FALSE

?
Re:Is “data scientist” the new “programmer”? by darkhorn on Wednesday September 19, 2018 @11:37AM (#18024971)
Why do you compare point to point, it is meaningless? The result for 0.1 + 0.2 shows 0.3. It doesn't show you wrong result. If you print it prints 0.3, nothing else.

Why do you compare point to point? I have never once in my Statistics education compared point to point. You always need to see the probability of the result if it is within 2 points.

But if you want to compare use all.equal(0.1 + 0.2, 0.3)

Re:Is “data scientist” the new “programmer”? by detaro on Wednesday September 19, 2018 @11:59AM (#18025145)
I thought that's what you mean by "equal". It didn't appear to me that you were merely talking about the default formatting of numbers printed on the REPL, which is utterly inconsequential to developing and porting applications.
Re:Is “data scientist” the new “programmer”? by darkhorn on Wednesday September 19, 2018 @03:31PM (#18027025)
R is not used for developing applications. https://www.r-project.org/about.html
Re:Is “data scientist” the new “programmer”? by detaro on Wednesday September 19, 2018 @04:24PM (#18027422)
This entire subthread is under a comment talking about "productionalizing" code developed in R. If you want to make an argument that R should not be used to make products, but only as an interactive notebook and to make nice plots, maybe make that instead of just mentioning small UI details.