Here are two very short texts to compare:
Text 1: Julie loves me more than Linda loves me
Text 2: Jane likes me more than Julie loves me
We want to know how similar these texts are, purely in terms of word counts (and ignoring word order). We begin by making a list of the words from both texts:
me Julie loves Linda than more likes Jane
Now we count the number of times each of these words appears in each text:
me 2 2
Julie 1 1
likes 0 1
loves 2 1
Jane 0 1
Linda 1 0
than 1 1
more 1 1
We are not interested in the words themselves though. We are interested only in those two vertical vectors of counts. For instance, there are two instances of 'me' in each text. We are going to decide how close these two texts are to each other by calculating one function of those two vectors, namely the cosine of the angle between them.
The two vectors are, again:
a: [2, 1, 0, 2, 0, 1, 1, 1]
b: [2, 1, 1, 1, 1, 0, 1, 1]
The cosine of the angle between them is about 0.822.
These vectors are 8-dimensional. A virtue of using cosine similarity is clearly that it converts a question that is beyond human ability to visualise to one that can be. In this case you can think of this as the angle of about 35 degrees which is some 'distance' from zero or perfect agreement.
นี่เป็นข้อความสั้น ๆ สองเพื่อเปรียบเทียบ:
ข้อความ 1: จูลี่ที่รักฉัน มากกว่าเธอรักฉัน
2 ข้อความ: เจนชอบฉัน มากกว่าจูลี่ที่รักฉัน
เราต้องรู้วิธีเหมือนข้อความเหล่านี้ หมดจดในรูปแบบของคำนับ (ละเว้นคำสั่ง) เราเริ่มต้น โดยทำรายการคำจากทั้งสองข้อความ:
จูลี่ฉันรักเธอกว่ามากชอบเจน
ตอนนี้เรานับจำนวนครั้งที่แต่ละคำเหล่านี้ปรากฏในแต่ละข้อความ:
ฉัน 2 2
จูลี่ 1 1
ชอบ 0 1
รัก 2 1
เจน 0 1
ลินดา 1 0
กว่า 1 1
เพิ่มเติม 1 1
เราไม่สนใจคำพูดตัวเองว่า เรามีความสนใจในเวกเตอร์แนวตั้งที่สองของจำนวนเฉพาะ ตัวอย่าง มีอินสแตนซ์ที่สองของ 'ฉัน' ในแต่ละข้อความ เรากำลังจะตัดสินใจว่า ปิดสองข้อความเหล่านี้จะกัน โดยคำนวณฟังก์ชันหนึ่งของเหล่าสองเวกเตอร์ คือโคไซน์ของมุมระหว่าง
สองเวกเตอร์มี อีก:
: [2, 1, 0, 2, 0, 1, 1, 1]
b: [2, 1, 1, 1, 1, 0, 1, 1]
โคไซน์ของมุมระหว่างกำลัง 0.822
เวกเตอร์เหล่านี้มี 8 มิติ คุณธรรมการใช้คล้ายโคไซน์อย่างชัดเจนว่า มันแปลงเป็นคำถามที่นอกเหนือจากมนุษย์ความสามารถในการ visualise ที่สามารถ ในกรณีนี้ คุณสามารถคิดนี้เป็นมุมประมาณ 35 องศาซึ่งบาง 'ระยะทาง' จากศูนย์ หรือข้อตกลงที่สมบูรณ์แบบได้
การแปล กรุณารอสักครู่..
Here are two very short texts to compare:
Text 1: Julie loves me more than Linda loves me
Text 2: Jane likes me more than Julie loves me
We want to know how similar these texts are, purely in terms of word counts (and ignoring word order). We begin by making a list of the words from both texts:
me Julie loves Linda than more likes Jane
Now we count the number of times each of these words appears in each text:
me 2 2
Julie 1 1
likes 0 1
loves 2 1
Jane 0 1
Linda 1 0
than 1 1
more 1 1
We are not interested in the words themselves though. We are interested only in those two vertical vectors of counts. For instance, there are two instances of 'me' in each text. We are going to decide how close these two texts are to each other by calculating one function of those two vectors, namely the cosine of the angle between them.
The two vectors are, again:
a: [2, 1, 0, 2, 0, 1, 1, 1]
b: [2, 1, 1, 1, 1, 0, 1, 1]
The cosine of the angle between them is about 0.822.
These vectors are 8-dimensional. A virtue of using cosine similarity is clearly that it converts a question that is beyond human ability to visualise to one that can be. In this case you can think of this as the angle of about 35 degrees which is some 'distance' from zero or perfect agreement.
การแปล กรุณารอสักครู่..
ที่นี่สองข้อความสั้นมากเพื่อเปรียบเทียบ :
ข้อความที่ 1 : จูลี่ รักฉันมากกว่า ลินดา รักฉัน
ข้อความ 2 : เจนชอบฉันมากกว่าจูลี่รักฉัน
เราอยากทราบว่าข้อความเหล่านี้เป็นวิธีที่คล้ายกัน แต่ในแง่ของการนับคำ ( และไม่สนใจคำสั่ง ) เราเริ่มต้นด้วยการสร้างรายการของคำทั้งสองข้อความ :
ฉันจูลี่รักลินดามากกว่า
ชอบ เจนตอนนี้เรานับจำนวนครั้งของคำเหล่านี้จะปรากฏในแต่ละข้อความ :
ฉัน 2 2
ชอบจูลี่ 1 1 0 1 2 1
รักเจน 0 0
0
กว่าลินดา 1 1 1
อีก 1
เราไม่ได้สนใจ คำพูดตัวเองเลย เราสนใจแค่สองแนวตั้งเวกเตอร์ของนับ ตัวอย่างเช่น มีอยู่สองกรณีของ ' ฉัน ' ในแต่ละข้อความเรากำลังตัดสินใจสองข้อความว่าใกล้ชิดกับแต่ละอื่น ๆโดยการคำนวณฟังก์ชันหนึ่งของเวกเตอร์ทั้งสองคือโคไซน์ของมุมระหว่างพวกเขา .
สองจำแนกประเภทอีกครั้ง :
: [ 2 , 1 , 0 , 2 , 0 , 1 , 1 , 1 ]
B : [ 2 , 1 , 1 , 1 , 1 , 0 , 1 , 1 ]
โคไซน์ของมุมระหว่างพวกเขาเกี่ยวกับ 0.822
พาหะเหล่านี้จะ 8-dimensional .คุณธรรมของการใช้ความเหมือนโคไซน์เป็นอย่างชัดเจนว่ามันเป็นคำถามที่เกินความสามารถของมนุษย์ที่จะเห็นภาพหนึ่งที่สามารถ ในกรณีนี้คุณสามารถคิดว่านี้เป็นมุมประมาณ 35 องศา ซึ่งบาง ' ไกล ' จากศูนย์ หรือสมบูรณ์ ข้อตกลง
การแปล กรุณารอสักครู่..