Processing math: 100%
Skip to main content

codeBox.js

Digit recognition with Multi-layer perceptron (MLP) models



The MNIST (Modified National Institute of Standards and Technology) database is a large collection of handwritten digits as monochrome images. The digits have been size-normalized and centered in a fixed-size image.

The goal of this experiment is to find a set of hyperparameters that result in an accurate model and excellent model performance using GridSearchCV from Scikit-learn as a tunning technique.

Randomly I selected 3 optimizers (Adam, RMSprop, and SGD) as a starting point to develop the MLP models; later I tuned the 3 different models with their own hyperparameters and chose the model that predicted with higher accuracy the digits.

I created my own database with 20 samples and I preproced the images trying to simulate the original set to predict digits with the selected model.

In the end, the model showed high accuracy on the test set but the accuracy decreased with the custom dataset.

The problem with MNIST is that the dataset is "too perfect";  in real life, we have to deal with lights and shadows in images, variations in the way people draw a digit, noise (shapes that are not part of the actual digit), no-centered draws, and more consideration. A digit recognition model that only works on its own dataset wouldn't be that interesting but is good enough if you are new in this field and if your goal is to learn, practice, and get familiar with different machine learning tools.


The complete Jupyter Notebook can be found in my github: here












Comments

Popular Post

ESP32 SPI Master - Slave

The SPI (Serial Peripheral Interface) acts as a synchronous data bus used to send data between microcontrollers and small peripherals that use separate lines for data and a clock that keeps both sides in perfect sync. In SPI only one side generates the clock signal ( SCK for serial clock). The side that generates the clock is called the Controller or the Master, and the other side is called the Peripheral or the Slave. There is always only one Controller , but there can be multiple Peripherals . Data sharing from the  Controller to the  Peripheral is sent on a data line called COPI (Controller Output Peripheral Input). If the Peripheral  needs to send a response back to the Controller data is sent on the line called CIPO (Controller Input Peripheral Output). The last line is called CS (Chip select) or SS (Slave select). This tells the peripheral that it should wake up and receive/send data and is also used when multip...

Prototype of a simple mobile robot

The first thing I made was a preliminary sketch of the most important parts with an overview of how I would like to look at the robot, it's a simple design but I need the robot to be modular, to make improvements and updates later. The general idea is to use it in different projects, by now, the first challenge is to build the structure and the second challenge is to write code to control the robot through Bluetooth and an Android app. To put the circuit PCB or just a protoboard over the top face of the robot I designed 4 sliders that rotate on their own axes. At the moment of designing the robot, I didn't know exactly the size of the PCB, so this simple mechanism will help me to adapt different sizes of circuits over the chassis of the robot. For more details, the  interactive 3D view  below allows you to isolate single or multiple components designed, so feel free to check the parts for a better understanding of how the robot works. To develop the st...

ESP32-CAM: Stream Video with an Asynchronous Web Server

  Introduction This project was developed under two main characteristics: efficiency and scalability. The original example available on the Arduino IDE, "ESP32/Camera/CameraWebServer.ino" is a great example for beginners and runs well. However, a problem arises when I tried to escalate the project. I decided to rebuild the entire application to adjust to my necessities, rewrite the code, delete unnecessary parts, create a directory, and keep single files (.cpp, .h, .html, .css, .js, etc.) I used  PlarformIO with VSCode to create the project structure, for directory management. I adapted the server code to run with an asynchronous web server, this gives me the ability to handle multiple connections from different clients simultaneously without blocking the main program flow. The frontend was developed using responsive design to adapt to different screens, additional for mobile devices was implemented a full-screen mod...

Analizing IMDB data (movie review) for sentiment analysis

This is the first neural networks project I made with preprocessed data from IMDB to identify sentiments (positive or negative) from a dataset of 50.000 (25.000 for training and 25.000 for testing). I tried to detail every step and decision I made while creating the model. In the end, the neural network model was able to classify with an accuracy of 81.1% or misclassify 11.9% of the data (around 3000 movie reviews). This is a high error margin considering that an acceptable error must be between 3% and 5%, but the model, in general, helped me and gave me clues to develop a new version. At the same time, I learned a slight introduction to Natural Language Processing, a topic new to me. 1. The dataset : IMDB (Internet Movie Database) ¶ References: ¶ Maas, A., Daly, R., Pham, P., Huang, D., Ng, A., & Potts, C. (2011). Learning Word Vectors for Sentiment Analysis. IMDB movie review sentiment classification dataset ...