top of page
Writer's pictureCodersarts AI

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.


Machine Learning Algorithms- Fit and predict train and test data
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)



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

194 views0 comments

Recent Posts

See All

Comments


bottom of page