0
$\begingroup$

I am using a pre-trained Model. Firstly, I trained the Model in python which came with 94% accuracy. Now, I am trying to reproduce the same results with same configuration of the model in R, but it is giving terrible results and not crossing the accuracy of 83%.

There is a difference in the data type of both languages with which I train the model: R uses data type Double while Python uses data type float32.

The second key difference is, I was running Python Notebook on GPU and TPU but the Notebook in R running on CPU because of Kaggle GPU memory issue.

Do the above-mentioned differences cause performance gaps? If not, then what could be the problem?

$\endgroup$
  • 1
    $\begingroup$ I made a similar experience in python and R, however the difference of accuracy was not about 11% like in your case. It was about 5% and I think, it is because of the different data which were used in train and test split. It could be that the dataset is imbalanced and or different data were trained and tested. Maybe you should run it several times in R, what are the results? $\endgroup$ – martin Oct 28 '20 at 16:17
  • $\begingroup$ @martin Thank you so much for your valuable comment. I was thinking the same but still I am trying with different use-cases. I hope it works in someway. I will update you about my results. $\endgroup$ – Felix Tenn Oct 28 '20 at 16:23
  • $\begingroup$ @martin, I am getting the same difference as you had which is almost 5%. I am using the same amount of samples for training and testing in Python and R. I am fetching data from keras datasets. So, could you please tell how did you achieve the same accuracy in R? Does version of keras and TF could have impact on performance? $\endgroup$ – Felix Tenn Oct 31 '20 at 2:21
  • $\begingroup$ I didn´t get perfect same accuracy in R and python. Because my models were just made with train test split (80% Training/20% Testdata). And the split was in my opinion the reason for the difference. Because the models take several Train-and Testdata. When I compared all the models of R and Python, round about it was 5% deviation. Can you say, that your models in python and R used exactly sure the same rows as train- and testdata? $\endgroup$ – martin Oct 31 '20 at 10:56
  • $\begingroup$ @martin, I am using zalando fashion-mnist dataset which is already distributed in train and test. In both languages, I am using the same csv files. I am not playing that much with data except extracting labels from both csv's using slicing. $\endgroup$ – Felix Tenn Oct 31 '20 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.