# What are the true error and the sample error?

I am a student and I am studying machine learning. I am focusing on the concept of evaluation of an hypotesis.

What I have seen is that there are two types of error: true error and sample error.

The true error of an hypotesis $$h$$ with respect to a target function $$f$$ and a distribution $$D$$ is the probability that an hypotesis $$h$$ misclassifies an instance $$x$$ drawn according to $$D$$, and it is computed as:

$$error_D(h)=Pr_{x\in D}[f(x)\neq h(x)]$$

while the sample error of an hypotesis $$h$$ with respect to a target function $$f$$ and data sample $$S$$ is the proportion of examples that $$h$$ misclassifies:

$$error_S(h)=\frac{1}{n}\sum _{x\in S}\delta (f(x)\neq h(x))$$

where

$$\delta (f(x)\neq h(x))=1$$ if $$f(x)\neq h(x)$$ and $$0$$ otherwise.

I ask this question because I have not clear what these errors are.

Moreover, I have seen that the true error cannot be computed, while we can compute only the sample error. I don't understand why.