Testing gradient desent code on fake values

While working on the opitional lab of Gradient Descent. I tried giving some random values to the code to test how does it works and learn.
While giving values for the size of the house i entered two values for 2000 and gave the price 500k 700k to test how does the code behaves.

Load our data set

x_train = np.array([1.0, 2.0, 2.0]) #features
y_train = np.array([300.0, 500.0, 700]) #target value

I was surprised to see that the code still can calculate values for w and b.
Can anyone explain this behaviour of the code that how can it fit to something which would be non real in the real world example.

Hi @Ghulam_Mustafa ,

What the model does to find the relationship between the input and output. If you fed the model with unreal data, it would give you the unreal output. The mechanism of finding W and B does not change. Do revisit the lecture videos again and listen to how Prof. Ng defines the input and output relationship of a model.

Thanks kic for your reply.
I got your point. Is there any mathametical method to seperate unreal data from a real one in the time to traning a model?
pls guide me.

Hi @Ghulam_Mustafa

In these exercises, all the data used has already been pre-processed. In the real world, if you are collecting raw data for solving a particular problem, you will need to clean the data and making sure the data is fit for purpose. Taking the example of housing prices, you might get it from a trusted source such as government statistics department, and then clean the data before feeding it to your model.
I don’t know of any mathematical way to separate the real and unreal data. However, during the data pre-processing phase, you can program your code to discard data that is out of range or with nonsense values.
These courses in the MLS specialization are introductions to the different algorithms used in Machine Learning and how they can be applied to solve a problem. There might be gaps to fill; but having a good understanding of the basics will help to ask questions.