Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JasonKessler/2668597f78f35093dcf0d9221bd66223 to your computer and use it in GitHub Desktop.
Save JasonKessler/2668597f78f35093dcf0d9221bd66223 to your computer and use it in GitHub Desktop.
four_square_corpus = (st.CorpusFromParsedDocuments(reviews_df, category_col = 'category', parsed_col = 'parse')
.build()
.get_unigram_corpus()
.compact(st.ClassPercentageCompactor(term_count=1)))
four_square_axes = st.FourSquareAxes(four_square_corpus,
left_categories=['Accept, Positive'],
right_categories=['Accept, Negative'],
top_categories=['Reject, Positive'],
bottom_categories=['Reject, Negative'],
labels = {'a': 'Positive',
'b': 'Review that was Contrary to Accpetance Decision',
'not_a': 'Negative',
'not_b': 'Review that in Line With Acceptance Decision'},
term_ranker=st.OncePerDocFrequencyRanker)
html = st.produce_four_square_axes_explorer(
four_square_axes=four_square_axes,
x_label="Accepts: Pos-Neg",
y_label='Rejects: Neg-Pos',
use_full_doc=True,
metadata=four_square_corpus.get_df()['metadata'],
color_func='(function(d) {return d3.rgb(230, 220, 230)})',
censor_points=True,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment