Skip to content

uriGrif/ai-from-scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI From Scratch

About the project

As the title suggests, this project is a simple and small Machine Learning library that I've made in order to learn the basics of Artificial Intelligence and to understand how it is actually implemented.

The out-of-the-box code (the main.cpp program) contains an example of a classical machine learning exercise: hand-written digits recongnition (MNIST).

Built With

A small disclaimer

This is just a personal project, with educational purposes. It does not intend to be an actual production library. I definitely don't think it has the prettiest code out there, nor the most efficient and secure. I am no expert in AI, just someone who wanted to learn how it works. I only hope that this project is useful for anyone who wants to take a first dive into machine learning.

Theory behind the code

I recommend checking out this document, which contains everything I've learned while working on this project, plus links to amazing courses, youtube playlists and blogs on the subject, which were my sources.

Prerequisites

Before getting started, you need the following things installed in your computer:

  • gpp compiler

  • make utility

  • Clone this repository:

git clone https://github.com/uriGrif/ai-from-scratch.git
  • Eigen, a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms. Download the source code and place the 'Eigen' folder inside the project's root directory. If you place it somewhere else, remember to change the include path for the build command accordingly.

  • MNIST datasets in .csv format. Once you have the "test" and "train" files, place them in a folder called "/mnist" inside the "/datasets" folder. You can of course store them somewhere else, but be sure to change the path in the code. I couldn't upload the files to Github due to their size, but you can find them anywhere online, here's a posible link.

Getting Started

Once you have all the things listed above, follow this instructions to build and execute the code:

  1. Open your console and enter inside the project's root folder

  2. Run the following command to compile the code:

make
  1. A "/build" folder will be created, containing an executable file called "main". (It will probably have a .exe extension if you are on Windows)

  2. Execute the program:

./build/main
  1. Experiment with it! Try changing the neural network hyper-parameters, changing the layer architecture, test new problems, have fun!