Skip to content

Repository files navigation

Machine Learning Project

Introduction

This machine learning project had four parts – two were about predicting values (regression), and the other two were about sorting things into categories (classification). It's a type of learning(Supervised Learning) where the computer learns from both input and output data to get better at the task.

image

Regression:

Regression in machine learning involves the prediction of continuous numerical values based on input data. The goal of regression is to model the relationship between input features and a continuous output, allowing for accurate predictions. For example, regression can be applied to tasks such as predicting house prices, stock prices, or temperature, where the algorithm learns patterns from historical data to make predictions about new, unseen data points.

Classification:

Classification in machine learning involves predicting the category or class to which an input belongs. The goal of classification is to build a model that can accurately assign input instances to predefined categories. For instance, classification is widely used in various applications, including spam detection in emails, image recognition tasks, sentiment analysis in natural language processing, and medical diagnosis, where diseases are categorized based on patient data. The algorithm learns from labeled data to classify new, unseen instances into distinct predefined classes.

Goal of Machine Learning:

Machine learning aims to create algorithms that autonomously learn patterns from data for making predictions or decisions. The focus is on developing models that generalize effectively to new, unseen data. Regression and classification are specific tasks within the broader goal of machine learning, demonstrating its versatile applications in predicting continuous values and categorizing inputs into predefined classes.

1. Regression

1.1 First Task

Goal: The goal was to make predictions based on a dataset with 15 examples and 10 features, evaluating seven regression models.

Models Used:

  • Linear Regression
  • Ridge Regression
  • Lasso Regression
  • Lasso LARS
  • Elastic Net
  • Orthogonal Matching Pursuit (OMP)

Approach: Ten-fold cross-validation with Mean Squared Error (MSE) metric.

Results and Conclusions:

image

  • OMP model performed the best with the lowest MSE (2.680).
  • OMP identified five non-zero coefficients, emphasizing its significance in feature selection.
  • Lasso Regression performed less effectively than Ridge Regression.
  • Data normalization was deemed unnecessary based on histogram visualization.

1.2 Second Task

Goal: Make predictions using a dataset generated by two different linear models with 100 examples and four features. Distinguish between instances created by these two distinct models.

Models Used:

  • K-Means
  • Gaussian Mixture Model (GMM)

image

Approach: Applied clustering techniques (K-Means and Gaussian Mixture Model) to divide the training data and create individual regression models.

Results and Conclusions:

image

  • Gaussian Mixture Model with Ridge Regression achieved the lowest MSE (0.046).
  • Residual analysis and input training data approach explored.
  • Importance of considering both input and output data for clustering.

2. Classification

2.1 First Task

Goal: Perform binary image classification on dermoscopy images, predicting whether an image is from a melanoma or a nevus.

image

Data Preparation:

  • Normalization of input vectors.
  • Transformation of y vector into one-hot encoding.
  • Shuffling and splitting of training data.

Models Used:

  • Convolutional Neural Network (CNN)
  • Support Vector Machine (SVM)

Approach:

  • Evaluation metric: Balanced Accuracy.
  • CNN architectures with data augmentation, class weights, and oversampling.
  • SVM with kernel: RBF, Poly, Linear.

Results and Conclusions:

  • CNN number 3 with balanced data augmentation performed the best.
  • Challenges with overfitting and class imbalance observed.
  • Poor performance of SVM compared to CNN.

Summary of the Results:

image

Confusion Matrix for CNN the best results (CNN3) using Validation Data:

image

Insights:

  • Overfitting observed in CNN architecture.
  • F1 score and confusion matrix crucial for evaluation.
  • Consideration of data imbalance in CNN essential.

2.2 Second Task

Goal: The second part of the classification project focused on classifying 2D medical images from two distinct datasets: dermoscopy and blood cell microscopy. The objective was to classify these images into six different categories: nevus (0), melanoma (1), vascular lesions (2), granulocytes (3), basophils (4), and lymphocytes (5).

image

Models Used

  • Convolutional Neural Network (CNN)

image

Data Preprocessing

  • Random oversampling technique employed for minority classes to address class imbalance.
  • Data augmentation techniques applied to increase model diversity and robustness.

Results and Conclusions

  • Two CNN models (Model 1 and Model 2) were evaluated using different approaches.
  • Evaluation metrics: Balanced Accuracy, F1 Score (for each class).
  • Random oversampling achieved the best results for both models, outperforming data augmentation and class weights approaches.
  • Model 2 consistently outperformed Model 1 in terms of Balanced Accuracy and F1 Score for each class.

Summary of Approaches and Results for CNN number 1:

image

Summary of Approaches and Results for CNN number 2:

image

Confusion Matrix for CNN with best results (CNN2) using Validation Data:

image

Insights:

  • Random oversampling proved effective in addressing class imbalance.
  • Model 2 consistently outperformed Model 1, indicating the importance of the chosen approach.
  • F1 Score and confusion matrix provided detailed insights into model performance.

Authors

About

This project covers regression, showcasing the effectiveness of Orthogonal Matching Pursuit, and classification, addressing challenges in image classification with Convolutional Neural Networks and Support Vector Machines. Emphasizing solutions for imbalanced data, the project provides a thorough exploration of model performance.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages