0

Least Squared Error

Unsolved
Supervised

Difficulty: 1 | Problem written by Junaid Ahmed
Lease Squaared Error (LSE) works by reducing the total square of the errors to the smallest possible value (hence the name "least squares"). The number of squared errors is minimized by using a straight line. These errors are mostly used in linear regression.

The equation for LSE is:

\(L = \frac{1}{2}(y-z)^{2} \)

y is the real value 

z is the predicted value

Write a Python function to compute the LSE of the predicted and real values.

Use different inputs to check the validity of the program.

Sample Input:
<class 'list'>
y: 0.34
z: 0.56

Expected Output:
<class 'float'>
0.024200000000000006

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Quas debitis porro mollitia commodi nisi eaque reiciendis et minima, iure voluptates quae deleniti maiores esse aliquam nobis, molestiae consequuntur reiciendis vero magnam nulla repellat sit nam saepe?

Provident veniam minus perferendis facere. Non alias odio voluptas dolorum, a sequi at voluptates fugiat odio recusandae consequuntur rem velit, earum amet quo iure accusamus maxime optio nisi reiciendis id voluptate? Consectetur recusandae ea dolores, alias hic distinctio ullam esse culpa incidunt sit maxime aut, laborum itaque officiis voluptate?

Rerum laudantium alias laborum. Libero quibusdam labore magnam aut nisi non quae ipsam ipsum esse unde, saepe debitis porro deleniti numquam doloribus voluptatum sapiente laboriosam beatae quasi voluptate, quis soluta illo recusandae, doloremque fuga minus molestiae tenetur labore commodi. Quasi dolore in quibusdam sapiente ad eius tenetur facilis dolorum, voluptatem hic blanditiis, fugit adipisci quaerat incidunt omnis amet quod, tenetur dignissimos sapiente modi eos harum nostrum minus, velit tenetur expedita officia nihil. Id magnam tenetur dolore tempora expedita perferendis quis iusto, nulla recusandae placeat, ullam consectetur alias quisquam magnam, dolore quae temporibus consequuntur illum harum id qui rerum illo architecto magni, quibusdam qui dicta quod quis sapiente reprehenderit nam eos.

This is a premium feature.
To access this and other such features, click on upgrade below.

Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)