[Solved] CSC7343 Homework2-Character_Level_LSTM

$25

File Name: CSC7343_Homework2_Character_Level_LSTM.zip
File Size: 357.96 KB

SKU: [Solved] CSC7343 Homework2-Character_Level_LSTM Category: Tag:
5/5 - (1 vote)

Your tasks in this homework are to build a character level LSTM network: 1) to generate (English) names; 2) to determine whether a string of characters is a (English) name.

Download training data:

https://catalog.data.gov/dataset/babynamesfromsocialsecuritycardapplicationsnationalleveldata

Use the names in the file for the year 2018 as your training data. (You may further reduce the number of names by randomly sampling 5000 names to use as training data.)

Task 1: Implement a LSTM network with the following structure. (The LSTM layer has 128 cells).

Note that a name (string of characters) is used both as input and output in training. (You should add a special character to each name string, which serves as a mark to indicate the end of the string.) Use an all zero vector for X<0> and the initial state of the LSTM should be all zeros too. Train the model with crossentropy loss from the softmax outputs at all (valid) steps.

  • Describe in the notebook how you train the model using batches of names. (Note that different names may have different length.)
  • After training the model, you can sample (generate names) using the model. Implement the following process to generate a name using the trained model. You should have a function generate_name() defined on your notebook. Once the trained parameters are loaded into your model, each call to the function should generate a name (string).

Task 2: You can also use the LSTM model as a string classifier by removing the softmax layer and feeding the LSTM output from the last character of the name string to a sigmoid neuron, which then gives the probability whether the string is a name. Construct a dataset where the positive samples are the names you used in Task 1 and make same number of random strings as negative samples. Train the classifier model on the dataset using binary cross entropy.

1) Define a function is_real_name(S) on the notebook, where S is a string. Once the trained parameters are loaded into your model, this function can be called to determine whether a name S is real.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSC7343 Homework2-Character_Level_LSTM[Solved] CSC7343 Homework2-Character_Level_LSTM
$25