0% found this document useful (0 votes)
3 views24 pages

Machine Learning Overview and K-Means Analysis

this presentation discuss first the role of machine leaning in data science secondly it illustrate how to implement the K-means algorithm in python using the sckitlean Library
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODP, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views24 pages

Machine Learning Overview and K-Means Analysis

this presentation discuss first the role of machine leaning in data science secondly it illustrate how to implement the K-means algorithm in python using the sckitlean Library
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODP, PDF, TXT or read online on Scribd

KAMPALA INTERNATIONAL UNIVERSITY

SCHOOL OF MATHEMATICS AND COMPUTING


DEPARTMENT OF COMPUTER SCIENCE
MASTER OF SCIENCE IN DATA SCIENCE AND ANALYTICS
PROGRAMMING AND ALGORITHMS FOR DATA ANALYTICS

Clustering result ABDIRAHMAN MOHMAMED


MOHAMUD
MACHINE LEANING

In the context of Data Science (DS), "ML" refers


to Machine Learning, a subset of Artificial
Intelligence (AI) that focuses on enabling computers
to learn from data and make predictions or decisions
without explicit programming
TYPES OF MACHINE LEANING

1. SUPERVISED LEARNING

Supervised learning is a type of machine learning where a


model is trained using labeled data. Each training example
includes both the input (features) and the correct output
(label)
MACHINE LEARNING
 SUPERVISED LEARNING
MACHINE LEARNING

 Types of supervised learning

• Classification: Predicting categorical


outcomes (e.g., "cat" vs. "dog").
• Regression: Predicting continuous values
(e.g., house prices).
MACHINE LEARNING

 UNSUPERVISED LEANING

A machine learning technique where algorithms


analyze unlabeled datasets. The system tries to
discover hidden structures, groupings,or
relationships without predefined labels.
MACHINE LEARNING
MACHINE LEARNING

 Types of unsupervised learning:


 Clustering: grouping data points into clusters(eg.
Grouping customers by habits)

 Association: Discovering rules that describe


relationships (e.g. if X is bought, Y is likely bought
too)
SCKITLEARN LIBRARY

Scikit-learn (sklearn) is an open-source Python library that


provides simple and efficient tools for machine learning
and data analysis. It is built on top of NumPy, SciPy, and
Matplotlib, and offers a wide range of algorithms for
classification, regression, clustering, dimensionality
reduction, model selection, and preprocessing.
SCIKITLEARN LIBRARY

 Step to use sckitlean


 Install scikit-learn: pip install scikit-learn
 Import sckitlearn: import sklearn
 Import the ML we want to use
• Logistic Regression
from sklearn.linear_model import LogisticRegression
• Linear Regression
from sklearn.linear_model import LinearRegression
• Random Forest
from [Link] import RandomForestClassifier # for classification
from [Link] import RandomForestRegressor # for regression

USING SCKIT-LEARN IN VS CODE
SCIKIT-LEARN
 Limit of scikit-learn
§ No support for deep learning/neural networks
§ Works best with small to medium datasets(not ideal for
bigdata)
§ No built-in autoML, manual hyperparameter tuning, and
feature engineering required.
§ Limited for complex production and real-time systems
§ Focused mainly on classical ML(regression,
classification, clustering)
§ Missing advanced methods(eg. Reinforcement learning,
sequence models)
K-MEANS ALGORITHM

K-means is an unsupervised machine learning


algorithm used to group data into k distinct clusters
based on similarity. It’s widely used in customer
segmentation, image compression, and pattern
discovery.
K-MEANS ALGORITHM
 Presentation of the database
K-MEANS ALGORITHM
 Step1: define the optimal K
K-MEANS ALGORITHM
 The best K is where the curve slope
K-MEANS ALGORITHM
 How to implement the K-MEANS?
K-MEANS ALGORITHM
K-MEANS ALGORITHM RESULT
RESULT WITH LABEL
K-MEANS EVALUATION

q Silhouette Score

A metric that evaluates the quality of clustering by


measuring how similar a data point is to its own cluster
compared to other clusters. Scores range from -1 to 1, where
higher values indicate better-defined and well-separated
clusters.
K-MEANS EVALUATION
Silhouette Score
K-MEANS ALGORITHM

Advantages
§Simple and fast
§Works well with large
datasets
§Easy to interpret results
K-MEANS ALGORITHM

Limitations
§ You must choose kk in advance
§ Sensitive to initial centroid placement
§ Assumes spherical clusters of similar
size
§ Doesn’t handle outliers well

You might also like