ref:Cleaned the Structure

This commit is contained in:
2025-11-07 14:20:22 +05:30
parent d7dbcff4b6
commit 1b622b6a19
42 changed files with 2164 additions and 806 deletions

View File

@@ -21,6 +21,7 @@ class DataProcessor:
self.categorical_features = []
self.feature_names = []
self.encoders = {}
self.target_encoder = None # Add target encoder
self.scaler = StandardScaler()
self.X_train = None
@@ -75,6 +76,13 @@ class DataProcessor:
X = self.df[feature_cols].copy()
y = self.df[self.target_column].copy()
# Encode target variable if it's categorical
if y.dtype == 'object' or y.dtype.name == 'category':
self.target_encoder = LabelEncoder()
y_encoded = self.target_encoder.fit_transform(y)
y = pd.Series(y_encoded, index=y.index)
print(f"Target '{self.target_column}' encoded: {dict(enumerate(self.target_encoder.classes_))}")
# Encode categorical variables
for col in self.categorical_features:
if col in X.columns: