Skip to content
UoL CS Notes

Home

This website houses notes from my studies at the University of Liverpool. If you see any errors or issues, please do open an issue on this site's GitHub.

Evolutionary Modelling

COMP107 Lectures

This type of modelling is inspired by agile principles. Designing an ER Schema You should identify the basic components: Entity types. Relationship types. Attributes And for each of these components: Key attributes (unique for each identity). Cardinality and participation constraints of relationships. Different entity types. Strategies to ER Design Top-down...

Read More

Tutorial 3

COMP107 Tutorials

Designing an ER Schema You should identify basic components: Entity types, relationship types, attributes: Key attributes. Cardinality and participation constrains of relationships. Different entity types. There are also weak entities such as tables or chairs. These simple objects don’t need individual identification and should be a child of the strong...

Read More

Bayes' Theorem

COMP111 Lectures

First Form If $P(A)>0$, then: \[P(B\vert A)=\frac{P(A\vert B)\times P(B)}{P(A)}\] Proof We have: $P(A\cap B)=P(A\vert B)\times P(B)$ $P(A\cap B)=P(B\vert A)\times P(A)$ Thus: \[P(A\vert B)\times P(B)=P(B\vert A)\times P(A)\] By dividing by $P(A)$ we get: \[P(B\vert A)=\frac{P(A\vert B)\times P(B)}{P(A)}\] Application - Diagnosis Assume a patient walks into a doctor’s office complaining of a...

Read More

Independence

COMP111 Lectures

In everyday language we refer to events that have nothing to do with each other as being independent. Definition Events $A$ and $B$ are independent if: \[P(A\cap B)=P(A)\times P(B)\] If $P(A)\neq 0$ and $P(B)\neq 0$, then the following are equivalent: $A$ and $B$ are independent. $P(B)=P(B\vert A)$ $P(A)=P(A\vert B)$ See...

Read More

Conditional Probability

COMP111 Lectures

Often we are interested in just part of the sample space. Conditional probability gives us a means of handling this situation. Example Consider a family chosen at random from a set of families having two children (but not having twins). What is the probability that both children are boys? A...

Read More

Lecture 18-2

COMP105 Lectures

First Past the Post Example This example covers a first past the post election. This means whoever gets the most votes wins. We are aiming to make a function that performs this task: > winner ["red", "blue", "red", "red", "green"] > "red" Getting the Candidates First we need to figure...

Read More

Lecture 18-1

COMP105 Lectures

Marks to Report Example This lecture covers a mini assignment example about converting a csv file containing students marks into a report containing the students averages. These are presented in the following format: aaa 70 65 67 60 bbb 55 60 55 65 ccc 40 40 40 40 ddd 80...

Read More

Probability of the Union of Events

COMP111 Lectures

Disjoint Events Assume that $E _1,\ldots,E_n$ are mutually disjoint events. So $E_i\cap E_j=\emptyset$ whenever $i\neq j$. Then, \[P(\bigcup_{i\leq i \leq n}E_i)=\sum_{1\leq i\leq n}P(E_i)\] Example - Three Dice Suppose that I roll a fair die three times: $S$ is the set of dequences of lengh three over $\{1,\ldots,6\}$ (or $\{1,\ldots,6\}^3$). $P(x)=\frac{1}{6\times6\times6}=\frac{1}{216}$...

Read More

Events

COMP111 Lectures

An event is a subset $E ⊆ S$ of the sample space $S$. The probability of the even $E$ is given by: \[P(E)=\sum_{x\in E}P(x)\] $0 ≤ P(E) ≤ 1$ for every event $E$ $P(\emptyset) = 0$ and $P(S) = 1$ Example - Fair Dice If I roll a die three...

Read More

Reasoning Under Uncertainty

COMP111 Lectures

Logic based knowledge representation and reasoning methods mostly assume that knowledge is certain. Often, this is not the case (or it is impossible to list all assumptions that make it certain): When going to the airport by car, how early should I start? 45 minutes should be enough from Liverpool...

Read More