def test_one_hot_encode(self): dataBot = DataBot(self.df, target_name='Survived') dataBot.impute(['Embarked'], ImputerStrategy.MODE) dataBot.one_hot_encode('Embarked', self.df['Embarked'].values) encoded_cols = {'Embarked_S', 'Embarked_C', 'Embarked_Q'} self.assertTrue(encoded_cols.intersection(set(dataBot.features.columns)) == encoded_cols)
def test_normalize(self): dataBot = DataBot(self.df, target_name='Survived') dataBot.impute(['Age'], ImputerStrategy.MEAN) dataBot.normalize(['Age']) self.assertTrue(np.allclose(272.84, dataBot.features['Age'].sum(), 2))
def test_impute(self): dataBot = DataBot(self.df, target_name='Survived') dataBot.impute(['Age'], ImputerStrategy.MEAN) expected_a = 21205.17 self.assertTrue(np.allclose(expected_a, dataBot.features['Age'].sum(), 2))