DEV Community

Wickliff Odoyo
Wickliff Odoyo

Posted on

How ML and its components works

We have three types of machine learnings:

1.Supervised machine learning

-It has labeled data.
-It is used to predict things like house prices
-it uses models such as:Regression,Random forest,Decision tree.

2.Unsupervised machine learning

-This has unlabeled data.
-It is used to predict things such as customer segmentation.
-It uses models such as Clustering

3.Reienforcement machine learning

-The model learns through rewards and penalties.
Game-playing AI

Pattern Ml follows to predicts its data

1.Loading data

-This is done by help of pandas,numpy,scikit-learn e.g

2.Prepare the Data

Data is cleaned and organized according to the how it should appear while working with it.
-Remove missing values

-Encode text categories

-Normalize numbers

3.Split the data

-split kit into traing data and testing data.

4.Choose a Model

-A model is the algorithm that learns patterns from the data.
Examples:
-Linear Regression
-Decision Trees
-Neural Networks

5.Train the Model

-The model studies the training data and adjusts itself to reduce errors.

6.Evaluate the Model

7.Make Predictions

Once trained, the model can predict outcomes for new data.

8.Do visualizations

see how the data is structured

Components of Machine Learning

1. Data

-Data is the foundation of ML
Types of data:
Numerical data
Text data

2. Features

-Features are the input variables used to make predictions.
Example:
House size
Number of bedrooms
Location
These help predict:
House price

3. Labels / Target Variable

-The value the model tries to predict.
For house pricing:
Price

is the target variable.

4.Model (Algorithm)

-The mathematical system that learns patterns.
Examples:
-Regression models
-Classification models
-Clustering models

5. Training

The process where the model learns from data.
The model:
-Makes predictions
-Compares predictions with actual answers
-Adjusts itself to reduce error
-This repeats many times.

6. Loss Function

Measures how wrong the predictions are.
Example:
Mean Squared Error (MSE)

Smaller loss = better predictions.

7. Optimization

The method used to improve the model.

a)Common optimizer:

b)Gradient Descent

It updates model parameters to reduce loss.

8. Evaluation Metrics

Used to measure performance.

a)regression:

-MAE
-RMSE
-R² Score

b)classification:

-Accuracy
-Precision
-Recall
-F1-score

Top comments (0)