Giter VIP home page Giter VIP logo

ml-fundamentals's Introduction

🤖ML Fundamentals

The following details and explains performing classification on the Iris dataset using a range of ML models:
k-NNs, Naive Bayes, Stochastic Gradient Descent, Decision Trees, Random Forest, SVM, Logistic Regression, Neural Nets

I similarly do the same for regression on the USA House Pricing dataset using:
Linear Regression (and soon Polynomial Regression, Support Vector Regression (SVR), Random Forest Regression, Regularised regression models (Ridge, Lasso)

🌼Classification on Iris Dataset

All content for classification on the Iris dataset can be found in the following notebook:

Notebook

Open In Colab

Dataset

The iris dataset comprises three different irises each with 3 different features, petal length, petal width, sepal width, and sepal length. Some EDA is performed using a simple pairplot to provide an indication of any groupings in the dataset.

1⃣️k-NN

Using k-Nearest Neighbours to predict the iris type using features of the plant

Optimimum k

When using a k-NN model, it can be useful to find the optimum k number. The model is trained for a k from 1 to 40 and it was found that the best k number for this dataset is 4.

Results

The model with a k of 4 achieved perfect accuracy:

                 precision    recall  f1-score   support

    Iris-setosa       1.00      1.00      1.00        11
Iris-versicolor       1.00      1.00      1.00        19
 Iris-virginica       1.00      1.00      1.00        15

       accuracy                           1.00        45
      macro avg       1.00      1.00      1.00        45
   weighted avg       1.00      1.00      1.00        45

2⃣️Naive Bayes

Using Naive Bayes to predict the iris type using features of the plant

Results

The accuracy of the Naive Bayes model is high, but is not perfect:

              precision    recall  f1-score   support

           1       1.00      1.00      1.00        19
           2       1.00      0.92      0.96        13
           3       0.93      1.00      0.96        13

    accuracy                           0.98        45
   macro avg       0.98      0.97      0.97        45
weighted avg       0.98      0.98      0.98        45

3⃣️Stochastic Gradient Descent

Using Stochastic Gradient Descent to predict the iris type using features of the plant

Results

              precision    recall  f1-score   support

           1       1.00      1.00      1.00        19
           2       1.00      0.69      0.82        13
           3       0.76      1.00      0.87        13

    accuracy                           0.91        45
   macro avg       0.92      0.90      0.89        45
weighted avg       0.93      0.91      0.91        45

4⃣️Decision Tree

Using a Decision Tree to predict the iris type using features of the plant

Results

              precision    recall  f1-score   support

           1       1.00      1.00      1.00        19
           2       1.00      1.00      1.00        13
           3       1.00      1.00      1.00        13

    accuracy                           1.00        45
   macro avg       1.00      1.00      1.00        45
weighted avg       1.00      1.00      1.00        45

5⃣️Random Forest

Using a Random Foreste to predict the iris type using features of the plant

Results

              precision    recall  f1-score   support

           1       1.00      1.00      1.00        19
           2       1.00      1.00      1.00        13
           3       1.00      1.00      1.00        13

    accuracy                           1.00        45
   macro avg       1.00      1.00      1.00        45
weighted avg       1.00      1.00      1.00        45

6⃣️Support Vector Machine (SVM)

Using an SVM to predict the iris type using features of the plant

Results

              precision    recall  f1-score   support

           1       1.00      1.00      1.00        19
           2       1.00      1.00      1.00        13
           3       1.00      1.00      1.00        13

    accuracy                           1.00        45
   macro avg       1.00      1.00      1.00        45
weighted avg       1.00      1.00      1.00        45

7⃣️Logistic Regression

Using Logistic Regression to predict the iris type using features of the plant

Results

              precision    recall  f1-score   support

           1       1.00      1.00      1.00        19
           2       1.00      1.00      1.00        13
           3       1.00      1.00      1.00        13

    accuracy                           1.00        45
   macro avg       1.00      1.00      1.00        45
weighted avg       1.00      1.00      1.00        45

8⃣️L-BFGS Neural Network

Using a Neural Network with an lbfgs optimsed to predict the iris type using features of the plant

Results

              precision    recall  f1-score   support

           1       1.00      1.00      1.00        19
           2       0.93      1.00      0.96        13
           3       1.00      0.92      0.96        13

    accuracy                           0.98        45
   macro avg       0.98      0.97      0.97        45
weighted avg       0.98      0.98      0.98        45

ml-fundamentals's People

Contributors

dilne avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.