Spaces:
Runtime error
Runtime error
File size: 1,168 Bytes
2907194 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import os
from mlProject import logger
from sklearn.model_selection import train_test_split
import pandas as pd
from mlProject.entity.config_entity import DataTransformationConfig
class DataTransformation:
def __init__(self, config: DataTransformationConfig):
self.config = config
## Note: You can add different data transformation techniques such as Scaler, PCA and all
#You can perform all kinds of EDA in ML cycle here before passing this data to the model
# I am only adding train_test_spliting cz this data is already cleaned up
def train_test_spliting(self):
data = pd.read_csv(self.config.data_path)
# Split the data into training and test sets. (0.75, 0.25) split.
train, test = train_test_split(data)
train.to_csv(os.path.join(self.config.root_dir, "train.csv"),index = False)
test.to_csv(os.path.join(self.config.root_dir, "test.csv"),index = False)
logger.info("Splited data into training and test sets")
logger.info(train.shape)
logger.info(test.shape)
print(train.shape)
print(test.shape)
|