Tell us about your homework assignment.

#### Place your order

Fill in the order form and provide all details of your assignment.

#### Proceed with the payment

#### Receive the final file

# We ask you to implement three small and separate machine learning models. We pro

**GET HELP WITH YOUR ESSAY**

**If you need assistance with writing your essay, our professional Essay Writing Service is here to help! **

**DISCOUNT CODE FIRST25**

ORDER THIS OR A SIMILAR PAPER NOW

We ask you to implement three small and separate machine learning models. We provide sample input/output file pairs for your reference. The file plot_db.py contains two functions for plotting data which you may choose to use, modify, reference and steal ideas from at will.

1. Perceptron

2. Linear Regression

Note: The Python Pandas library helps simplify a lot of the intermediate steps we ask from you below. Key functions includereading and writing to CSVs, matrix operations, and visualizing data. Examples are provided in plot_db.py.

1. Perceptron

Implement the perceptron learning algorithm (PLA) for a linearly separable dataset. Your starter code includes data1.csv , where each line contains feature_1, feature-2, label. All values are numeric with labels 1 or -1. Take a look at the data input file. We suggest using matplotlib or pandas.DataFrame.plot (in plot_db.py) to view data, and pandas. DataFrame. describe to see stats.

Write your PLA in pla.py in Python 3. Yom program takes a csv of input data and a location to write the output csv with the weights from each iteration of your PLA, written as weight_1, weight_2, b. The weights in the last line of your output csv defines the decision boundary computed for the given dataset. Formatting is shown in results1. csv.

NOTE: results1. csvvalues are pmely filler and not representative of the values you should get. Feel free to visualize and include a screenshot of your final decision boundary in your README, like the one below:

30

20

10

0

-10

-20

-300 2 4 6 8 10 12 14 16

We will execute your code as follows: $ python pla.py datal.csvresultsl.csv

2. Linear Regression

Use gradient descent to build a linear regression model for predicting height (m) using age (yr) and weight (kg), using data derived from CDC growth charts data.

1

Data Preparation and Normalization Load and understand the data from data2.csv[age(years), weight(kg), height(m)] remembering to add a vector column for the intercept at the front of your matrix. You’ll notice the features are not on the same scale. What is the mean and standard deviation of each feature? Scale each feature (i.e. age and weight) by its standard deyjation, so each scaled feature has a mean of zero. You do not need to scale the intercept. For each feature column, x, use the following formula:

x-µ(x)

Xscaled = O”(x)

Gradient Descent Implement gradient descent to find a regression model in lr.py. Initialize your (3s to zero. Recall the empirical risk and gradient descent rule as follows:

You will run gradient descent with these nine learning rates: a E 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 5, 10 exactly 100 iterations per a-value, plus a tenth rate and number of iterations of your choice. To pick the tenth rate and loop count, observe how a affects the rate of convergence for the nine rates listed, then pick a rate and loop count you believe will perform well. Briefly explain your choice in your README.

The program should generate an output file containing ten lines, one for each (a, numjters) hyperparameter pair. Each line contains: a, num_i ters, bias, b_age, b_weight, expressed to your choice of decimal places (sec exampleresults2. csvin your starter code). Each line of this file defines the regression model your gradient descent method computed on the given data and hyperparameters.

We will execute your code as follows: $ python lr. py data2. csvresul ts2. csv

Optional: Visualize the result of each linear regression model in three-dimensional space. You can plot each feature on the xy-plane, and plot the regression equation as a plane in xyz-space. Include these visualizations in your README file and label each one appropriately. Ex:

1.5

1.4

1.2}

l.l

1.-i0

0.9 :r::

0.8

0.7

4045

35 ‘ii

30 (Ii

25•:-_O

20

15

**GET HELP WITH YOUR ESSAY**

**If you need assistance with writing your essay, our professional Essay Writing Service is here to help! **

**DISCOUNT CODE FIRST25**

### How It Works

Securely pay for your academic paper

Paper gets assigned to an expert tutor

Receive the complete paper via email

# Team up With Your Own Writing Expert Now

Stuck with overwhelming assignments? We will take care of all your writing tasks.