# How to Analyze and Apply Machine Learning Algorithm

*Prachi is a Machine Learning Engineer, working in the respective field since 2015.*

Unlike sorting and data-dependent algorithms, machine learning algorithms are complex and demand deep analysis before putting them into action.

- Start with a detailed description of the algorithm.
- Evaluate it with random parameters and check the cause and effect.

**Steps to Analyse the Algorithm**

Proceed with the following steps to do a thorough examination of the algorithm:

- Select the algorithm you are curious about and carry on with your own hit and trial method. This is important to understand the procedure deeply and discover the possible bugs. It’s undeniable no matter how advanced an algorithm is, it always has its own limitations and bugs.
- Identify what you are researching. Figure out the problems you are seeking an answer for. The more specialized the problem, the more useful and effective the solution. For example,
*in what possible manner, the addition of random attributes to the dataset affects the classification accuracy of the random forest?*Modify the question in different forms to find the most specialized one. - Design the Approach. Now you have selected the algorithm and figure out the specific problem you need to tackle, this is the time to focus on the key elements from your question. Considering the above example, the key elements are the addition of random attributes, effects on classification accuracy, random forest problems, and performance score.
- Execute the problem. Use stochastic analysis, statistical experiments, and tools like scikit-learn to complete the execution. Use tables and graphs to estimate the result and investigate if it sufficiently answers your question.
- Repeat the steps with different datasets, approaches, and tools.

**Put the Algorithm to work**

Putting the algorithm to work can teach you a lot about its working performance.

- It helps you understand the ways in which you can maximize the algorithm efficiency.
- It gives you a strategic background into the applied machine learning and algorithmic implementation.
- It provides you with insights into the mathematical description of the algorithm through the computational transformations of vectors and arrays (matrices in mathematics).
- Generally, algorithms are written with voids which can be filled only by its correct implementation giving you an edge in applied machine learning.
- It enhances your production strategies by focusing on the optimized results with fewer resources available, thus lesser cost and greater revenue in return.
- It encourages you to look deep into the technicality of the targeted research publications.

**Process for Algorithm Implementation**

Algorithm implementation must be done keeping certain points in mind to understand its complexity and possible errors while coding:

- Select the programming language (Python is my most preferred language)
- Select the algorithm to be implemented from scratch
- Select the set of problems to be tested and validated
- Research the algorithm related papers, websites, books, libraries, and so on
- Make sure to implement the algorithm with test-driven development to better understand the purpose of the algorithm
- Add relevant comments with proper instructions
- Open source your code to market your skills and establish your credibility
- Try to specialize the algorithm to solve a particular problem to maximize its efficiency as well as accuracy

You can also widen the scope of the specialized algorithm by generalizing it to solve the class of specific problem.

**The downside of Analyzing and Applying the Algorithm from scratch**

Nothing beneficial comes with limitations or downsides.

- It is possible that your implementation may already be done by somebody else and your work may be considered redundant. Still, it’s worth giving a try to increase your proficiency in the field.
- You may face innumerable bugs that can be solved using standard libraries.
- You need to take into account the possible undecided jumps used in algorithms that are difficult to be implemented in coding. Proceed by implementing the simpler version of the complex algorithm to make it computationally efficient.

**Algorithm Suggestions**

Some algorithms are child’s play, while others can disturb even the most skilled programmers. Here are a few suggestions to start with your machine learning algorithm implementation.

**Linear Regression of least squares with two data sets.**Plot the line of best fit for every iteration. Notice how the updates affect the model x from y.**K-Nearest Neighbors (better-called "kNN")**using two data sets with two classes that can be plotted on the graph paper. Create relationships for the possible predictions the model can make.**Implement the simplest model of artificial neural networks**(similar to the regression model). Graph the model prediction as it progresses with the dataset.

Implementing and improving algorithms to solve the problems help you develop valuable skills. Don’t get overwhelmed, nothing is really complex, start with simple processes, then enhance your code to cover the bigger class of a problem.

**© 2019 Prachi Sharma**