This repository contains a TensorFlow-based pipeline for feature engineering and binary classification on a plant growth dataset. The pipeline includes data preprocessing, feature engineering, model training, and evaluation. The target variable is Growth_Milestone
.
This project demonstrates how to create a feature engineering pipeline using TensorFlow and train a binary classification model to predict plant growth milestones. The pipeline handles both numerical and categorical features, applies scaling and encoding, and trains a neural network model.
The dataset used for this project includes the following columns:
Sunlight_Hours
(numerical)Temperature
(numerical)Humidity
(numerical)Soil_Type
(categorical)Fertilizer_Type
(categorical)Growth_Milestone
(binary label)
- Convert DataFrame to Dataset: The training dataset is converted from a DataFrame into a TensorFlow Dataset object, shuffled, and batched.
- Numerical Columns:
Sunlight_Hours
,Temperature
, andHumidity
are converted to numeric columns and scaled using MinMax scaling. - Categorical Columns:
Soil_Type
andFertilizer_Type
are formatted and one-hot encoded. - Bucketizing:
Temperature
andHumidity
are bucketized into specified ranges. - Feature Columns: All feature columns are tracked in a list.
- Feature Cross: A feature cross is applied among
Soil_Type
andFertilizer_Type
.
The model is a neural network with the following layers:
- A DenseFeatures layer for the feature columns
- Two hidden Dense layers with ReLU activation
- An output Dense layer with sigmoid activation
The model is compiled with the Adam optimizer, binary cross-entropy loss, and accuracy metric. It is trained for 10 epochs.
The model is evaluated on a test set using accuracy as the metric. Training and validation accuracy and loss are visualized.
The training and validation accuracy and loss over the epochs are plotted to visualize the model's performance.
To use this pipeline, follow these steps:
-
Clone the repository:
git clone https://github.com/yourusername/plant-growth-classification.git cd plant-growth-classification
-
Install dependencies:
pip install tensorflow pandas numpy matplotlib
-
Run the pipeline:
python feature_engineering_pipeline.py
-
View the results: After running the script, training and validation accuracy and loss plots will be generated.
This project is licensed under the MIT License. See the LICENSE file for details.