The experiment covers both regression and classification tasks, where we applied a variety of machine learning techniques and evaluated their performance using various metrics. The tasks include performing regression with linear and kernelized methods, as well as classifying data using Bayesian classifiers, K-nearest neighbors, and linear classifiers.
- Implemented a linear regression model to predict the 3D position of a particle using a 10-dimensional feature vector.
- Metrics used for evaluation:
- Pearson Correlation
- Mean Squared Error (MSE)
- Mean Absolute Error (MAE)
- Visualized the performance using correlation plots comparing the actual vs predicted values.
- Implemented a generalized regression using a polynomial kernel to predict the particle's position based on the magnitude of the force along two basis vectors.
- Evaluated the model with the same metrics and presented correlation plots for each target variable.
- Implemented generalized regression with a non-polynomial kernel to predict the probability of rain using 5 satellite readings.
- Reported the Pearson Correlation, MSE, and MAE, along with correlation plots for the target variable.
- Implemented binary classification for predicting the product being produced based on the sensor readings from 10 sensors.
- Used the following methods:
- Bayes' classifiers (Normal, Exponential, and GMMs)
- K-nearest neighbors (K-NN) with different values of K and distance metrics (Euclidean and Cosine)
- Linear classifiers (One-vs-Rest for multi-class cases)
- Evaluation metrics included:
- Classification accuracy
- Confusion matrix
- F1 score
- ROC curves
- Implemented multi-class classification for predicting one of 10 products based on sensor data from 25 sensors.
- Used the same methods as in Q4, but extended for 10 classes.
- Evaluated models using the following metrics:
- Classification accuracy
- Confusion matrix
- F1 score
- ROC curves for class pairs
- Likelihood curve for EM with different mixture counts
- Empirical risk using logistic regression
-
Regression Tasks:
- Linear regression effectively modeled the relationship between the sensor readings and the 3D position of the particle.
- The polynomial kernel regression improved predictions for tasks involving nonlinear relationships.
- The non-polynomial kernel regression successfully predicted the probability of rain, highlighting the importance of kernel choice.
-
Classification Tasks:
- The Bayesian classifiers and K-NN models showed diverse strengths depending on the dataset's characteristics.
- One-vs-Rest classifiers performed well for multi-class classification, and we observed how different kernels affected the performance of the models.
- The logistic regression model provided a solid baseline for evaluating the empirical risk on both train and test data.
The tasks include implementing backpropagation for neural networks, solving regression and classification problems, and analyzing the Kuzushiji-MNIST dataset. The work emphasizes fundamental understanding and experimentation with machine learning algorithms without relying on advanced ML libraries.
- Implemented error backpropagation algorithm for:
- Fully connected multi-layer feed-forward neural networks (MLPs).
- Multilayer Convolutional Neural Networks (CNNs).
- Incorporated hyperparameters such as loss functions, layer configurations, and kernel properties.
- Demonstrated bias-variance trade-offs with three regularization techniques and visualized results using bias-variance curves.
- Solved regression problems using multi-layer perceptrons (MLPs).
- Achieved results comparable to Assignment 1 metrics while demonstrating improvements through overfitting and regularization.
- Used MLPs for classification tasks with two distinct loss functions.
- Implemented SVMs with and without slack formulations and experimented with three kernels:
- Linear Kernel
- Polynomial Kernel
- Gaussian Kernel
- Conducted grid search for optimal hyperparameters and applied the one-vs-rest approach for multi-class classification.
- Performed a 10-class classification using:
- Logistic Regression.
- SVM with Gaussian Kernel.
- Multi-layer Perceptrons (MLPs).
- Convolutional Neural Networks (CNNs).
- Compared models based on size vs performance:
- CNNs outperformed other methods with the highest accuracy and efficiency for the dataset.
- Backpropagation Implementation: Developed a robust modular implementation for both MLPs and CNNs, enabling flexibility in hyperparameter adjustments.
- Regularization Techniques: Demonstrated the effectiveness of regularization in mitigating overfitting through bias-variance plots.
- SVM Analysis: Explored kernelized SVMs and highlighted the trade-offs between computational complexity and model performance.
- Kuzushiji-MNIST Performance: Established CNNs as the most efficient model for high-dimensional image classification, showcasing their scalability and accuracy.
Professor: Prof. Prathosh A. P
Date: April 1, 2024
Experiment3 which involves working with two distinct datasets: one on vision (Animal Image Dataset) and one on text (News Text Dataset). The assignment tasks include implementing machine learning algorithms from scratch, including self-attention, PCA, K-means, decision trees, and gradient boosting. The assignment also requires solving classification and clustering problems for both datasets.
- Implemented a self-attention block from scratch using token length and number of attention layers as hyper-parameters.
- Developed a Principal Component Analysis (PCA) class that allows for dimensionality reduction with the number of components as a hyper-parameter.
- Implemented K-means clustering with different distance metrics (e.g., Euclidean, Cosine) as hyper-parameters for clustering tasks.
- Built a Decision Tree Classifier with multiple impurity functions (Gini, Entropy) as hyper-parameters.
- Implemented gradient boosting with the ability to take multiple classifiers as inputs and perform ensemble learning.
- Applied a Convolutional Neural Network (CNN) to classify images from the Animal Image Dataset into 10 classes.
- Evaluated the model using accuracy and F1 score as metrics.
- Used PCA to reduce the feature dimensions and applied a Multilayer Perceptron (MLP) on the reduced features.
- Compared the results with the CNN model.
- Implemented a transformer model with self-attention using the PCA-reduced features and compared its performance with the CNN and MLP.
- Applied K-means clustering on both raw image pixels and PCA-reduced feature data.
- Compared the clustering results using Normalized Mutual Information (NMI) as the metric.
- Implemented an ensemble model combining CNN, MLP, and Decision Trees in an AdaBoost framework.
- Compared the ensemble model's performance with the non-ensemble models.
- Extracted features from a pre-trained Imagenet model and trained an MLP on top of the extracted features.
- Solved a 12-class classification problem using an MLP with features derived from news headlines using TF-IDF embeddings.
- Padded the features with zeros to ensure uniform input size.
- Applied a transformer model with self-attention to the same 12-class classification problem and compared results with the MLP model.
- Implemented Random Forest and Gradient Boosted Trees for the classification task.
- Compared the results with the MLP and Transformer models.
-
Vision Dataset:
- The CNN provided strong performance for image classification with high accuracy and F1 scores.
- PCA + MLP performed well in dimensionality reduction, but CNN outperformed in the raw feature space.
- The Transformer model with self-attention improved performance slightly over the MLP but was computationally more intensive.
- Ensemble models (CNN/MLP/Decision Trees in AdaBoost) demonstrated improved generalization over individual models.
- Feature extraction from Imagenet followed by MLP training provided strong performance but required careful feature handling.
-
Text Dataset:
- The MLP model performed well with TF-IDF embeddings for 12-class classification.
- The Transformer model with self-attention achieved comparable results but was more complex to implement.
- Random Forest and Gradient Boosting offered good performance but were not as effective as the transformer for text classification tasks.
- Sriya
- Ensure you have numpy and matplotlib installed in your environment.
- LIBSVM is required for the SVM tasks.
- For TF-IDF embeddings, the Sklearn library was used for feature extraction.
- Adhere to academic integrity policies while using this repository.