Giter Club home page Giter Club logo

milk_quality's Introduction

Milk Quality

This project cover the classification of quality low, medium and high for milk trough features described in data section. After a exploratory data analysis and due the dataset size, Naive Bayes classifier was selected for solve the task. Other models as SVM and Random Forest were tested as baselines without remarkable performance. nbClassifier was deployed as an API REST with FastAPI.

Data Description

(From Kaggle) This dataset is manually collected from observations. It helps us to build machine learning models to predict the quality of milk. This dataset consists of 7 independent variables ie pH, Temperature, Taste, Odor, Fat, Turbidity, and Color. Generally, the Grade or Quality of the milk depends on these parameters. These parameters play a vital role in the predictive analysis of the milk.

Usage

The target variable is nothing but the Grade of the milk. It can be.

Target

  • Low (Bad)
  • Medium (Moderate)
  • High (Good)

If Taste, Odor, Fat, and Turbidity are satisfied with optimal conditions then they will assign 1 otherwise 0. Temperature and ph are given their actual values in the dataset.

Inspiration: To leverage the benefits of machine learning in the dairy industry.

Project covers:

  • Data Cleaning and Handle Duplicated
  • EDA
  • Dimensional Reduction Analysis
  • Modelling
  • Deployment

EDA

The available data contain a lot of duplicated samples, after remove it, data decreased significantly:

Target

All features are numeric:

Features

Visualize Dimensional Reduction

As an exercise, a PCA and t-SNE was developed showing the next results:

As we can see, high and medium quality share space, risk inferring that the difference between medium and high quality is very small.

Modelling

SVM, Random Forest and KNN Classifier was developed but none of the above models reach better results than Naive Bayes Classifier. The baselines for each of the above models yielded an accuracy on the test set of:

~ nbClassifier Random Forest SVM KNN
Accuracy 0.92 0.76 0.84 0.68

Test

Matriz confusion shows:

On the other hand classification report is shown:

Deployment

API was builded using FastAPI with a POST method. Request and response functions were developed by classes inherited from Basemodel (pydantic library) for consume appropiate data.

milk_quality's People

Contributors

michaelgaliciaz 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.