Skip to content
Permalink
Browse files

Sort the columns alphabetically for a more predictive ordering

  • Loading branch information...
Fantomas42 committed May 9, 2015
1 parent 8db7fcd commit c87e0a2014dc5bc767985330f5d3c1aa91eae233
Showing with 5 additions and 4 deletions.
  1. +1 −1 demo/settings.py
  2. +1 −0 zinnia/comparison.py
  3. +3 −3 zinnia/tests/test_comparison.py
@@ -25,7 +25,7 @@

SITE_ID = 1

LANGUAGE_CODE = 'en'
LANGUAGE_CODE = 'fr'

LANGUAGES = (
('en', gettext('English')),
@@ -132,6 +132,7 @@ def columns_dataset(self):
columns = sorted(words_total.keys(),
key=lambda w: words_total[w],
reverse=True)[:250]
columns = sorted(columns)
dataset = {}
for instance in data.keys():
dataset[instance] = [data[instance].get(word, 0)
@@ -51,9 +51,9 @@ def test_column_dataset(self):
e2 = Entry.objects.create(**params)
vectors = ModelVectorBuilder(queryset=Entry.objects.all(),
fields=['title', 'excerpt', 'content'])
self.assertEqual(vectors.columns, ['entry', 'content', '01', '02'])
self.assertEqual(vectors.dataset[e1.pk], [1, 1, 2, 0])
self.assertEqual(vectors.dataset[e2.pk], [2, 1, 0, 2])
self.assertEqual(vectors.columns, ['01', '02', 'content', 'entry'])
self.assertEqual(vectors.dataset[e1.pk], [2, 0, 1, 1])
self.assertEqual(vectors.dataset[e2.pk], [0, 2, 1, 2])

def test_pearson_score(self):
self.assertRaises(ZeroDivisionError, pearson_score,

0 comments on commit c87e0a2

Please sign in to comment.
You can’t perform that action at this time.