Linear Regression on iris dataset

Job ID: 34540638

Budget: $30 – $250 USD

This covers Linear Regression. Dataset (https://en.wikipedia.org/wiki/Iris_flower_data_set). Randomly select 10% of the dataset, ensuring an even split of each class. This will be your test set. The rest of the data will serve as your training set.
Your implementation should define a class for LinearRegression which includes at least a fit and predict method. Additional methods can be added as you see fit.

The fit method should accept 2 parameters:

the input data
and the target values.
Other parameters can be added as long as they are optional.

You will use this class to train and compare 6 models. Each model should use a different set of input features and outputs. You can pick any combinations you would like. For example, one model could use the petal width of setosa samples to predict the petal length.

You might also try to combine the petal length feature from all iris samples to predict petal width. However, you should ask whether or not combining features from different types of iris would work. The distribution of petal lengths is different between each of the three types. A possible solution to this would be to normalize the data. One normalization technique would be to subtract the mean sample from each of the sample in the dataset and divide by the standard deviation of the data. You could apply this strategy to the entire training set, or normalize the data on a per-class basis. models should be trained using batch gradient descent with a batch size (optional parameter) of 32. Use mean squared error as your loss function. For each model, train for 100 steps (optional parameter). As each model trains, record the loss average over the batch size against the current step number. One way to save this data is to either return an array from the fit method or save it as an internal class member that can be retrieved after training is complete. Plot the loss against the step number and save it. To observe the effects of regularization, pick one of your trained models and inspect the weights. Train an identical model again, except this time you will add L2 regularization to the loss. Record the difference in parameters between the regularized and non-regularized model. In your report, include the weight values in this comparison.
Related categories: Python Machine Learning (ML)