Consider the dataset given below. learn a classifier on this dataset using the kernel trick and gradient descent.
import scipy.io
import matplotlib.pyplot as plt
data1 = scipy.io.loadmat('data1_ex1.mat')['data1_ex1']
data2 = scipy.io.loadmat('data2_ex1.mat')['data2_ex1']
plt.scatter(data1[:,0], data1[:,1], c='r')
plt.scatter(data2[:,0], data2[:,1], c='b')
plt.show()
Detect the clusters from the dataset given below using :
import scipy.io
import matplotlib.pyplot as plt
data = scipy.io.loadmat('data_ex2.mat')['data_ex2']
plt.scatter(data[:,0], data[:,1])
plt.show()
Consider the regression problem given below. we want to learn the line that best predicts the targets stored in 'ex3_targets' from the features given in 'ex3_data'. Apply a best subset selection approach coupled with cross validation to determine the best feature subset for the model. For each $K=1, \ldots 5$ plot the minimum prediction error across the subsets of size K.
import numpy as np
import matplotlib.pyplot as plt
ex3_data = np.load('ex3_data.npy')
ex3_targets = np.load('ex3_targets.npy')
Using the dataset given below:
import scipy.io
import matplotlib.pyplot as plt
data1 = scipy.io.loadmat('data_ex4_class1.mat')['data_ex4_class1']
data2 = scipy.io.loadmat('data_ex4_class2.mat')['data_ex4_class2']
plt.scatter(data1[:,0], data1[:,1], c='r')
plt.scatter(data2[:,0], data2[:,1], c='b')
plt.show()
Find the different clusters in the dataset below using the EM algorithm
import scipy.io
import matplotlib.pyplot as plt
data = scipy.io.loadmat('data_ex5.mat')['data_ex5']
plt.scatter(data[:,0], data[:,1])
plt.show()