Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Mallet Demo
Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
“ A J A V A - B A S E D P A C K A G E F O R S T A T I S T I C A L
N A T U R A L L A N G U A G E P R O C E S S I N G ,
D O ...
W R I T T E N B Y A N D R E W M C C A L L U M E T A L . A T
U M A S S A M H E R S T
What is Mallet?
Hannah Alpert -Abrams,...
1 . D O W N L O A D M A L L E T
2 . P R E P A R E T E X T F O R I N P U T
3 . R U N M A L L E T
4 . M O D I F Y H Y P E R ...
What is The Command Line?
Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
1) Download Mallet
Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
2) Import Directory into Mallet
Mallet says: “Now run this command:
bin/mallet import-dir --input sample-data/web/* --
out...
2) Import Directory into Mallet
Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
2) Import Directory into Mallet
Modifying the command:
bin/mallet import-dir --input sample-data/web/* --
output web.malle...
2) Import Directory into Mallet
Modifying the command:
~/downloads/mallet-2.0.7/bin/mallet import-dir --
input sample-data...
2) Import Directory into Mallet
Modifying the command:
~/downloads/mallet-2.0.7/bin/mallet import-dir --
input sample-data...
2) Import Directory into Mallet
Modifying the command:
~/downloads/mallet-2.0.7/bin/mallet import-dir --
input ~/Desktop/M...
2) Import Directory into Mallet
Modifying the command:
~/downloads/mallet-2.0.7/bin/mallet import-dir --
input ~/Desktop/M...
2) Import Directory into Mallet
Modifying the command:
~/downloads/mallet-2.0.7/bin/mallet import-dir --
input ~/Desktop/M...
2) Import Directory into Mallet
Modifying the command:
~/downloads/mallet-2.0.7/bin/mallet import-dir --
input ~/Desktop/M...
2) Import Directory into Mallet
Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
3) Run Mallet
Mallet says, run the command:
bin/mallet train-topics --input topic-input.mallet
--num-topics 100 --output-s...
3) Run Mallet
Mallet says, run the command:
~/downloads/mallet-2.0.7/bin/mallet train-topics
--input topic-input_bulstrode...
3) Run Mallet
Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
4) Modify Model
 --optimize-interval #: hyperparameter optimization
 --optimize-burn-in #: iterations before above
 --o...
5) Interpret a topic model
Background: Bulstrode Papers
 Sir Richard Bulstrode (1610-1711), English author, diplomat, sol...
5) Interpret a topic model
0 10 house day bill ordered made sr lords mr till morning read resolved committee
debate brough...
5) Interpret a topic model
0 10 house day bill ordered made sr lords mr till morning read resolved committee
debate brough...
5) Interpret a topic model
0 10 house day bill ordered made sr lords mr till morning read resolved committee
debate brough...
5) Interpret a topic model
010 house day bill ordered made sr lords mr till
morning read resolved committee debate brought...
5) Interpret a topic model
0 10 house day bill ordered made sr lords mr till morning read resolved committee
debate brough...
Topic Three: War at Sea?
maty dutch holland
matie men pleased
great haveing
persons fleet mr warr
severall wee sr hear
sta...
Topic Three: War at Sea?
maty dutch holland
matie men pleased
great haveing
persons fleet mr warr
severall wee sr hear
sta...
Topic Three: Third Anglo-Dutch War
maty dutch holland
matie men pleased
great haveing
persons fleet mr warr
severall wee s...
Topic Three: Third Anglo-Dutch War
maty dutch holland
matie men pleased
great haveing
persons fleet mr warr
severall wee s...
Take-Aways
 The difficulties and rewards of working on the
command line.
 How to take a collection of topics and conduct...
Upcoming SlideShare
Loading in …5
×

Mallet presentation

296 views

Published on

Introduction to Topic Modeling using Mallet. From modifying options in the command line to checking the numbers and analyzing the results.

Published in: Education
  • Be the first to comment

Mallet presentation

  1. 1. Mallet Demo Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  2. 2. “ A J A V A - B A S E D P A C K A G E F O R S T A T I S T I C A L N A T U R A L L A N G U A G E P R O C E S S I N G , D O C U M E N T C L A S S I F I C A T I O N , C L U S T E R I N G , T O P I C M O D E L I N G , I N F O R M A T I O N E X T R A C T I O N , A N D O T H E R M A C H I N E L E A R N I N G A P P L I C A T I O N S T O T E X T . ” What is Mallet? Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  3. 3. W R I T T E N B Y A N D R E W M C C A L L U M E T A L . A T U M A S S A M H E R S T What is Mallet? Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  4. 4. 1 . D O W N L O A D M A L L E T 2 . P R E P A R E T E X T F O R I N P U T 3 . R U N M A L L E T 4 . M O D I F Y H Y P E R - P A R A M E T E R S 5 . A N A L Y Z E T O P I C S How do you use mallet? Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  5. 5. What is The Command Line? Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  6. 6. 1) Download Mallet Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  7. 7. 2) Import Directory into Mallet Mallet says: “Now run this command: bin/mallet import-dir --input sample-data/web/* -- output web.mallet Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  8. 8. 2) Import Directory into Mallet Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  9. 9. 2) Import Directory into Mallet Modifying the command: bin/mallet import-dir --input sample-data/web/* -- output web.mallet Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  10. 10. 2) Import Directory into Mallet Modifying the command: ~/downloads/mallet-2.0.7/bin/mallet import-dir -- input sample-data/web/* --output web.mallet Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  11. 11. 2) Import Directory into Mallet Modifying the command: ~/downloads/mallet-2.0.7/bin/mallet import-dir -- input sample-data/web/* --output web.mallet Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  12. 12. 2) Import Directory into Mallet Modifying the command: ~/downloads/mallet-2.0.7/bin/mallet import-dir -- input ~/Desktop/Mallet-demo/Transcripts- bulstrode --output web.mallet Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  13. 13. 2) Import Directory into Mallet Modifying the command: ~/downloads/mallet-2.0.7/bin/mallet import-dir -- input ~/Desktop/Mallet-demo/Transcripts- bulstrode --output web.mallet Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  14. 14. 2) Import Directory into Mallet Modifying the command: ~/downloads/mallet-2.0.7/bin/mallet import-dir -- input ~/Desktop/Mallet-demo/Transcripts- bulstrode --output topic-input_bulstrode.mallet Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  15. 15. 2) Import Directory into Mallet Modifying the command: ~/downloads/mallet-2.0.7/bin/mallet import-dir -- input ~/Desktop/Mallet-demo/Transcripts- bulstrode --output topic-input_bulstrode.mallet -- keep-sequence --remove-stopwords Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  16. 16. 2) Import Directory into Mallet Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  17. 17. 3) Run Mallet Mallet says, run the command: bin/mallet train-topics --input topic-input.mallet --num-topics 100 --output-state topic-state.gz Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  18. 18. 3) Run Mallet Mallet says, run the command: ~/downloads/mallet-2.0.7/bin/mallet train-topics --input topic-input_bulstrode.mallet --num-topics 100 --output-state topic-state.gz 2> ~/Desktop/Mallet-demo/bulstrode-100t.txt Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  19. 19. 3) Run Mallet Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  20. 20. 4) Modify Model  --optimize-interval #: hyperparameter optimization  --optimize-burn-in #: iterations before above  --output-doc-topics doc.txt: outputs topic composition of documents  --output-topic-keys doc.txt: more complete data  --inferencer-filename doc.txt: inferencer tool (?)  --evaluator-filename doc.txt: how to get topic proportions for new documents Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  21. 21. 5) Interpret a topic model Background: Bulstrode Papers  Sir Richard Bulstrode (1610-1711), English author, diplomat, soldier  Papers were “communications made to him from this country [England?] in the form of news-letters giving, almost daily, the most minute details of everything going on at court and in the country.” Research Questions, Bulstrode Papers:  What important topics were discussed during Bulstrode’s life?  What attitude was taken towards those topics?  Can we identify patterns in topics or attitudes over time? Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  22. 22. 5) Interpret a topic model 0 10 house day bill ordered made sr lords mr till morning read resolved committee debate brought comittee bee john morrow 1 10 duke lord earle french court king de yesterday morning towne france night monday arrived tuesday present good returne dated 2 10 ye yt wch king ld lds day order commons ym great agst st againe doe ma goe night wth 3 10 maty dutch holland matie men pleased great haveing persons fleet mr warr severall wee sr hear states highness sea 4 10 majestye hath sr councell soe late ambassador hee letters king majesty bee lord great made french mr prince himselfe Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  23. 23. 5) Interpret a topic model 0 10 house day bill ordered made sr lords mr till morning read resolved committee debate brought comittee bee john morrow 1 10 duke lord earle french court king de yesterday morning towne france night monday arrived tuesday present good returne dated 2 10 ye yt wch king ld lds day order commons ym great agst st againe doe ma goe night wth 3 10 maty dutch holland matie men pleased great haveing persons fleet mr warr severall wee sr hear states highness sea 4 10 majestye hath sr councell soe late ambassador hee letters king majesty bee lord great made french mr prince himselfe Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  24. 24. 5) Interpret a topic model 0 10 house day bill ordered made sr lords mr till morning read resolved committee debate brought comittee bee john morrow 1 10 duke lord earle french court king de yesterday morning towne france night monday arrived tuesday present good returne dated 2 10 ye yt wch king ld lds day order commons ym great agst st againe doe ma goe night wth 3 10 maty dutch holland matie men pleased great haveing persons fleet mr warr severall wee sr hear states highness sea 4 10 majestye hath sr councell soe late ambassador hee letters king majesty bee lord great made french mr prince himselfe Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  25. 25. 5) Interpret a topic model 010 house day bill ordered made sr lords mr till morning read resolved committee debate brought comittee bee john morrow 1 10 duke lord earle french court king de yesterday morning towne france night monday arrived tuesday present good returne dated 2 10 ye yt wch king ld lds day order commons ym great agst st againe doe ma goe night wth 3 10 maty dutch holland matie men pleased great haveing persons fleet mr warr severall wee sr hear states highness sea 4 10 majestye hath sr councell soe late ambassador hee letters king majesty bee lord great made french mr prince himselfe Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  26. 26. 5) Interpret a topic model 0 10 house day bill ordered made sr lords mr till morning read resolved committee debate brought comittee bee john morrow 1 10 duke lord earle french court king de yesterday morning towne france night monday arrived tuesday present good returne dated 2 10 ye yt wch king ld lds day order commons ym great agst st againe doe ma goe night wth 310 maty dutch holland matie men pleased great haveing persons fleet mr warr severall wee sr hear states highness sea 4 10 majestye hath sr councell soe late ambassador hee letters king majesty bee lord great made french mr prince himselfe Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  27. 27. Topic Three: War at Sea? maty dutch holland matie men pleased great haveing persons fleet mr warr severall wee sr hear states highness sea --output-doc-topicsHannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  28. 28. Topic Three: War at Sea? maty dutch holland matie men pleased great haveing persons fleet mr warr severall wee sr hear states highness sea File 1672-04-12 ' Thursday, 4th.--His Maty has given orders that letters be imediately sent to all the Collonyes and Plantacons abroad to give them notice of his warr with Holland, and therefore to comand them to seize and secure all the effects of the people in those places, and to be carefull in securing the countryes. His Maty has given orders for the makeing commissions for another regiment to be raysed, under the command of my Ld Power as Collonell. Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  29. 29. Topic Three: Third Anglo-Dutch War maty dutch holland matie men pleased great haveing persons fleet mr warr severall wee sr hear states highness sea Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  30. 30. Topic Three: Third Anglo-Dutch War maty dutch holland matie men pleased great haveing persons fleet mr warr severall wee sr hear states highness sea File 1672-04-12 ' On Satturday last the commissions for Prince Rupert's regiment were signed by his Majesty, being in all 12 troops of Dragoons; his Maty was also pleased to signe commissions for another regiment of Foot to be now raysed, under the comand of Coll. Fitzgerald as Collonell, Mr Henry Butler, Lt Colonell and Sr Edward Carleton, Major. ' Monday, 1st.--Sr John Talbot's company in his Matie's Guards is given to Captaine Guilliames, and Captaine Downing's company to Captaine Henry Williams; and Capt Downing has Sr Charles Wheler's company, also in the Guards. ' His Maty has been pleased to give two comissions to the Duke of Yorke, one for impowering him to issue out his warrants to the Court of Admiralty to give sentence against what prizes shall be taken, and the other for impowering him to issue his comissions to privateers to take and destroy the King's enemyes. Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014
  31. 31. Take-Aways  The difficulties and rewards of working on the command line.  How to take a collection of topics and conduct an analysis of those topics.  How much human intervention is necessary to “process” the text prior to modeling. Hannah Alpert -Abrams, University of Texas at Austin, Fall 2014

×