Hot answers tagged

30

Python is more "general purpose" while R has a clear(er) focus on statistics. However, most (if not all) things you can do in R can be done in Python as well. The difference is that you need to use additional packages in Python for some things you can do in base R. Examples: Data frames are base R while you need to use Pandas in Python. Linear ...


13

Python being more widely used is an important consideration. This will especially become important when applying for a job. Also Python has as many if not more key statistical and ML/AI tools as R, and a larger open-source base to utilize. Python is designed for programmers, R is designed for statisticians. Originally I was a R programmer, but most of my ...


4

I'd like to add two points to the existing answers: There is excellent interaction between R and python, with various possibilities for either direction. To me, it's not that much of a decision python vs. R. The decision is to choose the main language appropriately for the project at hand, and then do parts in the other language if that is better for some ...


3

I eventually do plan on moving more towards ML One aspect that I would like to add based on what I observed. Things are moving with more focus towards Deep Learning e.g. Neural Networks and in this space, most of the dominating Libraries supports Python as first choice. Companies manage a separate Python version to open-source, just to maintain the user ...


3

One thing that can be a gotcha coming from R to Python is that the Python stats ecosystem tends to be more machine learning-ey oriented rather than inferential stats-ey oriented. This can create some hiccups, because some of the defaults in R that are the defaults because people who do inferential stats like in the social sciences always use them, are not ...


3

If you want to see the distribution of the data that is hidden in the bottom portion, you can add a histogram or probability plot, or even a violin plot. Each will show the distribution of the data more clearly than this boxplot does, and you can still see the true value directly. You can also add some jitter to the boxplot to see more of the overlapping ...


2

Figured out an easy way to do this. First we will just select PID from the real data. Then we will just sample 0.75 % of these PID and save these point as training PID and the rest as testing PID. We will thne find the intersection between this list and the real data using PID.


2

If the values are greater than 0, you can apply the logarithm to Value and you should be able to compare the distributions much more. Another thing you can do is cropping at some value (let's say Value = 10) but you are going to lose some information. If your values are not greater than 0 but have a lower bound (let's say -t), you can apply the transform log(...


1

The parse_date_time function from the lubridate package will do this. This function takes an argument orders which is like the tryFormats argument in 'as.Date', except the formats allowed are more generous and lubridate-like (without punctuation, delimiters, etc.). For example, you can set orders = c("dmy", "mdy"). Date <- c('22-04-...


1

For the love of the flying spaghetti monster, use anaconda to install the needed packages for data science. I have seen both Python and R being used in the data science setting and both needed additional packages to execute any data science capabilities. Conda made it way easier to install them. From my point of view, Python has a better support for all ...


1

I'm not familiar with LDA, but as far as I know you're not really changing the "model" (i.e. the way to measure impact) between the two versions, what you're changing is the features: in the 2nd version, instead of looking at whether the value of the feature impacts Y, you look at whether the log of the value of the feature impacts Y. The first ...


1

Gini decrease is calculated based on the mean decrease in Gini i.e. $p_i(i-p_i)$ each time when the Tree is splitted on that Feature. Value is so high because the r package weight the impurities by the raw counts, not the proportions. Accuracy decrease is calculated on OOB dataset by randomly shuffling the data for that particular feature in the OOB. Then ...


1

You have to do RF <- randomForest(sale ~ v1 + v2 + v3, data = TrainSet, importance = TRUE) this is the formula notation for R. It doesn't make a lot of sense for random forest models, but it is how it works.


1

It looks like a very difficult problem, since there are many possible classes and very little information in the features to distinguish them. For the record, the reverse problem of estimating the travel time based on the route would probably be more feasible. So you can't expect great performance on a problem like this, the goal will be to design the ...


1

There's no "most suitable" way, but there might be one which works better with your data. The only way to know that would be to try all of them. In case choosing the number of topics is an issue, you might be interested in using the non-parametric extension of LDA for topic modeling, which doesn't require you to specify the number of topics: this is called ...


1

The function you are looking for is gather from the tidyr package. This function takes a wide data.frame and makes it a long data.frame. gather is easy to use: library(dplyr) library(tidyr) # Building a sample data.frame like your example data. df <- data.frame(Boardgame = c("Game1", "Game2", "Game3", "Game4", "Game5"), categorie1 = c("...


1

@Ben Norris found out that the relaimpo packages has a hard minimum number of observations, so if I wanted to pursue this path I have to up my sample size. As I only have the data that I have, I pursued a "hacky" solution which I am going to describe for completionists sake. The steps were as follows: Assign each individual to one of k groups randomly, so ...


Only top voted, non community-wiki answers of a minimum length are eligible