def _make_selection_obj(self, data_table): statistics_param = StatisticsParam(statistics="summary") statistics_param.check() print(statistics_param.statistics) test_obj = DataStatistics() test_obj.model_param = statistics_param test_obj._init_model(statistics_param) test_obj.fit(data_table) adapter = adapter_factory(consts.STATISTIC_MODEL) meta_obj = test_obj.export_model()['StatisticMeta'] param_obj = test_obj.export_model()['StatisticParam'] iso_model = adapter.convert(meta_obj, param_obj) selection_obj = BaseHeteroFeatureSelection() selection_obj.isometric_models = {consts.STATISTIC_MODEL: iso_model} return selection_obj
def test_something(self): statistics_param = StatisticsParam(statistics="summary") statistics_param.check() print(statistics_param.statistics) test_data = self.gen_data(1000, 16) test_obj = DataStatistics() test_obj.model_param = statistics_param test_obj._init_model(statistics_param) test_obj.fit(test_data) static_result = test_obj.summary() stat_res_1 = static_result[self.header[0]] self.assertTrue(self._float_equal(stat_res_1['sum'], np.sum(self.col_1))) self.assertTrue(self._float_equal(stat_res_1['max'], np.max(self.col_1))) self.assertTrue(self._float_equal(stat_res_1['mean'], np.mean(self.col_1))) self.assertTrue(self._float_equal(stat_res_1['stddev'], np.std(self.col_1))) self.assertTrue(self._float_equal(stat_res_1['min'], np.min(self.col_1)))