0
$\begingroup$

Until now I have implemented linear and logistic regression myself. I have not used any library other than numpy and matplotlib. But in the internet every example is solved using libraries such as sklearn, pandas and etc. My question is, which one is good to learn for machine learning, implementing algorithm yourself or using libraries (sklearn or ...)?

Thanks.

$\endgroup$
  • 3
    $\begingroup$ Neither is better. But if you have some goals in mind, you might be able to get some advice on what balance has worked towards those goals. So please explain about your specific goals for studying ML. $\endgroup$ – Neil Slater Jul 29 '16 at 15:23
4
$\begingroup$

I can think of the following pros and cons for each. As for learning to code your own machine learning algorithms such as logistic regression:

  • You will definitely learn more about specific algorithms, their details, role of different parameters and etc. That is also a good practice of coding itself. Then you can validate your implementation by benchmarking it against other packages and implementations.
  • You will have more freedom in controlling different aspects of your method. You can add functions and modules as you wish and do not necessary have to deal with predefined variables, methods and etc.

On the other hand, implementing algorithms when it is not necessary and you can just use existing packages is like reinventing the wheel. It normally takes a lot of time and you have to verify your results for each one of them. Packages like sklearn are popular because of the following:

  • A group of people are working on those, constantly making them up to date, testing the methods in different situations for different needs. That makes packages like sklearn very dependable and usually scalable.
  • If you have a question about them, there are tons of resources out there; documentation, forums, source code, communities like StackOverflow where thousands of people are eager to help you literally for any error you face while running your code.
  • Another important feature is automated hyperparameters tuning. Most of machine learning algorithms have a series of hyperparameters that need to be optimized in order to achieve the best performance. Packages like sklearn efficiently search for the optimal tuning parameters (or "hyperparameters") for your machine learning model in order to maximize its performance.
  • Still if you are interested in implementing machine learning algorithms and like the coding, you can always contribute to the existing packages. They usually have Github repositories where you can raise an issue, ask for a new feature or provide help improving them.

All in all, if you have enough time and you are keen to learn low level details about those models, go ahead and give implementation them a shot. That is certainly fun. However, if you need to get to the results as soon as possible and looking for a reliable package where a huge group of people both in industry and academia are already using, sklearn, pandas and others are you options.

Hope this is helpful and good luck.

| improve this answer | |
$\endgroup$
0
$\begingroup$

I second @NeilSlater. If your purpose is to study and understand Machine Learning, implementing algorithms would definitely help. On the other had, if you want to implement a ML algorithm to solve a real-life problem (or in Data Science competitions), I would suggest you try out the machine learning libraries in python, spark, R or any other language. The reason as explained by @ahajib is that these libraries have efficient implementations of the popular Machine Learning algorithms. So unless there is a purpose, why re-invent the wheel?

| improve this answer | |
$\endgroup$
0
$\begingroup$

At the end of the day, the value of any Machine Learning Engineer rests on their ability to describe the world and to make predictions. One thing required of you to become a Professional is finding a Good Mentor and Nurturing Genuine Curiosity about it.

Machine Learning offered by Stanford is the perfect place for beginners to understand the core idea of teaching a computer to learn concepts using data without being explicitly programmed. This course is Created by an AI Pioneer - Andrew Ng and is rated 4.9 out of 5 of 81,708 ratings.

Keep in mind that as you professionally begin your journey in Machine Learning, you’ll have to build Solid Basis in Statistics, Algebra, Applied Mathematics, and Practice Python or R using all the important ML Libraries like scikit-learn, TensorFlow, Numpy, Keras, Theano and more.

Check this Section on Best Machine Learning Tutorial, Courses, and Specialization.

| improve this answer | |
$\endgroup$

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