For the following assignments, please provide as much evidence of the results as possible, including the code, screenshots (only plots – not text or code) and documentation. Submit only one pdf file...

1 answer below »
Please find instructions for this order in the uploaded file, answer all questions carefully. Give clear explanations on short-answer questions and submit all in a word document. For coding parts, submit your codes in ipynb files and make sure one file per question.


For the following assignments, please provide as much evidence of the results as possible, including the code, screenshots (only plots – not text or code) and documentation. Submit only one pdf file and .ipynb / .py files containing the code with documentation. 1.(a) Consider a toy training dataset with just two data points and one feature: (x1 = 0, y1 = +1) and (x2 = 2, y2 = -1) for use with SVM. Use the polynomial transformation (1+x)2 to convert this dataset into a higher dimensional space. Compute the norm of the weight vector in the transformed higher dimensional space. Will your answer change if we use Soft margin SVM? Can we also compute the actual weight vector in the high dimensional space based on the given information? Explain how or why not. 1.(b) Quickly browse through the U.S. Bureau Of Labor Statistics’ Occupational Classification here: https://www.bls.gov/soc/2018/major_groups.htm Select 5 occupations from the list that have the most potential to be fully or partially automated using Machine Learning. Your next startup could actually fire-up from this analysis! 2.(a) Follow the tutorial on Naïve Bayes classifier at https://machinelearningmastery.com/naive-bayes-classifier-scratch-python/ Write your own code for Naïve Bayes Classification of the UCLA admissions dataset Download from https://stats.idre.ucla.edu/stat/data/binary.csv Comment on the performance of Naïve Bayes over Logistic Regression based on your observations. 2.(b) Assume there’s a data set that has just three columns (two features and one label) and four rows (items). The four vectors corresponding to the items are at the corners of a square. The two vectors at the ends of one diagonal of this square belong to one class and the other two vectors on the other diagonal belong to the second class. Is this data separable by a straight line? Which algorithm that you studied in the class would you choose if you were to come up with a classifier for this toy data set and why? Give some insights into how the algorithm will work on this kind of a data set. 3.(a) Refer to online tutorials on K-NN implementation such as https://machinelearningmastery.com/tutorial-to-implement-k-nearest-neighbors-in-python-from-scratch/ Extend the implementation to use various distance metrics such as Manhattan distance and note if the classification changes with the distance metric (for an more exhaustive list of distances, see getDistMethods() in R). Choose one of the cleaned datasets at https://www.kaggle.com/annavictoria/ml-friendly-public-datasets 3.(b) [5 points] In K-NN, we ignored the direction component of the vectorized representation of data items and only considered the distance. Does it make sense to also consider the direction of the nearest neighbor in addition to or instead of the distance from it? Why or why not?
Answered 2 days AfterOct 17, 2021

Answer To: For the following assignments, please provide as much evidence of the results as possible, including...

