An open API service indexing awesome lists of open source software.

https://github.com/soumyadipta2020/ml-pyspark

Machine Learning in PySpark
https://github.com/soumyadipta2020/ml-pyspark

coding data-science jupyter-notebook machine-learning machine-learning-algorithms modelling notebook notebook-jupyter pyspark python statistical-analysis

Last synced: about 2 months ago
JSON representation

Machine Learning in PySpark

Awesome Lists containing this project

README

          

# Machine Learning with PySpark πŸ€–πŸ§ πŸ‘Ύ

![GitHub Repo stars](https://img.shields.io/github/stars/Soumyadipta2020/ML-PySpark?style=social)
![GitHub forks](https://img.shields.io/github/forks/Soumyadipta2020/ML-PySpark?style=social)
![GitHub license](https://img.shields.io/github/license/Soumyadipta2020/ML-PySpark)
[![HitCount](https://hits.dwyl.com/Soumyadipta2020/ML-PySpark.svg?style=flat-square)](http://hits.dwyl.com/Soumyadipta2020/ML-PySpark)

This repository contains a **Jupyter Notebook** that demonstrates how to perform **Machine Learning** tasks using **PySpark**. It is designed to provide a hands-on, practical introduction to using the Spark MLlib library for scalable machine learning.

## πŸ“š Contents

- **Notebook**:
- `ML-pyspark.ipynb`: A sample Jupyter Notebook showcasing end-to-end machine learning workflows in PySpark.

- **Sample Dataset**:
- Includes a small dataset for demonstration purposes.

## 🌟 Features Demonstrated

1. **Data Loading and Exploration**
- Loading datasets using Spark's DataFrame API.
- Data cleaning and preprocessing.

2. **Feature Engineering**
- Transforming and scaling features.
- Using `VectorAssembler` and other Spark tools.

3. **Model Training**
- Training ML models using Spark MLlib (e.g., Linear Regression, Random Forest).
- Cross-validation and hyperparameter tuning.

4. **Model Evaluation**
- Using metrics such as RMSE, R2, accuracy, etc., to evaluate models.

5. **Prediction**
- Generating predictions on test datasets.
- Saving and loading trained models.

## πŸ“‘ Requirements

- **Python**: 3.8+
- **PySpark**: 3.x
- **Jupyter Notebook**: Installed via Anaconda or pip.
- **Docker** (Optional): For setting up a PySpark environment. (being used here)

## πŸ“’ Getting Started

1. **Clone the Repository**:
```bash
git clone https://github.com/Soumyadipta2020/ML-PySpark.git
cd machine-learning-pyspark
```

2. **Set Up the Environment**:
- Install dependencies:
```bash
pip install -r requirements.txt
```
- Alternatively, set up a Docker container:
```bash
docker pull quay.io/jupyter/all-spark-notebook
docker run -it --name pyspark-jupy --mount type=bind,source=your_location,target=/app/data --rm -p 8888:8888 quay.io/jupyter/all-spark-notebook
```

3. **Launch the Notebook**:
```bash
jupyter notebook ML-pyspark.ipynb
```

4. **Run the Notebook**:
- Follow the step-by-step instructions in the notebook to explore PySpark’s MLlib capabilities.

## ⚑ Usage

This notebook is for:
- **Beginners**: Learn the basics of machine learning with PySpark.
- **Practitioners**: Use it as a template for building scalable ML solutions.
- **Educators**: Teach Spark MLlib concepts interactively.

## 🀝 Contributing
We welcome contributions! If you have additional sample codes or improvements, please:

- Fork this repository.
- Create a feature branch:
```bash
git checkout -b feature/your-feature-name
```
- Commit your changes and push the branch:
```bash
git push origin feature/your-feature-name
```
- Open a Pull Request.

Make sure your code follows the repository's style and is well-documented.

## πŸͺ§ Acknowledgments

- **Apache Spark**: The framework powering this project.
- **Jupyter Project**: For the interactive environment.
- Sample datasets sourced from publicly available resources for demonstration purposes.

---

Happy learning! πŸš€