Question: # define svm _ init function to initialize the model weight def svm _ init ( X _ train, y _ train ) : #

# define svm_init function to initialize the model weight
def svm_init(X_train, y_train):
# Utilizing the shape information of training dataset to determine the shape of the model weight:
# %%%%%%%%%%%%%% implement your code below (2 lines)%%%%%%%%%%%%%%
num_train, data_dim = #implement the total number of training samples and the dimension of data
num_classes = # implement the number of total classes
# %%%%%%%%%%%%%% your code ends here %%%%%%%%%%%%%%
# Based on the shape information, initialize the weight with random value.
# %%%%%%%%%%%%%% implement your code below (1 line)%%%%%%%%%%%%%%
W = #implement the intialize weight as a tensor of (data_dim,num_classe) and consider ato initiate with really small value(1e-4)
# %%%%%%%%%%%%%% your code ends here %%%%%%%%%%%%%%
return W

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!