def test_the_number_of_instances(self): instances = ins.TrainingInstances([ instance.TrainingInstance(['foo', 'bar'], 'a'), instance.TrainingInstance(['foo', 'foobar'], 'b') ]) self.assertEqual(2, len(instances), '2 instances should be present')
def test_to_string(self): instances = ins.TrainingInstances([ instance.TrainingInstance(['foo', 'bar'], 'a'), instance.TrainingInstance(['foo', 'foobar'], 'b') ]) self.assertEqual('[[foo,bar;a], [foo,foobar;b]]', str(instances))
def training(self, file_path): all_values = self.__get_all_values(file_path, self.DATA) return inss.TrainingInstances([ins.TrainingInstance(values[:-1], values[-1]) for values in all_values if values is not None])