Question: Please write the code without using any packages The Iris flower dataset (https://en.wikipedia.org/wiki/lris_flower_data_set) was organized by Ronald Fisher in 1936. It is a commonly used


Please write the code without using any packages
The Iris flower dataset (https://en.wikipedia.org/wiki/lris_flower_data_set) was organized by Ronald Fisher in 1936. It is a commonly used dataset for introductory machine learning concepts. You will use this dataset for fitting and evaluating your regression model. The training and testing should be contained in a single evaluation script so that the results can be easily reproduced. 2.1 Preparing the Data Much of machine learning is in understanding the data you are working with. For our regression task, we want to predict continuous outputs given some input feature(s). Each sample in the lris dataset has 4 features: sepal length - sepal width - petal length - petal width We may want to know which feature is most predictive of another. Does knowledge of the sepal length provide good estimates of the sepal width? What about the petal width? What if we use the sepal length and width to predict the petal length or width? In this section of the assignment, you will create 4 different regression models to answer some of these questions. This will be trivial to do once the code for the model is finished. To begin, load the data using scikit-learn. In order to verify the models that you will create in the following two sections, you will need to take some portion of the dataset and reserve it for testing. Randomly select 10% of the dataset, ensuring an even split of each class. This will be your test set. Note that this is different than the random 10% that is taken from the training set when in the fit method. The rest of the data will serve as your training set. Select 4 different combinations of input and output features to use to train 4 different models. For example, one model could predict the petal width given petal length and sepal width. Another could predict sepal length using only petal features. It does not matter which combination you choose as long as you have 4 unique combinations. Your models should be trained using batch gradient descent with a batch size (optional parameter) of 32 using mean squared error as your loss function. For each model, train for n=100 steps (optional parameter) OR until the loss on the validation set increases for a number of consecutive epochs determined by patience (default to 3 ). As each model trains, record the loss averaged over the batch size for each step. A single step is the processing of a single batch. 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. After each model trains, plot the loss against the step number and save it. These plots should also be added to your report. 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. Record these values into your report so they can be verified. 2.3 Testing For each model you created, test its performance on unseen data by evaluating the mean squared error against the test dataset that you set aside previously. In your report, briefly describe which input feature is most predictive of its corresponding output feature based on your experiments
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
