Difference between revisions of "Orange: Bag of Words"

From OnnoWiki
Jump to navigation Jump to search
 
(6 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
  
Generates a bag of words from the input corpus.
+
Widget Bag of Words membuat sebuah bag of words dari input corpus.
  
Inputs
+
==Input==
  
    Corpus: A collection of documents.
+
Corpus: A collection of documents.
  
Outputs
+
==Output==
  
    Corpus: Corpus with bag of words features appended.
+
Corpus: Corpus with bag of words features appended.
  
Bag of Words model creates a corpus with word counts for each data instance (document). The count can be either absolute, binary (contains or does not contain) or sublinear (logarithm of the term frequency). Bag of words model is required in combination with Word Enrichment and could be used for predictive modelling.
+
Bag of Words model membuat sebuah corpus dengan word counts untuk setiap data instance (document). Count dapat absolute, binary (ada atau tidak ada) atau sublinear (logaritmik dari frekuensi istilah). Bag of words model dibutuhkan dalam kombinasi dengan widget Word Enrichment dan dapat digunakan untuk predictive modelling.
  
 
[[File:Bag-of-Words-stamped.png|center|200px|thumb]]
 
[[File:Bag-of-Words-stamped.png|center|200px|thumb]]
  
    Parameters for bag of words model:
+
* Parameters for bag of words model:
        Term Frequency:
+
** Term Frequency:
            Count: number of occurrences of a word in a document
+
*** Count: number of occurrences of a word in a document
            Binary: word appears or does not appear in the document
+
*** Binary: word appears or does not appear in the document
            Sublinear: logarithm of term frequency (count)
+
*** Sublinear: logarithm of term frequency (count)
        Document Frequency:
+
** Document Frequency:
            (None)
+
*** (None)
            IDF: inverse document frequency
+
*** IDF: inverse document frequency
            Smooth IDF: adds one to document frequencies to prevent zero division.
+
*** Smooth IDF: adds one to document frequencies to prevent zero division.
        Regulariation:
+
** Regulariation:
            (None)
+
*** (None)
            L1 (Sum of elements): normalizes vector length to sum of elements
+
*** L1 (Sum of elements): normalizes vector length to sum of elements
            L2 (Euclidean): normalizes vector length to sum of squares
+
*** L2 (Euclidean): normalizes vector length to sum of squares
    Produce a report.
+
* Produce a report.
    If Commit Automatically is on, changes are communicated automatically. Alternatively press Commit.
+
* If Commit Automatically is on, changes are communicated automatically. Alternatively press Commit.
  
 
==Contoh==
 
==Contoh==
  
In the first example we will simply check how the bag of words model looks like. Load book-excerpts.tab with Corpus widget and connect it to Bag of Words. Here we kept the defaults - a simple count of term frequencies. Check what the Bag of Words outputs with Data Table. The final column in white represents term frequencies for each document.
+
Dalam contoh ini kita hanya akan men-cek seperti apa sebuah bag of words model. Load book-excerpts.tab menggunakan widget Corpus dan sambungkan ke widget Bag of Words. Disini kita sengaja menggunakan parameter defaults - count paling sederhana adalah menghitung frekuensi istilah (term frequency). Cek apa yang di keluarkan oleh widget Bag of Words menggunakan widget Data Table. Kolom terakhir merepresentasikan frekuensi istilah (term frequency) dari setiap dokumen.
  
[[File:Bag-of-Words-Example1.png|center|200px|thumb]]
+
[[File:Bag-of-Words-Example1.png|center|600px|thumb]]
  
In the second example we will try to predict document category. We are still using the book-excerpts.tab data set, which we sent through Preprocess Text with default parameters. Then we connected Preprocess Text to Bag of Words to obtain term frequencies by which we will compute the model.
+
Dalam contoh ini, kita akan mencoba mem-prediksi kategori dokumen. Kita menggunakan dataset book-excerpts.tab, yang kita kirim melalui widget Preprocess Text dengan default parameter. Kemudian kita sambungkan widget Preprocess Text ke widget Bag of Words untuk memperoleh frekuensi istilah (term frequency). Dengan berbekal informasi frekuensi istilah (term frequency) kita akan  menghitung model.
  
[[File:Bag-of-Words-Example2.png|center|200px|thumb]]
+
Sambungkan widget Bag of Words ke widget Test & Score untuk melakukan predictive modelling. Sambungkan widget SVM atau widget classifier lainnya ke widget Test & Score (semua disisi kiri). Widget Test & Score akan menghitung score performance untuk setiap learner yang ada di input. Disini kita memperoleh hasil yang baik sekali untuk widget SVM.
  
Connect Bag of Words to Test & Score for predictive modelling. Connect SVM or any other classifier to Test & Score as well (both on the left side). Test & Score will now compute performance scores for each learner on the input. Here we got quite impressive results with SVM. Now we can check, where the model made a mistake.
+
Selanjutnya, kita perlu mencek dimana model melakukan kesalahan. Tambahkan, widget Confusion Matrix ke widget Test & Score. Widget Confusion matrix akan menayangkan dokumen yang berhasil di klasifikasi dengan benar dan salah klasifikasi. Pilih / select misclassified akan mengeluarkan dokumen yang misclassified, yang akan kita telaah lebih lanjut menggunakan widget Corpus Viewer.
 
 
Add Confusion Matrix to Test & Score. Confusion matrix displays correctly and incorrectly classified documents. Select Misclassified will output misclassified documents, which we can further inspect with Corpus Viewer.
 
  
 +
[[File:Bag-of-Words-Example2.png|center|600px|thumb]]
  
 
==Contoh Lain==
 
==Contoh Lain==
Line 56: Line 55:
 
[[File:Orange-bagofwords3.png|center|400px|thumb]]
 
[[File:Orange-bagofwords3.png|center|400px|thumb]]
  
 +
 +
==Youtube==
 +
 +
* [https://www.youtube.com/watch?v=plwumuSzwvs YOUTUBE: ORANGE klasifikasi text dokumen]
  
 
==Referensi==
 
==Referensi==

Latest revision as of 09:25, 12 April 2020

Sumber: https://orange3-text.readthedocs.io/en/latest/widgets/bagofwords-widget.html


Widget Bag of Words membuat sebuah bag of words dari input corpus.

Input

Corpus: A collection of documents.

Output

Corpus: Corpus with bag of words features appended.

Bag of Words model membuat sebuah corpus dengan word counts untuk setiap data instance (document). Count dapat absolute, binary (ada atau tidak ada) atau sublinear (logaritmik dari frekuensi istilah). Bag of words model dibutuhkan dalam kombinasi dengan widget Word Enrichment dan dapat digunakan untuk predictive modelling.

Bag-of-Words-stamped.png
  • Parameters for bag of words model:
    • Term Frequency:
      • Count: number of occurrences of a word in a document
      • Binary: word appears or does not appear in the document
      • Sublinear: logarithm of term frequency (count)
    • Document Frequency:
      • (None)
      • IDF: inverse document frequency
      • Smooth IDF: adds one to document frequencies to prevent zero division.
    • Regulariation:
      • (None)
      • L1 (Sum of elements): normalizes vector length to sum of elements
      • L2 (Euclidean): normalizes vector length to sum of squares
  • Produce a report.
  • If Commit Automatically is on, changes are communicated automatically. Alternatively press Commit.

Contoh

Dalam contoh ini kita hanya akan men-cek seperti apa sebuah bag of words model. Load book-excerpts.tab menggunakan widget Corpus dan sambungkan ke widget Bag of Words. Disini kita sengaja menggunakan parameter defaults - count paling sederhana adalah menghitung frekuensi istilah (term frequency). Cek apa yang di keluarkan oleh widget Bag of Words menggunakan widget Data Table. Kolom terakhir merepresentasikan frekuensi istilah (term frequency) dari setiap dokumen.

Bag-of-Words-Example1.png

Dalam contoh ini, kita akan mencoba mem-prediksi kategori dokumen. Kita menggunakan dataset book-excerpts.tab, yang kita kirim melalui widget Preprocess Text dengan default parameter. Kemudian kita sambungkan widget Preprocess Text ke widget Bag of Words untuk memperoleh frekuensi istilah (term frequency). Dengan berbekal informasi frekuensi istilah (term frequency) kita akan menghitung model.

Sambungkan widget Bag of Words ke widget Test & Score untuk melakukan predictive modelling. Sambungkan widget SVM atau widget classifier lainnya ke widget Test & Score (semua disisi kiri). Widget Test & Score akan menghitung score performance untuk setiap learner yang ada di input. Disini kita memperoleh hasil yang baik sekali untuk widget SVM.

Selanjutnya, kita perlu mencek dimana model melakukan kesalahan. Tambahkan, widget Confusion Matrix ke widget Test & Score. Widget Confusion matrix akan menayangkan dokumen yang berhasil di klasifikasi dengan benar dan salah klasifikasi. Pilih / select misclassified akan mengeluarkan dokumen yang misclassified, yang akan kita telaah lebih lanjut menggunakan widget Corpus Viewer.

Bag-of-Words-Example2.png

Contoh Lain

Orange-bagofwords1.png
Orange-bagofwords2.png
Orange-bagofwords3.png


Youtube

Referensi

Pranala Menarik