why do we calculate risk when we already have loss functions? If we already have let's say mean squared error as a loss function which can tell how good our algorithm is, then why we calculate the expectation of loss function as Risk?
Apologies, if this a naive question since i am new to machine learning.
 A: The risk in machine learning context is the expectation of the loss function over the random variable.
Let's say you have a random variable $x$. If you apply the loss function $L(.)$ to this random variable you get another random variable $y=L(x)$. The expectation is not a function, it's rather an operator $E[.]$, when you apply it on the random variable $y$ you get the constant value $\mu=E[y]$.
So, the result of applying a loss function is the transformation of the random input into another random input. When you get the expectation of that new (transformed) random variable, you get back a number -- risk.
A: Here is my basic(!) explanation. 
You are totally correct that the loss function can be used to calculate how good (or bad) your algorithm is. However, it does so by using the known data set, or the data used to train the algorithm.
Risk is the expectation of the loss function. This expectation applies to all input data, not just the data that you used. 
You might have an extremely good algorithm under your first definition through overfitting. Say you are predicting college acceptance of students. You have a sample of 100 students with different variables: gpa, sat, and high school ranking. Your algorithm is completely over trained to the data and consists of a saying that for those exact inputs, you'd produce those exact output scores. 
But what if you get a new student? In that case your classifer wouldn't have trained against it, and would produce an incorrect answer. Of the total input space, your 100 samples are nothing. Your risk in this case would be extremely high (infinity). Your model would be terrible in reality and that is exactly what risk measures.
