This repository provides a basic framework for deep learning tasks using PyTorch Lightning. It includes essential modules for data preparation, model definition, training, and evaluation.
pytorch_lightning_basic_lib/
├── pytorch_lightning_basic_lib/
│ ├── __init__.py
│ ├── data_module.py
│ ├── model.py
│ ├── train.py
│ └── evaluate.py
├── setup.py
├── README.md
└── requirements.txt
- TabularDataModule
- setup(): Handling tabular data. Scale and split dataset for train, val, and test.
- feature_selection(): Select features by analyzing correlation between inputs and output, and colinearity between each input.
- RegressionModel: A simple regression model defined using PyTorch.
- train_model: Function to train the regression model using PyTorch Lightning's Trainer.
- evaluate_model: Function to evaluate the trained model's performance.
- Python 3.x
- PyTorch
- PyTorch Lightning
- Clone the repository:
git clone https://github.com/mincasurong/pytorch_lightning_basic_lib.git cd pytorch_lightning_basic_lib pip install -r requirements.txt
- Prepare your data using
TabularDataModule
. - Define and train your model using
RegressionModel
andtrain_model
. - Evaluate your trained model using
evaluate_model
.
Here's a basic example to get you started:
from my_deep_learning_lib.data_module import TabularDataModule
from my_deep_learning_lib.model import RegressionModel
from my_deep_learning_lib.train import train_model
from my_deep_learning_lib.evaluate import evaluate_model
import pandas as pd
# Load your dataset
df = pd.read_csv('your_dataset.csv')
data_module = TabularDataModule(df, target_column='your_target_column', drop_columns=['drop_column1', 'drop_column2'])
data_module.prepare_data()
data_module.setup()
# Define and train the model
model = RegressionModel(input_dim=len(data_module.selected_features))
trained_model = train_model(data_module, model)
# Evaluate the model
evaluate_model(trained_model, data_module)
For more details on the implementation, please refer to the PyTorch Lightning documentation: PyTorch Lightning Docs.
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or additions.
Special thanks to the PyTorch and PyTorch Lightning communities for their continuous support and resources.
This project is licensed under the MIT License
If you have any questions, search on google → mincasurong