Machine Learning Algorithms- Fit and predict train and test data


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.

Machine Learning Algorithms- Fit and predict train and test data

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

# importing required libraries

import pandas as pd

from sklearn.linear_model import LinearRegression

from sklearn.metrics import mean_squared_error

Logistic Regression

Decision Tree

SVM (Support Vector Machine)

Naive Bayes

KNN (k- Nearest Neighbors)


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

Contact Us

Tel: (+91) 0120  4118730  

Time :   10 : 00  AM -  08 : 00 PM IST 

Registered address: G-69, Sector 63, 

 Noida - 201301, India

We Provide Services Across The different countries

USA    Australia   Canada   UK    UAE    Singapore   New Zealand    Malasia   India   Ireland   Germany

CodersArts is a Product by Sofstack Technology Solutions Pvt. Ltd.

  • CodersArts | Linkedin
  • Instagram