This repository contains simple implementations of various machine learning algorithms parallelized using the Message Passing Interface (MPI) for distributed computing.
- Parallel Gradient Descent: Implementation of distributed linear regression with gradient averaging using MPI reduce operations.
- Parallel Model Evaluation: Distributed evaluation of machine learning models across multiple processes with communication via send/recv and reduce operations.
- Parallel K-means Clustering: Implementation of the K-means clustering algorithm in a distributed setting, parallelizing both the distance calculations and centroid updates.
- mpi4py
- NumPy
- scikit-learn
# Install required packages
pip install mpi4py numpy scikit-learn
# Clone the repository
git clone https://github.com/lokk798/parallel-ml-algorithms-mpi.git
cd parallel-ml-algorithms-mpi
Run the algorithms using the MPI launcher:
# Run parallel gradient descent with 4 processes
mpiexec -n 4 python parallel_gradient_descent.py
# Run parallel model evaluation with 4 processes
mpiexec -n 4 python parallel_model_evaluation.py
# Run parallel K-means with 4 processes
mpiexec -n 4 python parallel_kmeans.py