Attached is the file with the homework assignment I need help with. This is using Python for statistical learning for digit recognition. The structure of the code is given already and will need to add the statistical learning part into the code for it to do the calculation for PLA.
Assignment.png __MACOSX/._Assignment.png DigitsTesting.csv 9,1,1,1,1,1,0.974,0.7805,0.426,0.308,0.048,0.355,0.891,1,1,1,1,1,1,1,1,0.874,0.206,0,0,0.0045,0.0425,0,0.0345,0.738,1,1,1,1,1,1,0.8935,0.103,0,0.1365,0.589,0.8465,0.893,0.812,0.083,0.122,0.911,1,1,1,1,0.961,0.095,0,0.495,0.964,1,1,1,1,0.695,0,0.3645,1,1,1,1,0.494,0,0.376,1,1,1,1,1,0.701,0.337,0,0.0995,0.999,1,1,0.9905,0.1775,0,0.8435,1,1,1,1,0.896,0.012,0,0,0.2935,0.988,1,1,0.9965,0.083,0.0515,0.9755,1,1,1,0.9155,0.43,0,0,0.349,0.9445,1,1,1,1,0.322,0.103,0.918,1,0.7225,0.463,0.0835,0,0,0.152,0.9405,1,1,1,1,1,0.684,0.0225,0,0,0,0,0.0475,0,0,0.631,1,1,1,1,1,1,1,0.7535,0.2745,0.154,0.154,0.5035,0.6185,0,0.059,0.8975,1,1,1,1,1,1,1,1,1,1,1,1,0.4225,0,0.282,1,1,1,1,1,1,1,1,1,1,1,1,0.9955,0.1485,0,0.5125,1,1,1,1,1,1,1,1,1,1,1,1,0.9165,0.0205,0,0.8145,1,1,1,1,1,1,1,1,1,1,1,1,0.8,0.001,0.0795,0.966,1,1,1,1,1,1,1,1,1,1,1,1,0.712,0,0.134,1,1,1,1,1,1,1,1,1,1,1,1,1,0.954,0.285,0.189,0.9865,1,1,1,1,1 6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0.8915,0.9865,1,1,1,1,1,1,1,1,1,1,1,1,1,0.682,0.1055,0.6855,1,1,1,1,1,1,1,1,1,1,1,1,0.7335,0.0185,0.1955,0.993,1,1,1,1,1,1,1,1,1,1,1,0.9375,0.1975,0.02,0.6755,1,1,1,1,1,1,1,1,1,1,1,1,0.475,0,0.452,1,1,1,1,1,1,1,1,1,1,1,1,0.791,0.015,0.234,0.961,1,1,1,1,1,1,0.801,0.3465,0.141,0.141,0.6865,0.999,0.1385,0,0.7155,1,1,1,1,1,0.9085,0.568,0.096,0,0,0,0.1515,0.835,0.0175,0.1705,1,1,1,1,1,0.756,0.131,0,0.0805,0.668,0.9885,0.2835,0.061,0.4195,0,0.551,1,1,1,1,0.8215,0.065,0.015,0.368,0.9855,1,0.6995,0,0.4415,0.0825,0.016,0.8505,1,1,1,1,0.401,0,0.474,1,1,0.6455,0.062,0.105,0.9095,0.304,0.019,0.7305,1,1,1,0.974,0.09,0,0.584,0.7375,0.36,0.016,0.06,0.8065,1,0.7755,0.073,0.01,0.251,0.338,0.338,0.336,0.001,0,0.015,0.0025,0.012,0.375,0.821,1,1,1,0.82,0.1695,0.0145,0,0,0,0.025,0.113,0.113,0.349,0.761,1,1,1,1,1,1,1,0.8315,0.803,0.803,0.803,0.844,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 3,1,1,1,0.7965,0.15,0,0,0,0,0.0735,0.4625,0.9625,1,1,1,1,1,1,0.7765,0.001,0,0,0,0,0,0,0,0.0195,0.538,0.9995,1,1,1,1,0.386,0,0.0755,0.575,0.8525,1,0.925,0.6665,0.536,0.0355,0,0.7255,1,1,1,1,0.793,0.1115,0.762,1,1,1,1,1,1,0.328,0,0.228,0.9995,1,1,1,1,1,1,1,1,1,1,1,0.9015,0.035,0,0.175,0.9995,1,1,1,1,1,1,1,1,1,1,0.7895,0.0895,0,0,0.5655,1,1,1,1,1,1,1,1,1,0.8105,0.422,0.033,0,0,0.2125,0.9665,1,1,1,1,1,1,0.976,0.588,0.199,0,0,0,0.024,0.5465,1,1,1,1,1,1,1,1,0.705,0,0,0,0,0,0.104,0.8575,1,1,1,1,1,1,1,1,1,0.6725,0.3335,0.525,0.6665,0.586,0.197,0.025,0.5505,1,1,1,1,1,1,1,1,1,1,1,1,1,0.919,0.226,0,0.633,1,1,1,1,1,1,1,1,1,1,1,1,1,0.6425,0,0.1355,1,1,1,1,0.8055,0.972,1,1,1,1,1,1,0.778,0.0285,0,0.1105,0.9715,1,1,0.9715,0.1105,0.2225,0.6665,0.6665,0.6665,0.583,0.3055,0,0,0,0,0.2515,1,1,1,1,0.2465,0,0,0,0,0,0,0,0,0.085,0.4735,0.973,1,1,1,1,0.9705,0.4705,0.1925,0,0,0.1415,0.3335,0.419,0.6965,1,1,1,1,1 6,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0.7085,0.665,1,1,1,1,1,1,1,1,1,1,1,1,0.9415,0.2765,0.0005,0.1125,1,1,1,1,1,1,1,1,1,1,1,0.7945,0.0985,0,0.199,0.3715,1,1,1,1,1,1,1,1,1,1,0.794,0.069,0.0095,0.425,0.99,1,1,1,1,1,0.9845,0.7185,0.6475,0.6475,0.9695,0.8255,0.0685,0.0175,0.6095,1,1,1,1,1,0.973,0.796,0.256,0,0,0,0.3745,0.331,0,0.473,1,1,1,1,1,0.849,0.186,0,0,0.1635,0.4705,0.055,0.0025,0.0025,0.061,0.907,1,1,1,1,1,0.306,0,0.1445,0.7505,0.963,0.836,0.0185,0.2635,0.0055,0.1125,1,1,1,1,1,1,0.1615,0,0.827,1,1,0.439,0,0.6785,0.015,0.039,0.753,0.997,1,1,1,1,0.28,0.369,0.998,0.9925,0.6615,0.007,0.166,0.977,0.4735,0,0,0.2505,0.481,0.4105,0.6075,0.6075,0.6075,0.6075,0.408,0.1815,0,0.2785,0.8705,1,0.9895,0.4055,0.029,0,0,0,0,0,0,0,0,0.052,0.4115,0.9555,1,1,1,1,0.8615,0.7255,0.5405,0.8055,0.5105,0.707,0.5105,0.591,0.824,0.89,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 6,1,1,1,1,1,1,1,0.929,0.553,0.099,0.605,1,1,1,1,1,1,1,1,1,1,1,0.927,0.2015,0,0.101,0.694,1,1,1,1,1,1,1,1,1,1,0.7405,0.2,0,0.1735,0.89,1,1,1,1,1,1,1,1,1,1,0.693,0.0435,0,0.171,0.9125,1,1,1,1,1,1,1,1,1,1,0.6865,0.0305,0.0005,0.4355,0.9175,1,1,1,1,1,1,1,1,1,1,0.67,0.007,0,0.4965,1,1,1,1,1,1,1,1,1,1,1,0.8705,0.1185,0,0.4405,0.993,1,1,1,1,1,1,1,1,1,1,1,0.3645,0,0.0605,0.9355,1,1,1,1,1,1,1,1,1,1,1,0.81,0.0335,0.0085,0.6745,1,1,1,1,1,1,0.965,0.678,0.224,0.1765,0.191,0.8165,0.426,0,0.2255,1,1,1,1,1,0.9265,0.586,0.167,0,0,0,0,0.0895,0.0695,0,0.457,1,1,1,1,0.64,0.061,0,0,0.097,0.5485,0.5955,0,0.1525,0.0455,0,0.833,1,1,1,0.658,0.0005,0,0.144,0.765,0.9975,0.9295,0.2155,0,0.6335,0.0225,0,0.776,1,1,1,0.177,0,0.3415,0.963,1,0.9245,0.201,0,0.4155,0.985,0.1845,0,0.123,0.477,0.622,0.8305,0.008,0,0.429,0.792,0.4625,0.0835,0,0.4385,0.9815,1,0.7685,0.052,0,0,0,0,0,0,0,0,0,0.085,0.6935,0.988,1,1,1,0.8485,0.554,0.344,0.0495,0.0495,0.0495,0.0495,0.0495,0.355,0.6845,0.9335,1,1,1,1 0,1,1,1,1,1,1,0.4025,0,0.473,1,1,1,1,1,1,1,1,1,1,1,1,0.9005,0.105,0,0.072,0.641,0.9155,1,1,1,1,1,1,1,1,1,0.9685,0.251,0,0.0125,0.616,0.034,0.037,0.5345,0.9825,1,1,1,1,1,1,1,0.465,0,0,0.277,0.9765,0.6925,0,0,0.362,0.9475,1,1,1,1,1,0.7115,0.02,0,0.119,0.8995,1,0.9935,0.619,0.0295,0,0.644,1,1,1,1,0.9945,0.3395,0,0.038,0.756,1,1,1,1,0.5075,0,0.047,0.879,1,1,1,0.765,0.004,0,0.5275,1,1,1,1,1,0.8255,0.095,0,0.397,1,1,1,0.288,0,0.066,0.8585,1,1,1,1,1,0.9945,0.1395,0,0.5625,1,1,0.972,0.0665,0,0.5,1,1,1,1,1,1,1,0.2105,0,0.328,1,1,0.5555,0.002,0.011,0.802,1,1,1,1,1,1,1,0.4445,0,0.4935,1,1,0.297,0,0.006,0.9305,1,1,1,1,1,1,1,0.3735,0,0.27,1,1,0.426,0,0