Sathishkumar answered on Oct 20 2021
132 Votes
solutions/binary.csv
admit,gre,gpa,rank
0,380,3.61,3
1,660,3.67,3
1,800,4,1
1,640,3.19,4
0,520,2.93,4
1,760,3,2
1,560,2.98,1
0,400,3.08,2
1,540,3.39,3
0,700,3.92,2
0,800,4,4
0,440,3.22,1
1,760,4,1
0,700,3.08,2
1,700,4,1
0,480,3.44,3
0,780,3.87,4
0,360,2.56,3
0,800,3.75,2
1,540,3.81,1
0,500,3.17,3
1,660,3.63,2
0,600,2.82,4
0,680,3.19,4
1,760,3.35,2
1,800,3.66,1
1,620,3.61,1
1,520,3.74,4
1,780,3.22,2
0,520,3.29,1
0,540,3.78,4
0,760,3.35,3
0,600,3.4,3
1,800,4,3
0,360,3.14,1
0,400,3.05,2
0,580,3.25,1
0,520,2.9,3
1,500,3.13,2
1,520,2.68,3
0,560,2.42,2
1,580,3.32,2
1,600,3.15,2
0,500,3.31,3
0,700,2.94,2
1,460,3.45,3
1,580,3.46,2
0,500,2.97,4
0,440,2.48,4
0,400,3.35,3
0,640,3.86,3
0,440,3.13,4
0,740,3.37,4
1,680,3.27,2
0,660,3.34,3
1,740,4,3
0,560,3.19,3
0,380,2.94,3
0,400,3.65,2
0,600,2.82,4
1,620,3.18,2
0,560,3.32,4
0,640,3.67,3
1,680,3.85,3
0,580,4,3
0,600,3.59,2
0,740,3.62,4
0,620,3.3,1
0,580,3.69,1
0,800,3.73,1
0,640,4,3
0,300,2.92,4
0,480,3.39,4
0,580,4,2
0,720,3.45,4
0,720,4,3
0,560,3.36,3
1,800,4,3
0,540,3.12,1
1,620,4,1
0,700,2.9,4
0,620,3.07
,2
0,500,2.71,2
0,380,2.91,4
1,500,3.6,3
0,520,2.98,2
0,600,3.32,2
0,600,3.48,2
0,700,3.28,1
1,660,4,2
0,700,3.83,2
1,720,3.64,1
0,800,3.9,2
0,580,2.93,2
1,660,3.44,2
0,660,3.33,2
0,640,3.52,4
0,480,3.57,2
0,700,2.88,2
0,400,3.31,3
0,340,3.15,3
0,580,3.57,3
0,380,3.33,4
0,540,3.94,3
1,660,3.95,2
1,740,2.97,2
1,700,3.56,1
0,480,3.13,2
0,400,2.93,3
0,480,3.45,2
0,680,3.08,4
0,420,3.41,4
0,360,3,3
0,600,3.22,1
0,720,3.84,3
0,620,3.99,3
1,440,3.45,2
0,700,3.72,2
1,800,3.7,1
0,340,2.92,3
1,520,3.74,2
1,480,2.67,2
0,520,2.85,3
0,500,2.98,3
0,720,3.88,3
0,540,3.38,4
1,600,3.54,1
0,740,3.74,4
0,540,3.19,2
0,460,3.15,4
1,620,3.17,2
0,640,2.79,2
0,580,3.4,2
0,500,3.08,3
0,560,2.95,2
0,500,3.57,3
0,560,3.33,4
0,700,4,3
0,620,3.4,2
1,600,3.58,1
0,640,3.93,2
1,700,3.52,4
0,620,3.94,4
0,580,3.4,3
0,580,3.4,4
0,380,3.43,3
0,480,3.4,2
0,560,2.71,3
1,480,2.91,1
0,740,3.31,1
1,800,3.74,1
0,400,3.38,2
1,640,3.94,2
0,580,3.46,3
0,620,3.69,3
1,580,2.86,4
0,560,2.52,2
1,480,3.58,1
0,660,3.49,2
0,700,3.82,3
0,600,3.13,2
0,640,3.5,2
1,700,3.56,2
0,520,2.73,2
0,580,3.3,2
0,700,4,1
0,440,3.24,4
0,720,3.77,3
0,500,4,3
0,600,3.62,3
0,400,3.51,3
0,540,2.81,3
0,680,3.48,3
1,800,3.43,2
0,500,3.53,4
1,620,3.37,2
0,520,2.62,2
1,620,3.23,3
0,620,3.33,3
0,300,3.01,3
0,620,3.78,3
0,500,3.88,4
0,700,4,2
1,540,3.84,2
0,500,2.79,4
0,800,3.6,2
0,560,3.61,3
0,580,2.88,2
0,560,3.07,2
0,500,3.35,2
1,640,2.94,2
0,800,3.54,3
0,640,3.76,3
0,380,3.59,4
1,600,3.47,2
0,560,3.59,2
0,660,3.07,3
1,400,3.23,4
0,600,3.63,3
0,580,3.77,4
0,800,3.31,3
1,580,3.2,2
1,700,4,1
0,420,3.92,4
1,600,3.89,1
1,780,3.8,3
0,740,3.54,1
1,640,3.63,1
0,540,3.16,3
0,580,3.5,2
0,740,3.34,4
0,580,3.02,2
0,460,2.87,2
0,640,3.38,3
1,600,3.56,2
1,660,2.91,3
0,340,2.9,1
1,460,3.64,1
0,460,2.98,1
1,560,3.59,2
0,540,3.28,3
0,680,3.99,3
1,480,3.02,1
0,800,3.47,3
0,800,2.9,2
1,720,3.5,3
0,620,3.58,2
0,540,3.02,4
0,480,3.43,2
1,720,3.42,2
0,580,3.29,4
0,600,3.28,3
0,380,3.38,2
0,420,2.67,3
1,800,3.53,1
0,620,3.05,2
1,660,3.49,2
0,480,4,2
0,500,2.86,4
0,700,3.45,3
0,440,2.76,2
1,520,3.81,1
1,680,2.96,3
0,620,3.22,2
0,540,3.04,1
0,800,3.91,3
0,680,3.34,2
0,440,3.17,2
0,680,3.64,3
0,640,3.73,3
0,660,3.31,4
0,620,3.21,4
1,520,4,2
1,540,3.55,4
1,740,3.52,4
0,640,3.35,3
1,520,3.3,2
1,620,3.95,3
0,520,3.51,2
0,640,3.81,2
0,680,3.11,2
0,440,3.15,2
1,520,3.19,3
1,620,3.95,3
1,520,3.9,3
0,380,3.34,3
0,560,3.24,4
1,600,3.64,3
1,680,3.46,2
0,500,2.81,3
1,640,3.95,2
0,540,3.33,3
1,680,3.67,2
0,660,3.32,1
0,520,3.12,2
1,600,2.98,2
0,460,3.77,3
1,580,3.58,1
1,680,3,4
1,660,3.14,2
0,660,3.94,2
0,360,3.27,3
0,660,3.45,4
0,520,3.1,4
1,440,3.39,2
0,600,3.31,4
1,800,3.22,1
1,660,3.7,4
0,800,3.15,4
0,420,2.26,4
1,620,3.45,2
0,800,2.78,2
0,680,3.7,2
0,800,3.97,1
0,480,2.55,1
0,520,3.25,3
0,560,3.16,1
0,460,3.07,2
0,540,3.5,2
0,720,3.4,3
0,640,3.3,2
1,660,3.6,3
1,400,3.15,2
1,680,3.98,2
0,220,2.83,3
0,580,3.46,4
1,540,3.17,1
0,580,3.51,2
0,540,3.13,2
0,440,2.98,3
0,560,4,3
0,660,3.67,2
0,660,3.77,3
1,520,3.65,4
0,540,3.46,4
1,300,2.84,2
1,340,3,2
1,780,3.63,4
1,480,3.71,4
0,540,3.28,1
0,460,3.14,3
0,460,3.58,2
0,500,3.01,4
0,420,2.69,2
0,520,2.7,3
0,680,3.9,1
0,680,3.31,2
1,560,3.48,2
0,580,3.34,2
0,500,2.93,4
0,740,4,3
0,660,3.59,3
0,420,2.96,1
0,560,3.43,3
1,460,3.64,3
1,620,3.71,1
0,520,3.15,3
0,620,3.09,4
0,540,3.2,1
1,660,3.47,3
0,500,3.23,4
1,560,2.65,3
0,500,3.95,4
0,580,3.06,2
0,520,3.35,3
0,500,3.03,3
0,600,3.35,2
0,580,3.8,2
0,400,3.36,2
0,620,2.85,2
1,780,4,2
0,620,3.43,3
1,580,3.12,3
0,700,3.52,2
1,540,3.78,2
1,760,2.81,1
0,700,3.27,2
0,720,3.31,1
1,560,3.69,3
0,720,3.94,3
1,520,4,1
1,540,3.49,1
0,680,3.14,2
0,460,3.44,2
1,560,3.36,1
0,480,2.78,3
0,460,2.93,3
0,620,3.63,3
0,580,4,1
0,800,3.89,2
1,540,3.77,2
1,680,3.76,3
1,680,2.42,1
1,620,3.37,1
0,560,3.78,2
0,560,3.49,4
0,620,3.63,2
1,800,4,2
0,640,3.12,3
0,540,2.7,2
0,700,3.65,2
1,540,3.49,2
0,540,3.51,2
0,660,4,1
1,480,2.62,2
0,420,3.02,1
1,740,3.86,2
0,580,3.36,2
0,640,3.17,2
0,640,3.51,2
1,800,3.05,2
1,660,3.88,2
1,600,3.38,3
1,620,3.75,2
1,460,3.99,3
0,620,4,2
0,560,3.04,3
0,460,2.63,2
0,700,3.65,2
0,600,3.89,3
solutions/heart.csv
Age,Sex,ChestPainType,RestingBP,Cholesterol,FastingBS,Re1ingECG,MaxHR,ExerciseA0gi0a,Oldpeak,ST_Slope,HeartDisease
40,0,0,140,289,0,0,172,0,0,1,0
49,1,1,160,180,0,0,156,0,1,0,1
37,0,0,130,283,0,1,98,0,0,1,0
48,1,2,138,214,0,0,108,1,1.5,0,1
54,0,1,150,195,0,0,122,0,0,1,0
39,0,1,120,339,0,0,170,0,0,1,0
45,1,0,130,237,0,0,170,0,0,1,0
54,0,0,110,208,0,0,142,0,0,1,0
37,0,2,140,207,0,0,130,1,1.5,0,1
48,1,0,120,284,0,0,120,0,0,1,0
37,1,1,130,211,0,0,142,0,0,1,0
58,0,0,136,164,0,1,99,1,2,0,1
39,0,0,120,204,0,0,145,0,0,1,0
49,0,2,140,234,0,0,140,1,1,0,1
42,1,1,115,211,0,1,137,0,0,1,0
54,1,0,120,273,0,0,150,0,1.5,0,0
38,0,2,110,196,0,0,166,0,0,0,1
43,1,0,120,201,0,0,165,0,0,1,0
60,0,2,100,248,0,0,125,0,1,0,1
36,0,0,120,267,0,0,160,0,3,0,1
43,1,3,100,223,0,0,142,0,0,1,0
44,0,0,120,184,0,0,142,0,1,0,0
49,1,0,124,201,0,0,164,0,0,1,0
44,0,0,150,288,0,0,150,1,3,0,1
40,0,1,130,215,0,0,138,0,0,1,0
36,0,1,130,209,0,0,178,0,0,1,0
53,0,2,124,260,0,1,112,1,3,0,0
52,0,0,120,284,0,0,118,0,0,1,0
53,1,0,113,468,0,0,127,0,0,1,0
51,0,0,125,188,0,0,145,0,0,1,0
53,0,1,145,518,0,0,130,0,0,0,1
56,0,1,130,167,0,0,114,0,0,1,0
54,0,2,125,224,0,0,122,0,2,0,1
41,0,2,130,172,0,1,130,0,2,0,1
43,1,0,150,186,0,0,154,0,0,1,0
32,0,0,125,254,0,0,155,0,0,1,0
65,0,2,140,306,1,0,87,1,1.5,0,1
41,1,0,110,250,0,1,142,0,0,1,0
48,1,0,120,177,1,1,148,0,0,1,0
48,1,2,150,227,0,0,130,1,1,0,0
54,1,0,150,230,0,0,130,0,0,1,0
54,1,1,130,294,0,1,100,1,0,0,1
35,0,0,150,264,0,0,168,0,0,1,0
52,0,1,140,259,0,1,170,0,0,1,0
43,0,2,120,175,0,0,120,1,1,0,1
59,0,1,130,318,0,0,120,1,1,0,0
37,0,2,120,223,0,0,168,0,0,1,0
50,0,0,140,216,0,0,170,0,0,1,0
36,0,1,112,340,0,0,184,0,1,0,0
41,0,2,110,289,0,0,170,0,0,0,1
50,0,2,130,233,0,0,121,1,2,0,1
47,1,2,120,205,0,0,98,1,2,0,1
45,0,0,140,224,1,0,122,0,0,1,0
41,1,0,130,245,0,0,150,0,0,1,0
52,1,2,130,180,0,0,140,1,1.5,0,0
51,1,0,160,194,0,0,170,0,0,1,0
31,0,2,120,270,0,0,153,1,1.5,0,1
58,0,1,130,213,0,1,140,0,0,0,1
54,0,2,150,365,0,1,134,0,1,1,0
52,0,2,112,342,0,1,96,1,1,0,1
49,0,0,100,253,0,0,174,0,0,1,0
43,1,1,150,254,0,0,175,0,0,1,0
45,0,2,140,224,0,0,144,0,0,1,0
46,0,2,120,277,0,0,125,1,1,0,1
50,1,0,110,202,0,0,145,0,0,1,0
37,1,0,120,260,0,0,130,0,0,1,0
45,1,2,132,297,0,0,144,0,0,1,0
32,0,0,110,225,0,0,184,0,0,1,0
52,0,2,160,246,0,1,82,1,4,0,1
44,0,2,150,412,0,0,170,0,0,1,0
57,0,0,140,265,0,1,145,1,1,0,1
44,0,0,130,215,0,0,135,0,0,1,0
52,0,2,120,182,0,0,150,0,0,0,1
44,1,2,120,218,0,1,115,0,0,1,0
55,0,2,140,268,0,0,128,1,1.5,0,1
46,0,1,150,163,0,0,116,0,0,1,0
32,0,2,118,529,0,0,130,0,0,0,1
35,1,2,140,167,0,0,150,0,0,1,0
52,0,0,140,100,0,0,138,1,0,1,0
49,0,2,130,206,0,0,170,0,0,0,1
55,0,1,110,277,0,0,160,0,0,1,0
54,0,0,120,238,0,0,154,0,0,1,0
63,0,2,150,223,0,0,115,0,0,0,1
52,0,0,160,196,0,0,165,0,0,1,0
56,0,2,150,213,1,0,125,1,1,0,1
66,0,2,140,139,0,0,94,1,1,0,1
65,0,2,170,263,1,0,112,1,2,0,1
53,1,0,140,216,0,0,142,1,2,0,0
43,0,3,120,291,0,1,155,0,0,0,1
55,0,2,140,229,0,0,110,1,0.5,0,0
49,1,0,110,208,0,0,160,0,0,1,0
39,0,2,130,307,0,0,140,0,0,1,0
52,1,0,120,210,0,0,148,0,0,1,0
48,0,2,160,329,0,0,92,1,1.5,0,1
39,1,1,110,182,0,1,180,0,0,1,0
58,0,2,130,263,0,0,140,1,2,0,1
43,0,0,142,207,0,0,138,0,0,1,0
39,0,1,160,147,1,0,160,0,0,1,0
56,0,2,120,85,0,0,140,0,0,1,0
41,0,0,125,269,0,0,144,0,0,1,0
65,0,2,130,275,0,1,115,1,1,0,1
51,0,2,130,179,0,0,100,0,0,1,0
40,1,2,150,392,0,0,130,0,2,0,1
40,0,2,120,466,1,0,152,1,1,0,1
46,0,2,118,186,0,0,124,0,0,0,1
57,0,0,140,260,1,0,140,0,0,1,0
48,1,2,120,254,0,1,110,0,0,1,0
34,0,0,150,214,0,1,168,0,0,1,0
50,0,2,140,129,0,0,135,0,0,1,0
39,0,0,190,241,0,0,106,0,0,1,0
59,1,0,130,188,0,0,124,0,1,0,0
57,0,2,150,255,0,0,92,1,3,0,1
47,0,2,140,276,1,0,125,1,0,1,0
38,0,0,140,297,0,0,150,0,0,1,0
49,1,1,130,207,0,1,135,0,0,1,0
33,1,2,100,246,0,0,150,1,1,0,1
38,0,2,120,282,0,0,170,0,0,0,1
59,1,2,130,338,1,1,130,1,1.5,0,1
35,1,3,120,160,0,1,185,0,0,1,0
34,0,3,140,156,0,0,180,0,0,0,1
47,1,1,135,248,1,0,170,0,0,0,1
52,1,1,125,272,0,0,139,0,0,1,0
46,0,2,110,240,0,1,140,0,0,1,0
58,1,0,180,393,0,0,110,1,1,0,1
58,0,0,130,230,0,0,150,0,0,1,0
54,0,0,120,246,0,0,110,0,0,1,0
34,1,0,130,161,0,0,190,0,0,1,0
48,1,2,108,163,0,0,175,0,2,1,0
54,1,0,120,230,1,0,140,0,0,1,0
42,0,1,120,228,0,0,152,1,1.5,0,0
38,0,1,145,292,0,0,130,0,0,1,0
46,0,2,110,202,0,0,150,1,0,0,1
56,0,2,170,388,0,1,122,1,2,0,1
56,0,2,150,230,0,1,124,1,1.5,0,1
61,1,2,130,294,0,1,120,1,1,0,0
49,0,1,115,265,0,0,175,0,0,0,1
43,1,0,120,215,0,1,175,0,0,1,0
39,0,0,120,241,0,1,146,0,2,1,0
54,0,2,140,166,0,0,118,1,0,0,1
43,0,2,150,247,0,0,130,1,2,0,1
52,0,2,160,331,0,0,94,1,2.5,0,1
50,0,2,140,341,0,1,125,1,2.5,0,1
47,0,2,160,291,0,1,158,1,3,0,1
53,0,2,140,243,0,0,155,0,0,1,0
56,1,0,120,279,0,0,150,0,1,0,1
39,0,2,110,273,0,0,132,0,0,1,0
42,0,0,120,198,0,0,155,0,0,1,0
43,1,0,120,249,0,1,176,0,0,1,0
50,0,0,120,168,0,0,160,0,0,1,0
54,0,2,130,603,1,0,125,1,1,0,1
39,0,0,130,215,0,0,120,0,0,1,0
48,0,0,100,159,0,0,100,0,0,1,0
40,0,0,130,275,0,0,150,0,0,1,0
55,0,2,120,270,0,0,140,0,0,1,0
41,0,0,120,291,0,1,160,0,0,1,0
56,0,2,155,342,1,0,150,1,3,0,1
38,0,2,110,190,0,0,150,1,1,0,1
49,0,2,140,185,0,0,130,0,0,1,0
44,0,2,130,290,0,0,100,1,2,0,1
54,0,0,160,195,0,1,130,0,1,1,0
59,0,2,140,264,1,2,119,1,0,0,1
49,0,2,128,212,0,0,96,1,0,0,1
47,0,0,160,263,0,0,174,0,0,1,0
42,0,0,120,196,0,0,150,0,0,1,0
52,1,0,140,225,0,0,140,0,0,1,0
46,0,3,140,272,1,0,175,0,2,0,1
50,0,2,140,231,0,1,140,1,5,0,1
48,0,0,140,238,0,0,118,0,0,1,0
58,0,2,135,222,0,0,100,0,0,1,0
58,0,1,140,179,0,0,160,0,0,1,0
29,0,0,120,243,0,0,160,0,0,1,0
40,0,1,140,235,0,0,188,0,0,1,0
53,0,0,140,320,0,0,162,0,0,1,0
49,0,1,140,187,0,0,172,0,0,1,0
52,0,2,140,266,0,0,134,1,2,0,1
43,0,2,140,288,0,0,135,1,2,0,1
54,0,2,140,216,0,0,105,0,1.5,0,1
59,0,0,140,287,0,0,150,0,0,1,0
37,0,1,130,194,0,0,150,0,0,1,0
46,1,2,130,238,0,0,90,0,0,1,0
52,0,2,...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here