Complete training dataset including features and labels
Example Usage:
from data_ingestion.data_loader import Data_Getter# Initialize data getterdata_getter = Data_Getter(file_object, logger_object)# Load training datatraining_data = data_getter.get_data()print(f"Loaded {len(training_data)} training samples")print(f"Features: {training_data.columns.tolist()}")
Implementation:
def get_data(self): self.logger_object.log( self.file_object, 'Entered the get_data method of the Data_Getter class' ) try: self.data = pd.read_csv(self.training_file) self.logger_object.log( self.file_object, 'Data Load Successful.Exited the get_data method of the Data_Getter class' ) return self.data except Exception as e: self.logger_object.log( self.file_object, 'Exception occured in get_data method of the Data_Getter class. Exception message: ' + str(e) ) self.logger_object.log( self.file_object, 'Data Load Unsuccessful.Exited the get_data method of the Data_Getter class' ) raise Exception()
Data Source:
Path:Training_FileFromDB/InputFile.csv
Format: CSV with headers
Content: Raw training data exported from database
The file path Training_FileFromDB/InputFile.csv should contain data exported from the database validation step
# Pseudo-code for database export process1. Validate data schema in database2. Export validated training records to CSV3. Save to: Training_FileFromDB/InputFile.csv4. Data_Getter loads this file for training
# Pseudo-code for prediction data export1. Receive new data via API/batch upload2. Validate data schema matches training format3. Export to: Prediction_FileFromDB/InputFile.csv4. Data_Getter_Pred loads this file for predictions
Both classes provide detailed logging:Success Log:
Entered the get_data method of the Data_Getter classData Load Successful.Exited the get_data method of the Data_Getter class
Failure Log:
Entered the get_data method of the Data_Getter classException occured in get_data method of the Data_Getter class. Exception message: [error details]Data Load Unsuccessful.Exited the get_data method of the Data_Getter class