1
$\begingroup$

The other day I was exploring Kaggle and I found most of them don't use scikit-learn or any other library but instead they write these long python scripts. For example, why they write a function for train/test split when you can just use the scikit-learn library which is hassle free are there any advantages of not using any library and writing python code directly.

p.s: I'm a Data Science Beginner.

$\endgroup$
2
  • $\begingroup$ Can you point us to any specific example of such custom function? $\endgroup$
    – lpounng
    Oct 14, 2022 at 8:03
  • 1
    $\begingroup$ One possible advantage is to acquire a good understanding of what the function does and how it works. We often see people who know which functions to use for standard tasks, but they don't have a good understanding of what the functions do and thus can make serious mistakes. $\endgroup$
    – Erwan
    Oct 14, 2022 at 8:38

1 Answer 1

2
$\begingroup$

There can be multiple reasons to write a custom code instead of using a library. For example - you can use the train_test_split from sklearn and that will generate a random split of data for training and validation. But let's assume you want to have a specific distribution of target in training and validation then you need to write a custom function to apply that specific distribution while preparing the training and validation

$\endgroup$
2
  • $\begingroup$ By "specific distribution", can you name one such example? $\endgroup$
    – lpounng
    Oct 14, 2022 at 8:02
  • $\begingroup$ More details can be found here $\endgroup$ Oct 20, 2022 at 5:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.