# Machine Learning Algorithms- Fit and predict train and test data

Hi,

In this post, we will learn how machine learning algorithm work, here we go through basic concepts of all the machine learning algorithms and how to fit and predict train and test data in machine learning.

**Types of ML Algorithms:**

ML Algorithms divided into three categories -

**1.**** Supervised Learning**

**2.**** Unsupervised Learning**

**3. ****Reinforcement Learning**

**Supervised Learning**

It consists of the target variable (or dependent variable) which is to be predicted from a given set of predictors (independent variables). The training process continues until the model achieves a desired level of accuracy on the training data.

**Types of Supervised Learning**

**Regression,****Decision Tree,****Random Forest,****KNN,****Logistic Regression, etc.**

**Unsupervised Learning**

This algorithm work without having any target or outcome variable to predict. It is used for the clustering population in different groups, which is used for segmenting customers in different groups.

**Types of Unsupervised Learning**

**Apriori algorithm,****K-means**

**Reinforcement Learning **

This algorithm used from past experience and tries to capture the best possible knowledge to find accurate decisions.

**Types of Reinforcement Learning**

**Markov Decision Process**

__Linear Regression__

__Linear Regression__

# importing required libraries

import pandas as pd

from sklearn.linear_model import LinearRegression

from sklearn.metrics import mean_squared_error

__Logistic Regression__

__Logistic Regression__

__Decision Tree__

__Decision Tree__

### __SVM (Support Vector Machine)__

__SVM (Support Vector Machine)__

### __Naive Bayes__

__Naive Bayes__

__KNN (k- Nearest Neighbors) __

__KNN (k- Nearest Neighbors)__

__K-Means____ __

__K-Means__

**Metrics to Evaluate your Machine Learning Algorithm**

There are different types of metrics used to evaluate ML Algorithms :

**Classification Accuracy****Logarithmic Loss****Confusion Matrix****Area under Curve****F1 Score****Mean Absolute Error****Mean Squared Error**

Here we will create basic train and test data and fit it into different models, you can also try it itself, here we some changes are made the first one is set appropriate libraries and fit data.

For more visit go to the Codersarts official website - __click here__