Teadmiste formaliseerimine: erinevus redaktsioonide vahel

Allikas: Lambda
Mine navigeerimisribale Mine otsikasti
Resümee puudub
Resümee puudub
14. rida: 14. rida:
</tr>
</tr>
</table>
</table>
= Eksam =
Eksamiajad:
* 17 mai kell 10 ruumis U06A-201 (kursuse loenguruum VI korpuses)
* 24 mai kell 10 ruumis U06A-201 (kursuse loenguruum VI korpuses)
* 31 mai kell 12 IT majas ruumis ICT-A1
[[Teadmiste kursus 2022 tulemused kõigi eksamite järel]]
<!--
Praktikumipunktide hetkeseisu kontrollimiseks vaata palun [[tedmiste kursus 2022 praksitulemused]] ja kui midagi puudu, anna palun teada!
<font color="red">NB!</font> Samasse tabelisse on nüüd lisatud esimese eksami (17 mai) järgsed tulemused.
<font color="red">NB!</font> 18 mail (kolmap) kell 15:00 ruumis ICT-401 ja teamsis täiendav võimalus praktikume esitada. [https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1652873576051?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d Teamsi link siin].
24 kell 16 veel täiendav võimalus.
-->
<!--
Kui kellelgi on mõni praktikum veel esitamata, võtke palun õppejõuga ühendust sobiva aja kokkuleppimiseks.
-->
<!--
<font color="red">NB!</font> 27 mai kell 11 ja kell 12 lisakaitsmised [https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1653636589240?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d teamsis]
-->
<!--
= Praks 11 mai teamsis =
[https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1652266262034?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d  Teamsi link]
-->
= Konsultatsioon 10. mai loenguruumis & teamsis =
Konsultatsiooni [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loeng%20-%20konsultatsioon%20-%2010%20mai-20220510_100412-Meeting%20Recording.mp4?csf=1&web=1&e=WObGkM salvestus]
Mh tegime väikese demo nlpsolveri [http://dijkstra.cs.ttu.ee/~tammet/solver10may.tar.gz 10 mai versiooniga]
<!--
4. mai praktikum on [https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1651661739684?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d teamsis]. Mh vaatame: the early experimental [http://dijkstra.cs.ttu.ee/~tammet/README.txt NLP solver] (alternatively [[Nlpsolver README]] (Linux only) you may want to try out and perhaps build upon is [http://dijkstra.cs.ttu.ee/~tammet/nlpsolver.tar.gz here] (alternatively [[Media:Nlpsolver.tar.gz]])
-->
<!--
= Praks 20 aprill teamsis =
[https://teams.microsoft.com/l/meetup-join/19%3ar_PBOvBcdzek7w8YGQ-XvROAcmkf2ihNT4nrRfzASGQ1%40thread.tacv2/1650452401849?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d Teamsi link]
After a lot of experiments we worked out a small initial example with wars, cities and castles: the example is on the third prax first option description page.
-->
<!--
= Praks 13 arill praktikumiruumis =
Samas [https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1649847515352?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d  teamsi link]
-->
<!--
[https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1645618130175?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d teamsi link] : võrgühenduse probleemi tõttu veidi hilinesime
-->
<!--
= Loeng 19 aprill teamsis =
19 aprilli loeng toimub ainult teamsis, [https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1650343312547?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d link siin]
Martin ja Tanel räägivad loomuliku keele [https://en.wikipedia.org/wiki/Semantic_parsing semantilisest parsimisest], koos oma arenduses eksperimentaalsüsteemide seletustega.
-->
<!--
[https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1645012689039?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d teamsi link praktikumile]
-->
<!--
= <font color="red">23 märtsi prax teamsis</font> =
22 märtsi prax toimub ainult teamsis, [https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1648034904872?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d meetingu link]
-->
<!--
= <font color="red">Uus nädala-ülesanne ja 16 märts prax</font> =
16 märtsil antud uus ülesanne on eksperimenteerida Allen AI [https://proofwriter.apps.allenai.org/ ProofWriter] süsteemiga: vaata palun allpool "Weekly tasks" blokis.
Praktikum toimub 16. märtsil teamsis [https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1647419386714?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d sellel lingil].
-->
<!--
15. märtsi loeng on 14. märtsil <b>eelsalvestatud</b>: [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20loengu%20eelsalvestus%2015%20jaanuariks-20220314_154224-Meeting%20Recording.mp4?csf=1&web=1&e=3grCku link salvestusele]. (pealkirjas ... 15. jaanuariks on vale, peaks muidugi olema 15. märtsiks).
15. märts kell 11:15 teeme teamsis väikese küsimuste/kommentaaride live sessiooni sellesama loengu kohta: [https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1647270559837?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d teamsi link].
-->
<!--
= <font color="red">NB!</font> 9. veebruari praks toimub teamsis =
Kell 14 [https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1644406360666?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d meetingu link]
Korraga audikas ja
[https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1646726144848?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d teamsis].
Ehk, õppejõud füüsiliselt 9. veebruaril ICT-401 ruumi ei tule.
-->


= Time, place, result =
= Time, place, result =


Lectures: Tuesday 10:00-11:30 room U06A-201 <br>  
Lectures: Tuesday 13:45-15:15 room U05-103 <br>  
Practical work: Wednesday 14:00-15:30 room ICT-401
Practical work: Tuesday 15:30-17:00 room U05-103


Plaan on teha osa loengutest kohapeal (esialgu kindlasti kohapeal) ja osa distantsilt. Loenguid salvestame ja salvestuste lingid on allpool blokkide/loengute juures.
Plaan on teha osa loengutest kohapeal (esialgu kindlasti kohapeal) ja osa distantsilt. Loenguid salvestame ja salvestuste lingid on allpool blokkide/loengute juures.


Praksidega samamoodi: esimesed praksid teeme kohapeal, aga üritan ka salvestada / üle kanda, edaspidi tõenäoliselt tuleb rohkem prakse distantsilt (teamsis).
Praksidega samamoodi: algul kindlasti kohapeal, samas üritame salvestada / üle kanda, edaspidi tõenäoliselt osa prakse distantsilt (teamsis).


Salvestuste lingid leiad allpool kas vastava loengu või praksi peatüki all.
Salvestuste lingid leiad allpool kas vastava loengu või praksi peatüki all.
128. rida: 28. rida:
Moodles materjale ei ole: kogu info, materjalid ja ülesanded on lambda lehel.  
Moodles materjale ei ole: kogu info, materjalid ja ülesanded on lambda lehel.  


<!--
Please also join the [https://teams.microsoft.com/l/team/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/conversations?groupId=480b7938-a312-47e7-bad0-5ea1bb51f31e&tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57  teams site for the course]  
Please also join the [https://teams.microsoft.com/l/team/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/conversations?groupId=480b7938-a312-47e7-bad0-5ea1bb51f31e&tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57  teams site for the course]  
-->


Practical work will give 40%, weekly tasks 10% and exam 50% of points underlying the final grade.  
Practical work will give 40%, weekly tasks 10% and exam 50% of points underlying the final grade.  
140. rida: 42. rida:
= Contents overview: what the course is about =
= Contents overview: what the course is about =


The main focus of the course is on [https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning] (KR), a part of symbolic AI, on a spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge).  
 
The main focus of the course is on hybrid methods for
[https://en.wikipedia.org/wiki/Knowledge_representation knowledge representation and reasoning]: symbolic AI, machine learning / neural methods and their combinations.
We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.


The course contains the following blocks:
The course contains the following blocks:
147. rida: 52. rida:
* Representing and using simple facts and rules in symbolic AI and logic.
* Representing and using simple facts and rules in symbolic AI and logic.
* General-knowledge databases: wikidata, wordnet, yago, conceptnet, nell, cyc.
* General-knowledge databases: wikidata, wordnet, yago, conceptnet, nell, cyc.
* Knowledge conveyed by natural sentences: both statistical methods like word2vec and logic-based methods.
* Knowledge conveyed by natural sentences: statistical and neural methods like word2vec, BERT, GPT families.
* Knowledge conveyed by natural sentences: logic-based and hybrid methods.
* More about reasoners and question answering systems.
* More about reasoners and question answering systems.
* Confidence and relevance.
* Confidence and relevance.
157. rida: 63. rida:


= Links to the teams group and lecture videos =
= Links to the teams group and lecture videos =
 
<!--
Please join the [https://teams.microsoft.com/l/team/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/conversations?groupId=480b7938-a312-47e7-bad0-5ea1bb51f31e&tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57  teams site for the course]  
Please join the [https://teams.microsoft.com/l/team/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/conversations?groupId=480b7938-a312-47e7-bad0-5ea1bb51f31e&tenantId=3efd4d88-9b88-4fc9-b6c0-c7ca50f1db57  teams site for the course]  
-->


The links to saved lecture videos are and will be  visible among the materials of corresponding lectures below.
The links to saved lecture videos are and will be  visible among the materials of corresponding lectures below.
175. rida: 82. rida:
= Weekly tasks =
= Weekly tasks =


These are small tasks you have to report weekly by email to tanel.tammet at taltech.ee
These are small tasks you have to report weekly by email to tanel.tammet at taltech.ee.
 
16 märtsi ülesanne on eksperimenteerida Allen AI [https://proofwriter.apps.allenai.org/ ProofWriter] süsteemiga. Eesmärk on otsida ja raporteerida erinevaid nö piir-kohti tausta-info lausetega, kus ProofWriter ülesandega hakkama ei saa või annab vale / kahtlase tulemuse.
Aega selleks on kaks nädalat.
 
Eelda, et ProofWriteril on endal vähe sisse-ehitatud "commonsense" teadmisi ja ta teab peamiselt seda, mis on talle "Facts and rules (you can provide your own):" kastis antud. Seega on mõtet teha ainult selliseid katseid, kus seal kastis peaks olema piisav otsene info väite õigsuse kontrollimiseks. Näiteks, kui annad eelduseks "Water is liquid." ja küsid "Stones are hard", siis sul ei ole lihtsalt antud piisavalt infot. Samas, näiteks taksonoomiat on ProofWriterile sisse ehitatud: kui ütled eelduseks "Vehicles move" ja küsid "Cars move", siis ProofWriter annab õige vastuse. Eeldusega "Birds move" ja küsimusega "Cars move" aga ütleb ta "Unknown".
 
Võta näiteks "Select an example:" kastist mõni näitekomplekt ja asu "Facts and rules .." kasti sisu muutma: tee lauseid veidi teistsuguseks, lisa / muuda infot jne ning vaata, kas saab mis muutuse peale vastusega hakkama. Ära raporteeri selliseid näiteid, kus sisuliselt sinu antud lausetest ei peakski ootuspärane vastus tulenema (a la sa ei anna lihtsalt piisavat infot). Hea oleks raportis tuua nii variant näitest, kus ProofWriter leiab õige vastuse, kui minimaalne muutus, mille peale ta ei anna.
 
Ei ole paha mõte tutvuda taustaks korra ka [https://arxiv.org/pdf/2012.13048.pdf ProofWriteri] artikliga ja selle poolt kasutatava [https://arxiv.org/pdf/2010.02830.pdf PRover] artikliga.
 
Palun kirjuta leitud huvitavad piir-kohad ja muud huvitavad süsteemi omadused, mis katsetades leidsid, koos terviknäidetega.
 
 
<!--
Neljanda nädala ülesanne (15. veebruari loengu järel) on katsetada lihtsa json-ld ja rdfs reeglite kasutamist päringu jaoks. Tähtaeg <font color="red">23</font>. veebruar.
 
Konkreetselt on sul antud kaks json-ld teksti
<pre>
{
  "@id":"https://et.wikipedia.org/wiki/Peipsi_j%C3%A4rv",
  "@type": "lake",
  "size": "large",
  "country": "Estonia"
}
{
  "@id":"https://en.wikipedia.org/wiki/Snelli_Pond",
  "@type": "pond",
  "country": "Estonia"
} 
</pre>
ja kolm rdf stiilis kolmikut
<pre>
<lake>, <rdfs:subclassOf>, <body_of_water>
<pond>, <rdfs:subclassOf>, <body_of_water>
<pond>, <size>, <small>
</pre>
ja loomulikus keeles reegel
<pre>
Water skiing is possible on large bodys of water.
</pre>
 
Sinu ülesanne on teisendada kõik need tavaloogikasse ja teha logictools.org abil kaks eksperimenti:
* Näita, et Peipsi järvel saab veesuusatada.
* Otsi $ans predikaadi abil kohad Eestis, kus saab veesuusatada (Peipsi peaks vastusesse tulema ja Snelli tiik mitte).
 
Seejuures pead mõtlema,
* kuidas kirjutada reegel rdf:type ja rdfs:subclassOf sisulise koos-kasutamise jaoks.
* kuidas oleks mõistlik esitada loogikas reegel "Water skiing is possible in large bodys of water": kuna seda otse rdfs vahenditega kirjutada ei saa, kirjuta ta lihtsalt tavaloogikas.
* optsionaalselt: kuidas teha reegel, et  pond, size, small oleks kasutatav. Otseselt seda ülesandes vaja ei lähe.
 
Soovitused:
* Väldi namespace-sid ja liigpikki identifikaatoreid, neid ei ole siin ülesandes tegelikult vaja.
* Käsitle "water skiing" kui ühte sõna, a la "water_skiing", samuti "is possible on" kui "is_possible_on".
 
Kui see kõik lihtsalt välja tuleb, võid vabatahtlikult katsetada täiendavat ülesannet: mida tuleks lisada, et õnnestuks näidata, et Snelli tiigil ei saa veesuusatada.
 
Emaili andmete esitus ja leitud tõestused aadressile tanel.tammet at taltech.ee, pannes emaili pealkirja sisse sõna "formaliseerimine".
-->
 
<!--
Teise nädala ülesanne (<font color="red">1. veebruari</font> loengu järel) on eksperimenteerida veidi [http://logictools.org logictools.org] saidiga ja teha ise läbi loengus toodud näited SQL data ja päringute esitamisest loogikas. Tähtaeg 9. veebruar.
 
Konkreetselt tee järgmist:
* Eksperimenteeri veidi [http://logictools.org logictools.org] "simple examples" valikuboksi näidetega basic ... equality, loe nende selgitusi ja püüa aru saada tõestustest.
* Loe seejuures predikaatloogika väikest seletust [http://logictools.org/about.html#basic_syntax about lehel] kuni lausearvutuseni (seda pole enam otse vaja lugeda).
* Kirjuta ise valmis näide vastavalt kursuse materjali [[Media:Kr_lect_1b_2022.ppt| Background: relations of sql and logic]] lk 19-21, kus on toodud ühe client tabeliga ja client ning cars tabelitega näide sql päringute teisendamisest loogikasse (üks lihtne select ja üks join). Tee need näited reaalselt valmis nii, et logictools.org sööb nad sisse ja annab ootuspärase vastuse. Seejuures on sul vaja kasutada $ans predikaati, nagu "answers" näites toodud. Kui tahad mitut vastust (ei ole kohustuslik), siis vaata ka "multiple answers" näidet.
* Saada näite-sisendid ja genereeritud tõestused õppejõule emailiga. Kui jääd nendega hätta, siis kirjuta, mida proovisid, too oma näitetekst ja selgita, mille juures hätta jäid (see on ka arvestatav tulemus). Kirjuta aadressile tanel.tammet at taltech.ee ja pane pealkirja sisse mh sõna "formaliseerimine", et kirja kergesti üles leiaks.
 
Soovitused:
* Negatiivset arvu sa logictoolsi vaikimisi süntaksiga otse sisestada ei saa: -200 interpreteeritakse kui loogilise eituse rakendamist 200-le. Kaks head võimalust negatiivse arvu sisestamiseks on kas kirjutada 0-200 või $difference(0,200).
* Aritmeetika jaoks vaata help teksti Arithmetic peatükki.
* Väiksem-tingimuse jaoks vaata complex examples valikuboksis "arithmetic" näidet.
-->


= Practical work =
= Practical work =


There are three labs. They are all steps in a single project: build a simple natural-language question-answering system a la [https://en.wikipedia.org/wiki/Watson_(computer) Watson]. There is also an alternative option to do one larger practical research project instead of these three labs: details of this project have to be discussed and agreed with Tanel.
There are three labs. They are all steps in a single project: build a simple natural-language question-answering system a la [https://en.wikipedia.org/wiki/Watson_(computer) classic Watson]. There is also an alternative option to do one larger practical research project instead of these three labs: details of this project have to be discussed and agreed with Tanel.


The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people.  
The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people.  
262. rida: 96. rida:
Each lab is evaluated independently and gives the same number of points.  
Each lab is evaluated independently and gives the same number of points.  
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.
NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.
<font color="red">NB!</font> Õige 2022 aasta info on hetkel esimese praksi kohta. Teine läheb veidi muutmisele ja kolmas oluliselt muutmisele.
[https://teams.microsoft.com/l/meetup-join/19%3aB8Z1aw0MCoJ2RiUXWWjUK0PAj77TuMKKdotlw5Vfnhw1%40thread.tacv2/1645012689039?context=%7b%22Tid%22%3a%223efd4d88-9b88-4fc9-b6c0-c7ca50f1db57%22%2c%22Oid%22%3a%22e3e55dca-e89b-46ae-b8ee-1d158e79281d%22%7d teamsi link 16 veebruari praktikumile]


== First lab ==
== First lab ==


Please read about [[KR 2021 homework part 1|the task for the first lab]].
Please read about [[KR 2021 homework part 1|the task for the first lab]].
Deadline: <font color="red">2.03.2022</font>.
Recordings:
* [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Esimene%20praktikum-20220126_140236-Meeting%20Recording.mp4?csf=1&web=1&e=pEo893 prax work intro 26 jan], start from minute 8.
<!-- * [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Meeting%20in%20_General_-20220202_140116-Meeting%20Recording.mp4?csf=1&web=1&e=f7LiS2 prax work 2 feb]. -->
* [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20praks%2016%20veebruar-20220216_140156-Meeting%20Recording.mp4?csf=1&web=1&e=RLutlU prax work 16 feb]
* [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20prax-20220223_141125-Meeting%20Recording.mp4?csf=1&web=1&e=R8S96v prax work 23 feb: mostly about the weekly task]


== Second lab ==
== Second lab ==


The task has been updated for 2022. The task in the second lab is mostly the same as in 2021:  
The task will be updated for 2023. The task from last year, 2022 was this:
* write a small set of additonal, nontrivial rules for geography not present in Yago or Wordnet,
* write a small set of additonal, nontrivial rules for geography not present in Yago or Wordnet,
* actually answering simple questions using logic and rules with the help of a reasoner.
* actually answering simple questions using logic and rules with the help of a reasoner.
290. rida: 110. rida:


See [[Details of the KR second lab in 2022]]
See [[Details of the KR second lab in 2022]]
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20praks%209%20veebruar-20220209_140850-Meeting%20Recording.mp4?csf=1&web=1&e=u9iRWC 9 märtsi praksi salvestus]
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Meeting%20in%20_General_-20220316_140056-Meeting%20Recording.mp4?csf=1&web=1&e=mVxstM 16 märtsi praksi salvestus] (vt ka [[Examples from the live prax 16 March]])
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20praktikum%2023%20m%C3%A4rts-20220323_140125-Meeting%20Recording.mp4?csf=1&web=1&e=zOiDfr 23 märtsi praksi salvestus]
[https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20praktikum%2021%20m%C3%A4rts-20220330_140333-Meeting%20Recording.mp4?csf=1&web=1&e=qhl5ER 30 märtsi praksi salvestus]


== Third lab: numeric confidences or questions in NLP ==
== Third lab: numeric confidences or questions in NLP ==


This task is now updated for 2022. You have two different choices for the third lab:
This task will be updated for 2023. In 2022 you had two different choices for the third lab:


* [[Add and use uncertainty in rules]] (suggested)
* [[Add and use uncertainty in rules]] (suggested)
308. rida: 120. rida:
Details under the separate pages linked to above. A brief intro will be given during the lectures.
Details under the separate pages linked to above. A brief intro will be given during the lectures.


* [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20praks%2013%20aprill-20220413_140346-Meeting%20Recording.mp4?csf=1&web=1&e=pvxdEC 13 aprilli praksi salvestus], kus me ühtegi näidet veel ehitada ei jõudnud, küll aga vaatasime veidi https://logictools.org/gk/ lehel olevaid näiteid ja seal olevat gk_07 commonsense järeldusmootorit.
* [https://livettu.sharepoint.com/:v:/r/sites/ITI0215Hajusssteemid2022/Shared%20Documents/General/Recordings/Teadmiste%20praks%2020%20aprill-20220420_140344-Meeting%20Recording.mp4?csf=1&web=1&e=Udoszv 20 aprilli praksi salvestus] mis sattus kogemata Hajussüsteemide teamsi alla. Vt ka väikest mõtestatud näidet [[geodata wars and castles]], mis meil pikema pusimise peale õnnestus geodata peale ehitada.
* [https://livettu.sharepoint.com/:v:/r/sites/Knowledgerepresentation2022/Shared%20Documents/General/Recordings/Teadmiste%20praks%2027%20aprill-20220427_140406-Meeting%20Recording.mp4?csf=1&web=1&e=DAJgPd 27 aprilli praksi salvestus], vt ka [[geodata tourism city]]: built this during 27 April prax. Also used the strategy
<pre>
{
  "strategy":["query_focus"],
  "query_preference": 1,
  "independence": 100,
  "equality":0,
  "max_answers": 20
}
</pre>
and the command line
<pre>
./gk_07 geodata.js  proveevents.js -strategy strategy3.js -seconds 100
</pre>


== Alternative to labs: a research project ==
== Alternative to labs: a research project ==

Redaktsioon: 30. jaanuar 2023, kell 07:37

teadmised
teadmised

Name: Knowlege representation
Code: ITI8700
Link: http://lambda.ee/Teadmiste_formaliseerimine
Lecturer: Tanel Tammet
Contact: tanel.tammet@ttu.ee, 6203457, TTÜ ICT-426
Archives of previous years: 2022.

Time, place, result

Lectures: Tuesday 13:45-15:15 room U05-103
Practical work: Tuesday 15:30-17:00 room U05-103

Plaan on teha osa loengutest kohapeal (esialgu kindlasti kohapeal) ja osa distantsilt. Loenguid salvestame ja salvestuste lingid on allpool blokkide/loengute juures.

Praksidega samamoodi: algul kindlasti kohapeal, samas üritame salvestada / üle kanda, edaspidi tõenäoliselt osa prakse distantsilt (teamsis).

Salvestuste lingid leiad allpool kas vastava loengu või praksi peatüki all.

Moodles materjale ei ole: kogu info, materjalid ja ülesanded on lambda lehel.


Practical work will give 40%, weekly tasks 10% and exam 50% of points underlying the final grade. The exam will consist of several small excercises.

To finish the course successfully, you need to

  • successfully pass three practical works
  • receive at least 1/3 of the max points at exam
  • get practice work + weekly tasks + exam at least 50% points altogehter.

Contents overview: what the course is about

The main focus of the course is on hybrid methods for knowledge representation and reasoning: symbolic AI, machine learning / neural methods and their combinations. We look at this spectrum from simple (representing and using knowledge in databases) to complex (meaning of sentences in natural language and commonsense knowledge) tasks.

The course contains the following blocks:

  • Representing knowledge in the SQL and document databases and hybrids.
  • Representing and using simple facts and rules in symbolic AI and logic.
  • General-knowledge databases: wikidata, wordnet, yago, conceptnet, nell, cyc.
  • Knowledge conveyed by natural sentences: statistical and neural methods like word2vec, BERT, GPT families.
  • Knowledge conveyed by natural sentences: logic-based and hybrid methods.
  • More about reasoners and question answering systems.
  • Confidence and relevance.
  • Context, time, location, events, causality.

Check out this description of the whole KR area.

See also the intro lecture Media:Knowledge_Representation_Intro.pptx

Links to the teams group and lecture videos

The links to saved lecture videos are and will be visible among the materials of corresponding lectures below.

NB! In case you run into trouble (cannot join or no sound etc) please write via fb messenger or email tanel.tammet at taltech.ee.

Weekly tasks

These are small tasks you have to report weekly by email to tanel.tammet at taltech.ee.

Practical work

There are three labs. They are all steps in a single project: build a simple natural-language question-answering system a la classic Watson. There is also an alternative option to do one larger practical research project instead of these three labs: details of this project have to be discussed and agreed with Tanel.

The labs have to be presented (as a demo + small overview of the software and principles) to the course teachers and all students present at labwork time, either in the auditorium or over MS teams. The labs can be prepared alone or by teams of two or three people.


Each lab is evaluated independently and gives the same number of points. NB! When you do not meet the lab deadline, you will be awarded half of the points for this lab.

First lab

Please read about the task for the first lab.

Second lab

The task will be updated for 2023. The task from last year, 2022 was this:

  • write a small set of additonal, nontrivial rules for geography not present in Yago or Wordnet,
  • actually answering simple questions using logic and rules with the help of a reasoner.

Deadline: 6. April 2022.

See Details of the KR second lab in 2022

Third lab: numeric confidences or questions in NLP

This task will be updated for 2023. In 2022 you had two different choices for the third lab:

Details under the separate pages linked to above. A brief intro will be given during the lectures.


Alternative to labs: a research project

The goal of the research project is to build a good database of similar words along with the main differences between word/similar word. A la "queen" is similar to "king" except for gender etc. There are a number of papers explaining different methods. Tanel has built a prototype database/software for doing this from Wikipedia texts + NLP tools + Wordnet, but this prototype is too weak and also does not find main differences. The prototype can be used as a starting point.

Books to use

The main recommendations to get up to speed with very useful background:

  • Get the background about automated reasoning from the book chapter pages 297-345 by Tanel Tammet and optionally more details from the set of course notes from Geoff Sutcliffe.
  • Recommended background for NLP: Speech and Language Processing by Dan Jurafsky and James H. Martin. here is the 2nd edition and (suggested) here the web page for the draft 3rd edition. Recommendation: read from the beginning up to an including chapter 6: Vector Semantics and Embeddings, then skip and read a few chapters starting from 15: Logical Representations of Sentence Meaning. You do not need to understand all the details of math, for example. It is OK if you understand the main principles of representations and algorithms.

Other useful books:

  • Ca half of the course themes are covered in this book with freely accessible pdf-s.
  • The freely accessible pdf of the handbook of knowledge representation gives a detailed and thorough coverage of the subject; far more than necessary for the course.
  • You may want to get a small intro to Prolog by reading the first 100 pages of a classic Art of Prolog book: pdf is freely downloadable under the "Open Access" tab. It is not strictly necessary for the course (we will not be using Prolog) but it surely helps. Besides, the book is interesting, quite easy to read and works out a lot of interesting examples.


Observe that a noticeable part of the course contents are not covered by these books: use the course materials and links to papers, standards and tutorials provided.

Blocks and lectures: the main content of the course

NB! Allpool olev blokkide struktuur on põhiliselt sama, kui 2021 aastal. Toimunud loengute materjalid ja salvestused osaliselt uuendatakse/muudetakse: kogu info veel mitte toimunud loengute kohta on esialgne. Ülesanded ja praksid, välja arvatud teine praks, on up to date ja mõeldud tegemiseks :)

Block 1: knowledge in the SQL and document databases and hybrids.

Lecture: Intro and background, 25. Jan

Esimese loengu salvestamine ebaõnnestus :( järgmine kord teeme paremini. Aga, palun (a) vaata 2021 sissejuhatavat loengut. (b) vaata üle 2022 tegelikult kasutatud sissejuhatuse presentatsioon:

Media:Knowledge_Representation_Intro.pptx

Soovitav (mitte kohustuslik) kuulamine:

Lecture: Nosql, json and rdf in databases: 1. Feb

Lecture materials:

See also

The weekly homework will be about trying out small things in logic: please try out logictools from "basics" to "equality" in simple examples selectbox. Details will appear after the lecture.

Block 2: simple facts and rules in symbolic AI and logic

Lecture: simple rules in rdfs, logic and owl: 8 feb

Have a brief a look at this, no need to read thoroughly:


Lecture: rdfa, json-ld, schema.org: 15 feb

Teamsi salvestuse link.

The main theme is different ways of presenting triple/rdf data

We will first have a look at the following to recall the material from the previous lecture:

The main materials covered in the lecture:


And then have brief look (skim through) at:

Certainly read:

We will also start at looking and understanding the examples in logictools.org

More resources:

Lecture: rules in logic with provers to answer questions: 22 Feb

Loengusalvestus teamsis.

Recall and go over OWL ideas:

We will consider the reasoning part of K&R to understand what provers do:

Lecture: what the reasoner does: 1 March

Teamsi loengusalvestus

We will continue with the same presentation:

along with doing/explaining experiments using logictools.

We will also present the main details of the second practice work.

You may want to have a look at the additional materials - from easier to harder - from the book chapter pages 297-345 by Tanel Tammet, the the set of course notes from Geoff Sutcliffe, the implementation presentation from Stephan Schulz and the readable-and-hackable PyRes reasoner for educational use.

Block 3: General-knowledge databases

Lecture: looking into main large knowledge bases. 8. March

Loengusalvestus teamsis.

E2: you can search/investigate what kind of data is available and you can find out actual data from these databases with some work, by surfing on the web pages of the systems.

We will have a look at the goals, main content and differences between:

Lecture: Allen Ai research systems and Google, Facebook annotation systems: 15 märts

Link salvestusele.

Examples from Allen Ai research:


Google, Facebook annotation systems:

As a background, recall:

Block 4: natural language and question answering

Lecture: Intro to NLP: 22 March

Loengu teamsi salvestus ja NLP sissejuhatuse märkmed loengust.

Recommended listening:

Lecture: vector representation of words: 29. March

Loengusalvestus teamsis.

Nädala eesmärk on konkreetne: sul on vaja aru saada vektorsemantikast, ehk, mis see on, kuidas sõnavektoreid moodustatakse ja kuidas neid kasutada saab.

Now, you may have had a course on NLP and machine learning, in which case you should already know a lot about vector semantics. If so, consider yourself lucky :) and just skim through the following materials to check whether there are any new things or old friends for you. If not so, consider yourself extra lucky: you have come to the core of machine-learning-based NLP, and this is both pretty cool and quite understandable at the same time! Most of the machine-learning-based NLP is built on top of the ideas of vector representation of words.

As a continuation of the lecture from the last week, please have a look and try out

  • Allen NLP demos for a number of core NLP techniques: highly recommended for experimentation.

Obligatory study materials:

Additional supporting non-obligatory materials from (roughly) easier to more complex:

If you want to get a deeper understanding and look at longer lectures while doing that, there is a wealth of good word vector lecture videos available, for example, from the Stanford NLP course

However, I'd recommend to use the obligatory and supporting materials above first and only - optionally - spend time with the longer lectures after that.

Also interesting to look and read:

Block 5: Conceptually complex issues in KR&R

We will focus on several conceptually complex issues in KR: open/closed world, frame problem, reasoning with uncertainty, semantic parsing of NLP, context etc.

All of these are critical for commonsense reasoning and none have really good answers or implementations so far.

Lecture: open/closed world, planning, frame problem, blocks world: 5. April

Loengusalvestus teamsis

For the main part of the lecture we consider planning and the frame problem. The standard example for these is a blocks world: some blocks are on the table and the robot arm can lift single blocks and put them on other blocks or on the table. The arm cannot lift several blocks or a tower of blocks. Then, given a position of blocks at initial situation, can the robot arm create a required new position of blocks? Can we get the steps required? For getting the steps we use the $ans predicate.

One hard issue arising is that how do we know that doing some action like lifting a block does not create side effects like stumbling existing towers, moving other blocks etc? This issue is called the frame problem and it has no easy solutions.

Importantly, the frame problem arises since normal first order logic has

  • the open world assumption E1 (must read): if we do not have (and cannot derive) a positive fact like P(a) and neither a negative fact like -P(a), we assume we simply do not know which holds.

Prolog and databases operate under the

  • closed world assumption E1 (must read): if we do not have (and cannot derive) a positive fact like P(a), we automatically assume that -P(a) must be true. For example, Prolog "negation" really means "cannot prove". One consequence of this assumption is that we cannot represent real negation and disjunction in an OK manner (Prolog does not contain these) and cannot satisfactorily speak about "true", "false" and "unknown". See also negation as failure in prolog


Please look at and read these materials about the frame problem:

These two readings are optional:

  • frame problem at the Stanford Encyclopedia of philosophy: not obligatory, but a good read to get a better understanding.
  • another classic about frame problem: read this only if you became really really interested about the whole issue: it goes quite deep, although it is not especially technical.

You may also want to have a look at the algorithmic complexity and efficient solution algorithms, regardless of how we formalize the problem: see this article.

Next, importantly, you should experiment yourself with gkc and both of the following files. Please copy and read the files and understand the encoding. At the end of the files are several queries to experiment with: instructions are also there.

In both of them the predicate holds(X,Y) is used to describe something X about the blocks world (like, one block is on another or robot holds some block) and the second argument Y describes the state we have arrived to via robot actions from the original state (like, picked up a block in the initial state and then did put the block down on top of another).



To get a simple visualization of the blocks world, have a look at this tiny video.


Reasoning with uncertainty: 12 April

Loengusalvestus.

Loengu sissejuhatava osa presentatsioon: Reasoning_with_uncertainty.pdf E1.

Almost all the knowledge we have is uncertain: there are many exceptions to a rule or a fact/rule holds with some vague probability. Notice that, in contrast, typical databases in companies contain facts with very high certainty, but they do not contain rule or commonsense knowledge: the latter is built into brittle software code of systems using these databases.

We will consider two different ways to tackle uncertainty:

  • Numeric methods: uncertainty is estimated with probability-like numbers of various kinds.
  • Discrete methods: no numbers used. Instead, uncertainty is described as exceptions or beliefs of people.

NB! Both of these ways are hard to actually implement, neither have they been understood very well, despite an immense amount of research and papers. For example, typical machine learning methods operate with extremely vague probability-like numbers and do not attempt to put these numbers into a real properly-theoretical-and-correct probabilities framework.

The main material for reading about numeric methods is an overview-followed-in-depth by the lecturer Numeric uncertainty: (E1 up to and including the chapter 4, see also E2 tags inside)

  • Read carefully up to and including the chapter 4 "Different ways to encode confidences in logic" and have a quick look at all the wikipedia links.
  • Skim through the later parts and look only into these subchapters which you found interesting.

Next,

  • Read the paper E2. containing intro, alorithms and experiments.
  • Look at the web page with the confer reasoner and a wealth of examples.

Next, have a brief look at a good example system doing some specific kinds of probability reasoning:

Lecture: semantic parsing and further details for the third practical work: 19 April

Lecture recording.

Additionally, please listen and read in this order:

Also, check out a very useful demo:


You may want to have a look at the AllenAI tutorial

Additionally you may want to read some papers about semantic parsing:

  • Read a paper about building a semantic parser in a relatively simple way.
  • Another paper about semantic parsing

There is an interesting specific method for semantic parsing, called AMR, worth having a brief look into:

There is a very good fairly deep NLP-and-commonsense series of podcasts and other interesting stuff from the Allen Institute for AI:



Lecture: further details for semantic parsing: 26 April

Teams recording

Reasoning with uncertainty: discrete reasoning options

Lecture recording in teams.

This week is devoted to discrete methods. Please read the materials described below slowly and carefully: the E1 materials are what I expect you to know well at the exam and the E2 materials are what you should know a bit at the exam.

Experimentation with the DLV system is recommended!

Roughly said, there are three kinds of discrete methods:

  • Exceptions to rules. The main method is called default logic. E1 Read carefully!. Another, less popular method is circumscription (skim through, careful reading not needed). The main classical example for default logic is "birds normally fly": bird(X) & [we fail to prove -flies(X)] => flies(X). In other words, a rule is blocked, if we manage to prove that a negation of the rule-derived fact can be proved. Say we have
    • bird(tweety)
    • penguin(pengu)
    • (bird(X) & [we fail to prove -flies(X)]) => flies(X)
    • penguin(X) => -flies(X)
Then we can derive -flies(pengu) and flies(tweety) but we cannot derive flies(pengu), since it is blocked by -flies(pengu) which we could derive. In the wikipedia page above the "justification P" really means "we fail to prove -P".
Esimest järku loogikas ei ole üldjuhul võimalik välja rehkendada, et mingi asi ei ole järelduv. Lausearvutuses samas on. Sestap on olemas selline tore valdkond nagu answer set programming, E2 kus esimest järku muutujatega valem teisendatakse lausearvutuseks, tekitades muutujatega reeglitest hästi palju konstante sisaldavaid reegleid. Siis muutuvad blokkerite arvutamised võimalikuks. Võid tahta lugeda päris head introt teemasse, mille on kirjutanud Aalto ülikooli rektor Niemelä. Samas ei ole see lausearvutuseks-teisendamine mittetriviaalsetel juhtudel võimalik. Üks paremaid süsteeme seal on DLV (DLV wikis), vaata DLV manuaali Kui sul tekib rohkem huvi, siis selle answer-set programming lähenemise jaoks on olemas terve kursus videote ja loengumaterjalidega.
Teine oluline küsimus eranditega reeglite puhul on nende prioriteedid: kui kaks reeglit üksteist blokivad, kas mõnel peaks olema kõrgem prioriteet? Näiteks, "materiaalsed asjad üldiselt ei lenda", "linnud on materiaalsed asjad", "linnud üldiselt lendavad", "pingiviinid on linnud", "pingviinid üldiselt ei lenda". Siin paistab, et taksonoomias allpool olevaid asju kirjeldavad reeglid võiks olla kõrgema prioriteediga kui ülalpool asju kirjeldavad reeglid. Samas "Nixoni kolmnurga" näites "vabariiklased ei ole patsifistid", "kveekerid on patsifistid", "Nixon korraga vabariiklane ja kveeker" oleks loomulik mõelda, et esimesed kaks default reeglit Nixoni jaoks blokeeruvadki ja me ei saa järelda, et Nixon on patsifist, ega ka seda, et ta ei ole patsifist. Prioriteetide teema kohta võib vaadata täeindavalt seda artiklit või seda sarnast artiklit.
  • Describing beliefs of various actors. This builds upon modal logic (see intro presentation E2 to understand the basics) and the main method is (auto)epistemic logic: the logic for encoding who knows or believes what. See the long tutorial as an easily read text E2 and additionally tutorial slides Ijcai93.pdf by the same authors to accompany the long text. Read carefully, starting with the long text and also looking at slides at the side.
  • Multi-valued logics with belief degrees (a la "very unlikely", "very likely") at different intervals. We will not look into these: we'll investigate the numeric methods instead. Have a very brief look at the wikipedia.

NB! None of these methods are really used in any kinds of practical systems: they are hard to efficiently implement and they are not understood well enough in practical settings.

Reasoning with uncertainty: combining discrete and numeric

Read Implementing_Default_Logic.pdf draftE2.

We will look at a number of small examples using both numeric and discrete uncertainty and will experiment with our new experimental solver in a live session.

  • What is our approach to using default rules?
  • How do we handle numeric uncertainty and default rules together?
  • What works OK and what is problematic?
  • What are some important practical issues to be solved?
  • Some ideas for building a knowledge base with uncertainties.

See also draft notes for our approach to reasoning with defaults

Context and relevance

Märkmed konteksti teemal

Consultation for exam

Other stuff: Commonsense rules development