Hacker News new | comments | ask | show | jobs | submit login

This is not just interesting for comparison but its interesting for people that know R/Python how to go from one to the other.



Kind of, but the R code is written a little oddly to my eye.


Me too. Why for example did they use an sapply for column means when they could have just used colMeans with na.rm=T?


That is a major difference between these two languages.

Python: There should be one, and only one, preferable way to do things. Though this may not be obvious at first.

R: Every author has a different style of doing things, reflecting in the code.

As for the comparison in general: You can call R from within Python. So Python is at least as powerful as R. The rest (BeautifulSoup, Compression, Game development etc.) is icing on the cake.


How so? As someone familiar with Python but not R, I've always been hesitant to jump in. This code was very readable and made me think that it might be a far more accessible language than I'd previously assumed.


One example in the section titled "Split into training and testing sets" would be to use the createDataPartition() function from the caret package for creating training and testing sets.

He says "In R, there are packages to make sampling simpler, but aren’t much more concise than using the built-in sample function" but using caret is more concise.

Added: Later in the section on random forests he says "With R, there are many smaller packages containing individual algorithms, often with inconsistent ways to access them." Which is why you want to use the caret package as it makes accessing many machine learning packages consistent and easy.




Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: