HOMEWORK 1

Shruti Bhargava – 13671



View CODE

Click here for figures.

OBJECTIVETo analyse the given data representing height measurements for dropping a ball down for a fixed amount of time by demonstrating the possibility of fitting polynomial curves for the same.



POLYNOMIAL COEFFICIENTS obtained as BEST-FIT on 'train_small' DATA

COEFFICIENT OF

Degree=0

Degree=1

Degree=2

Degree=3

Degree=5

Degree=9

x0

156.450067204000

-82.8186759849698

27.8869657019996

-85.1430926667695

-6420.09625284803

2079030.46157192

x1


50.3723669871515

-0.930247453151366

79.6796048115152

7804.79521687200

-4377092.01233501

x2



5.40027520424241

-12.5410039019114

-3647.89865004070

4028322.83250255

x3




1.25903713025641

827.588111266824

-2128283.16321080

x4





-90.9093007601595

711845.770445245

x5





3.88200060455207

-156416.601522000

x6






22595.0216489479

x7






-2070.43677692882







109.268828731187







-2.53198416266513







POLYNOMIAL COEFFICIENTS obtained as BEST-FIT on 'train_big' DATA

COEFFICIENT OF

Degree=0

Degree=1

Degree=2

Degree=3

Degree=5

Degree=9

x0

256.383861985551

-166.283574829398

-19.4993885696681

27.5620995195070

353.084080659908

2168.67496261319

x1


67.6267898903919

14.0559189926803

-12.8235869232669

-321.411225178492

-3575.61215516570

x2



4.28566967181692

8.92958994901994

119.167071304045

2619.87240619193

x3




-0.247675748117494

-18.9145331882118

-1098.08972536985

x4





1.50850817329284

289.251573863219

x5





-0.0468359692419199

-49.1433442618434

x6






5.35551049099945

x7






-0.359756172388189

x8






0.0134830214286634

x9






-0.000214195736217227

The above polynomials have been obtained by using the least squares method.

OBSERVATION- The coefficients switch and increase in magnitude with the increasing degree.





Plot comparing Accuracy on TEST, VALIDATION and small TRAINING data

k4Lu2OPsyNMHeYQw8FA2F06pmB2xIQYrho75SKa6pfZmnzPuWXLMx4XxiFvz7AtZzjse17MriqrjvmPVlKzxErlGx7ikdITxZXiCs46L1VzBTcCc5v0Cs6030d431HcoV8KtJn2eCg6NpzY2dmp1+tYA6w0PdWy8I6KduWSQG8AMIAV8FEn391JmF/8knOKnzEC6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AAAASUVORK5CYII=" name="Image2" align="right" width="71%" border="0">
Illustration 1: Plot showing RMS Error vs Degree of polynomial



OBSERVATIONS:-

RESULT:-

  1. The optimal degree to fit a polynomial on a given data set varies with the size of the data. The most important factor being that the number of data sets should be comparatively larger than the degree, in order to avoid overfitting and get useful results.

  2. In this case the optimal degree is 2.

  3. The error obtained on the test set in our optimal model is 24.56483.







BIG vs SMALL TRAINING SET



OBSERVATIONS:-

INFERENCE:-


ANALYSIS



In the analysis, we conclude the following major points :-



while

Test set is an unknown data on which our inferences derived are later checked and analysed.


  • Target function- Best Guess-

Quadratic polynomial obtained from the bigger training set (in the table above), since it has the least error on the test set.



VERIFICATION

Since the data available to us was for a bouncing ball, hence there actu near ally exists a near quadratic relation between it's height and time- laws of motion give the relation- s = u*t+a*t*t/2 .