FORMULAS Flashcards

(39 cards)

1
Q

Formula for posterior probability and the formula for the evidence

A

p(x) = p(x|a)p(a) + P(x|b)p(b)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

SIMPLE Formula to decide which class to assign classify x as

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Formula for guassian distribution

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Formula for covariance of two variables k and l

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Formula for the product of all max likelihoods

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Formulas for mean and variance

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

When 2 probability density functions (w1 and w2) overlap, what is the formula for the probability of an error

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Formula for the probability that x belongs to w2 but falls in region 1

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Formula for the average risk

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Formulas for measuring the loss of each class

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Formula for the likelihood ratio, how to use and what you can do with the decision boundary

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Formula for unbiased estimate of the population covariance

A

The unbiased estimate of the population covariance is (N)/(N-1)S

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Formula for euclidean distance and manhattan distance

A

Euclidean - p=2
Manhattan - p=1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Formula for cosine distance

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Formula for the mahalanobis distance

A

Multiply inverse covariance matrix by (x-y)^T

Then dot with (x-y)

Square root the answer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Formula for the discriminant and how to use it to assign to a class

A

g(x) = (w^T)x + w0

if g(x) > 0, assign to class 1

else

assign to class 2

17
Q

What is the computational complexity of the KNN

A

O(NL) where N is the number of samples and L is the number of features

18
Q

Formula for accuracy

A

Measures how often the classifier makes correct predictions. It is the ratio of correctly classified instances to the total instances

19
Q

Formula for precision

A

Ratio of correctly predicted positive observations to the total predicted positives. Tells us how many of the predicted positives were actually positive

20
Q

Formula for recall

A

The ratio of correctly predicted positive observations to all observations that are actually positive. It tells us how many of the actual positive cases were correctly predicted

21
Q

Formula for F1 score

22
Q

Give the formula for divergence for D12

23
Q

Formula for symmetric divergence

A

d12 = D12 + D21

So the divergence + the divergence but with ω2 swapped with ω1

24
Q

Formula for covariance matrix for features x2 and x2

25
Pseudocode for a perceptron learning algorithm
P and N are inputs with class labels (1,-1) Learning rate is a hyperparameter InitialiseW: randomly, is initialising the weights and biases LINE: while Not converge do: Convergence refers to the training stoppping criteria which could be: No more errors Model stop making improvement Max number of iteration LINE: Do forwards pass Activation function LINE: if X’ e P and W^T * X’ < 0 It is saying for each sample in the positive class, check if it is negative, if it is then append the negative of the sample to the error class (delta) Next if statement: If sample is in negative class and is positive, add the sample to the error class delta After all if statements New set of weights = Weights - learning rate * sum of all errors Increase t (iterations)
26
SIMPLE formula for new set of weights
New set of weights = Weights - learning rate * sum of all errors
27
Formula for sum of errors (delta)
sum of X’ when it was misclassified, you add a -X’ if it was misclassified as positive
28
What is the formula for the new set of weights using the gradient descent rule
W(t) - rate of learning * gradient of the cost function
29
Give the formula for the logistic sigmoid function
σ(z) = 1/ (1+e^-z)
30
Write the simple neural network using the logistic activation function
z = (W^T)X + b y hat = 1/(1+e^-z)
31
Give the formula for the simple cost function
32
Give the formula for the simple cost function after substituting y hat in
33
Give the pseudocode for sequential clustering and explain it
Put x1 into the first cluster Loop from 2 to number of data points Measure distance between data point and cluster If distance is greater than threshold and max clusters not reached Create new cluster and put that data point in it If the distance is smaller than the threshold, add it to that cluster
34
Describe the agglomerative algorithm
Select some cluster-cluster proximity measure g Let t be an integer denoting the current level of the hierarchy Then the general agglomerative clustering scheme can be stated as (image) Initialise: Start with each data point as its own cluster, creating N clusters Repeat: While there is one cluster - Compute the pairwise proximity g(Ci,Cj) for all cluster pairs Identify pair of clusters with smallest proximity Merge these two clusters into a new cluster Update set of clusters by removing the old ones and adding the new one Update the hierarchy to include the new cluster level t Increment t
35
Cost function of a cluster
μi is the centre point (centroid) of the cluster J is the sum of the distances from all the points in a cluster to μi (its centre point) small cost J implies a good clustering e.g. elements are close to their clusters
36
Define the K-means algorithm
Initialisation Choose number of clusters (K) Initialise K centroids randomly from the data points Assignment Assign each data point to the nearest cluster centroid, using a distance metric Update Recalculate the centroids of each cluster as the mean of all data points assigned to that cluster Repeat Alternate between the assignment and update steps until stopping criteria are met stopping criteria: cluster assignments no longer change centroids stabilise max iterations reached
37
What is Soft K-means
Distance between each point in the cluster to the centroid * U U is a continuous value between 0 and 1 giving the probability that the point belongs to the cluster
38
How is the U calculated to determine the probability that the point belongs to that cluster
β is called temperature Small β (high temperature) are very soft, every cluster gets some weight Large β (low temperature), approaching hard k-means, assignments become nearly 0/1
39
How to calculate new centroid for Soft-K means
Sum all the distances * their weights and divide by the total weights