Home / Expert Answers / Computer Science / requirement-1-use-the-same-functions-create-toy-datao-and-fo-from-assignment-1-task-one-to-gene-pa826

(Solved): Requirement 1. Use the same functions(create toy_dataO and fO) from assignment 1 , task one to gene ...




Requirement
1. Use the same functions(create toy_dataO and \( \mathrm{fO}) \) from assignment 1 , task one to generate 10 dat
Requirement 1. Use the same functions(create toy_dataO and from assignment 1 , task one to generate 10 data for training,and 100 samples for testing. 2. Use polynomial basis function(PolynomialFeatures0 from sklearn) to convert your training and testing data into matrix Phi. Set polynomial order 3. Now we want to study the dual representation for the following error function: (Hint you can use LinearRegression 0 from sklearn to train this model) Take a careful look at this loss, if you want to use LinearRegression0, you might want to change some of its default settings. Train the model using your Phi matrix, save the predictions on the test data. and report the test MSE. 4. Now use the dual model(the kemel representation) to make the prediction on the test data. You need to first compute the Gram matrix , and the vector . Your prediction rule should be similar, but not identical, to eq 6.9 from the textbook. Save the predictions on the test data. and report the test MSE. 5. Compare the predictions from 4 and 5 , are they identical? Why or why not?


We have an Answer from Expert

View Expert Answer

Expert Answer



Solution:
Using the create_toy_data() and f() functions from assignment 1, task one to generate 10 data for training, and 100 samples for testing.


import numpy as np
import random

# Function to generate toy data
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe