Skip to content

This repository includes all ML, DL and RL projects that I have done.

Notifications You must be signed in to change notification settings

arsalanyavari/AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Artificial Intelligence Exercises

In this GitHub repository, I have worked on various aspects of artificial intelligence, organized into four main folders.

The Machine Learning (ML) section covers fundamental techniques such as classification, clustering, recommender systems, and regression.

The Deep Learning (DL) folder includes projects like digit classification, a recommender system using neural networks, and both binary and multi-class classification with Fastai.

Additionally, the Reinforcement Learning (RL) section features a project utilizing Deep Q-Networks (DQN) for the Lunar Lander environment.

Lastly, there is a web scraper for data collection purposes.


Projects:

(Click on each section to see the list of units)

ML Projects:

  • KNN: Jupyter Source Code
    This project implements a K-Nearest Neighbors (KNN) classifier to predict university admission outcomes based on various academic scores.

    The shape of data:
    KNN Project Image

    The result:
    KNN Project Image


  • SVM: Jupyter Source Code
    This project focuses on evaluating student performance using various factors such as General Appearance, Manner of Speaking, and Communication Skills.

    The shape of data:
    SVM Project Image

    The result:
    SVM Project Image


  • decision_tree: Jupyter Source Code
    This project implements a Decision Tree Classifier to predict student grades based on various educational factors.

    The shape of data:
    decision_tree Project Image

    The result:
    decision_tree Project Image


  • logistic_regression: Jupyter Source Code
    This project implements a logistic regression model to classify data based on two exam scores.

    The shape of data:
    logistic_regression Project Image logistic_regression Project Image logistic_regression Project Image

    The result:
    logistic_regression Project Image logistic_regression Project Image
DL Projects:

  • Cat-Dog Binary Classification: Jupyter Source Code
    This project utilizes FastAI to develop a binary classification model, leveraging the power of ResNet34 architecture. By implementing fine-tuning techniques, we achieved an impressive error rate of 0.004736


  • Multi Class Classification: Jupyter Source Code
    This project utilizes FastAI for multi-class classification by fine-tuning a ResNet34 model to achieve over 95% accuracy on new images. To enhance the dataset, a web scraper was implemented to automatically download images of new classes directly from Google Search, ensuring a diverse and comprehensive training set.


  • Digit Classification: Jupyter Source Code
    This project focuses on classifying handwritten digits from the MNIST dataset. Initially, a baseline model was developed, where simple objects representing each digit class were created based on their average features. Each test sample was then compared against these baseline classes for classification. Building upon this, a Neural Network (NN) model was implemented using a fine-tuning approach, enhancing the accuracy of digit classification. Finally, an NN model was constructed from scratch, showcasing a deep understanding of the architecture and training processes. The culmination of these efforts resulted in an impressive accuracy of over 99% for each digit class, demonstrating the effectiveness of the implemented methods.


RL Project:

  • DQN_LunarLander-v2: Jupyter Source Code
    This project implements a Deep Q-Network (DQN) to solve the LunarLander-v2 environment using OpenAI's Gym and Stable Baselines3. The agent is trained over 2,000,000 timesteps to learn optimal landing strategies, achieving an average reward of approximately 267 across 10 test episodes.

    The reesult: DQN_LunarLander-v2 Project Image
The Web Scraper Script:
  • Python Source Code
    This Python script allows you to download images from Google Image Search based on a specified search term. It uses popular libraries such as requests, BeautifulSoup, and Pillow to fetch and save images efficiently.

    Requirements

    Make sure to have the following libraries installed:

    pip install requests beautifulsoup4 pillow

    Features

    • Customizable Image Search: Specify the search term and the number of images to download.
    • Error Handling: Retries downloading each image up to five times if an error occurs.
    • Configurable Sleep Time: Set a delay between image downloads to avoid overwhelming the server.
    • Organized Storage: Downloads are saved in a specified directory, which is created if it doesn't exist.

    The features default parameters

      def download_images(search_term: str, num_images: int = 5, sleep_time: float = 1.0,
                           target_path: str = "downloaded_images")

Also my ML and DL courses assignments are available in Sharif-University-ML-DL-RayanCourse_Assignments repository that includes:

Exploratory Data Analysis (EDA), Data Preprocessing, Logistic Regression and Unsupervised Image Segmentation using Clustering Jupyter Source Code

  • The main image:


    The classes:


    The result:

Nural Network, Binary Classification, Image Classification and data transformation & normalization Jupyter Source Code
  • The Binary Classification Data Plot:

    The classes:

    Data Transformation and Normalization:

    The CNN Model Performance:
Variational Autoencoder (VAE) Implementation and Stable Diffusion Jupyter Source Code

  • The VAE original image:


    The VAE reconstruction:


    2D Latent Space:


    The Stable Diffusion rsult based on "a photograph of an astronaut riding a horse" prompt: