This project evaluates different machine learning models on the dataset and explores hyper-parameter optimization for improving model performance. Predicts which water pumps are faulty to promote access to clean, potable water across Tanzania.
# ML-Model-Evaluations
This project evaluates different machine learning models on the dataset and explores hyper-parameter optimization for improving model performance. Predicts which water pumps are faulty to promote access to clean, potable water across Tanzania.
## Data Preprocessing
Data preprocessing transforms the raw dataset into a more suitable format for machine learning models, improving accuracy, efficiency, and effectiveness. Below are the key preprocessing steps undertaken for the "Pump it Up: Data Mining the Water Table" competition dataset.
### Categorical Feature Handling
The dataset contains several categorical features with varying levels of cardinality, and handling them properly is crucial for model performance:
- **OneHotEncoder**: Applied to categorical variables with low cardinality, this method transforms category values into new binary columns, enabling the model to understand the presence or absence of categories.
- **OrdinalEncoder**: Used for ordinal data where the order of categories matters, this encoder converts string labels to integer codes while preserving the inherent order of the categories.
- **TargetEncoder**: Employed for high cardinality features, target encoding replaces a categorical value with a probability blend, helping encode categorical features more effectively without causing data leakage or overfitting.
A custom preprocessing pipeline was created to handle target encoding, including missing value handling and the application of the `TargetEncoder` to prevent leakage.
### Dealing with Missing Values
Missing data can impact model performance significantly, so two strategies were employed:
- **Numerical Data**: A `SimpleImputer` was used to replace missing values with the median, ensuring robustness to outliers.
- **Categorical Data**: Missing values were replaced with the most frequent category using `SimpleImputer`.
### Scaling Numerical Values
Numerical features were scaled using `StandardScaler`, which …