def get_vectors(self):
vector_results = defaultdict(dict)
// Loop through all the categories that we should compute the vectors
for cat, cat_groups in self._groups.iteritems():
// Loop through all the category values present
// in the current category
for cat_value, sample_ids in cat_groups.iteritems():
// Compute the vector for the current category value
vector_results[cat][cat_value] = self._get_subgroup_vectors(
sample_ids)
return vector_results
After Change
def get_vectors(self):
result = VectorsResults(self._alg_name, self._weighted, [])
// Loop through all the categories that we should compute the vectors
for cat, cat_groups in self._groups.iteritems():
// Loop through all the category values present
// in the current category
res_by_group = []
for cat_value, sample_ids in cat_groups.iteritems():
// Compute the vector for the current category value
res_by_group.append(self._get_group_vectors(cat_value,
sample_ids))
// result[cat][cat_value] = self._get_group_vectors(
// sample_ids)
result.categories.append(self._test_vectors(cat, res_by_group))
return result
def _test_vectors(self, category, res_by_group):