MCPcopy Create free account

hub / github.com/ankit-ai/cs224n-natural-language-processing-winter2019 / functions

Functions156 in github.com/ankit-ai/cs224n-natural-language-processing-winter2019

↓ 25 callersMethodload
Load vocabulary from JSON dump. @param file_path (str): file path to vocab file @returns Vocab object loaded from JSON dump
a4_neural_machine_translation_s2s_attention/vocab.py:187
↓ 11 callersMethodload
Load vocabulary from JSON dump. @param file_path (str): file path to vocab file @returns Vocab object loaded from JSON dump
a5_neural_machine_translation_convnet_subword/vocab.py:247
↓ 10 callersFunctionread_corpus
Read file, where each sentence is dilineated by a `\n`. @param file_path (str): path to file containing corpus @param source (str): "tgt" or
a4_neural_machine_translation_s2s_attention/utils.py:45
↓ 8 callersFunctionread_corpus
Read file, where each sentence is dilineated by a `\n`. @param file_path (str): path to file containing corpus @param source (str): "tgt" or
a5_neural_machine_translation_convnet_subword/utils.py:81
↓ 8 callersMethodsave
Save Vocab to file as JSON dump. @param file_path (str): file path to vocab file
a4_neural_machine_translation_s2s_attention/vocab.py:180
↓ 8 callersMethodwords2charindices
Convert list of words OR list of sentences of words into list of list of list of character indices. @param sents (list[str] or list[l
a5_neural_machine_translation_convnet_subword/vocab.py:117
↓ 7 callersMethodto_input_tensor_char
Convert list of sentences (words) into tensor with necessary padding for shorter sentences. @param sents (List[List[str]]): list of
a5_neural_machine_translation_convnet_subword/vocab.py:151
↓ 6 callersMethodto_input_tensor
Convert list of sentences (words) into tensor with necessary padding for shorter sentences. @param sents (List[List[str]]): list of
a4_neural_machine_translation_s2s_attention/vocab.py:118
↓ 5 callersMethodstep
Compute one forward step of the LSTM decoder, including the attention computation. @param Ybar_t (Tensor): Concatenated Tensor of [Y_t o_pre
a4_neural_machine_translation_s2s_attention/nmt_model.py:274
↓ 5 callersMethodupdate
(self, val, n=1)
a3_neural_dependency_parsing/utils/parser_utils.py:414
↓ 4 callersMethodencode
Apply the encoder to source sentences to obtain encoder hidden states. Additionally, take the final states of the encoder and project the
a4_neural_machine_translation_s2s_attention/nmt_model.py:125
↓ 4 callersFunctionreinitialize_layers
Reinitialize the Layer Weights for Sanity Checks.
a4_neural_machine_translation_s2s_attention/sanity_check.py:44
↓ 4 callersFunctionsgd
Stochastic Gradient Descent Implement the stochastic gradient descent method in this function. Arguments: f -- the function to optimize
a2_word2vec/sgd.py:41
↓ 4 callersFunctiontest_dependencies
Tests the provided dependencies match the expected dependencies
a3_neural_dependency_parsing/parser_transitions.py:197
↓ 3 callersFunctionbatch_iter
Yield batches of source and target sentences reverse sorted by length (largest to smallest). @param data (list of (src_sent, tgt_sent)): list of
a4_neural_machine_translation_s2s_attention/utils.py:62
↓ 3 callersMethoddecode
Compute combined output vectors for a batch. @param enc_hiddens (Tensor): Hidden states (b, src_len, h*2), where
a4_neural_machine_translation_s2s_attention/nmt_model.py:192
↓ 3 callersMethodforward
Apply the output of the convolution later (x_conv) through a highway network @param x (Tensor): Input x_cov gets applied to
a5_neural_machine_translation_convnet_subword/cnn.py:29
↓ 3 callersMethodparse_step
Performs a single parse step by applying the given transition to this partial parse @param transition (str): A string that equals "S", "LA",
a3_neural_dependency_parsing/parser_transitions.py:41
↓ 3 callersFunctionread_conll
(in_file, lowercase=False, max_example=None)
a3_neural_dependency_parsing/utils/parser_utils.py:290
↓ 3 callersMethodstep
Compute one forward step of the LSTM decoder, including the attention computation. @param Ybar_t (Tensor): Concatenated Tensor of [Y_t o_prev
a5_neural_machine_translation_convnet_subword/nmt_model.py:204
↓ 3 callersFunctiontest_step
Tests that a single parse step returns the expected output
a3_neural_dependency_parsing/parser_transitions.py:143
↓ 3 callersMethodvectorize
(self, examples)
a3_neural_dependency_parsing/utils/parser_utils.py:97
↓ 3 callersFunctionword2vec_sgd_wrapper
(word2vecModel, word2Ind, wordVectors, dataset, windowSize,
a2_word2vec/word2vec.py:199
↓ 2 callersFunction_minibatch
(data, minibatch_idx)
a3_neural_dependency_parsing/utils/general_utils.py:52
↓ 2 callersFunctionbatch_iter
Yield batches of source and target sentences reverse sorted by length (largest to smallest). @param data (list of (src_sent, tgt_sent)): list of
a5_neural_machine_translation_convnet_subword/utils.py:98
↓ 2 callersFunctionbuild_dict
(keys, n_max=None, offset=0)
a3_neural_dependency_parsing/utils/parser_utils.py:312
↓ 2 callersMethoddecode_greedy
Greedy decoding @param initialStates: initial internal state of the LSTM, a tuple of two tensors of size (1, batch, hidden_size) @par
a5_neural_machine_translation_convnet_subword/char_decoder.py:100
↓ 2 callersMethoddevice
Determine which device to place the Tensors upon, CPU or GPU.
a5_neural_machine_translation_convnet_subword/nmt_model.py:384
↓ 2 callersMethoddevice
Determine which device to place the Tensors upon, CPU or GPU.
a4_neural_machine_translation_s2s_attention/nmt_model.py:486
↓ 2 callersMethodencode
Apply the encoder to source sentences to obtain encoder hidden states. Additionally, take the final states of the encoder and project the
a5_neural_machine_translation_convnet_subword/nmt_model.py:137
↓ 2 callersMethodextract_features
(self, stack, buf, arcs, ex)
a3_neural_dependency_parsing/utils/parser_utils.py:111
↓ 2 callersMethodfrom_corpus
Given a corpus construct a Vocab Entry. @param corpus (list[str]): corpus of text produced by read_corpus function @param size (int):
a5_neural_machine_translation_convnet_subword/vocab.py:193
↓ 2 callersMethodfrom_corpus
Given a corpus construct a Vocab Entry. @param corpus (list[str]): corpus of text produced by read_corpus function @param size (int):
a4_neural_machine_translation_s2s_attention/vocab.py:133
↓ 2 callersMethodgenerate_sent_masks
Generate sentence masks for encoder hidden states. @param enc_hiddens (Tensor): encodings of shape (b, src_len, 2*h), where b = batch size,
a4_neural_machine_translation_s2s_attention/nmt_model.py:378
↓ 2 callersMethodlegal_labels
(self, stack, buf)
a3_neural_dependency_parsing/utils/parser_utils.py:233
↓ 2 callersFunctionminibatch_parse
Parses a list of sentences in minibatches using a model. @param sentences (list of list of str): A list of sentences to be parsed
a3_neural_dependency_parsing/parser_transitions.py:86
↓ 2 callersFunctionpad_sents_char
Pad list of sentences according to the longest sentence in the batch and max_word_length. @param sents (list[list[list[int]]]): list of sentences
a5_neural_machine_translation_convnet_subword/utils.py:19
↓ 2 callersMethodparse
(self, dataset, eval_batch_size=5000)
a3_neural_dependency_parsing/utils/parser_utils.py:239
↓ 2 callersMethodsave
Save Vocab to file as JSON dump. @param file_path (str): file path to vocab file
a5_neural_machine_translation_convnet_subword/vocab.py:240
↓ 2 callersFunctionsigmoid
Compute the sigmoid function for the input here. Arguments: x -- A scalar or numpy array. Return: s -- sigmoid(x)
a2_word2vec/word2vec.py:10
↓ 2 callersFunctionskipgram
Skip-gram model in word2vec Implement the skip-gram model in this function. Arguments: currentCenterWord -- a string of the current cen
a2_word2vec/word2vec.py:150
↓ 2 callersMethodtrain_forward
Forward computation during training. @param char_sequence: tensor of integers, shape (length, batch). Note that "length" here and in forward
a5_neural_machine_translation_convnet_subword/char_decoder.py:68
↓ 1 callersMethodadd
Add word to VocabEntry, if it is previously unseen. @param word (str): word to add to VocabEntry @return index (int): index that the
a5_neural_machine_translation_convnet_subword/vocab.py:105
↓ 1 callersMethodadd
Add word to VocabEntry, if it is previously unseen. @param word (str): word to add to VocabEntry @return index (int): index that the
a4_neural_machine_translation_s2s_attention/vocab.py:88
↓ 1 callersFunctionbeam_search
Run beam search to construct hypotheses for a list of src-language sentences. @param model (NMT): NMT Model @param test_data_src (List[List[s
a5_neural_machine_translation_convnet_subword/run.py:298
↓ 1 callersFunctionbeam_search
Run beam search to construct hypotheses for a list of src-language sentences. @param model (NMT): NMT Model @param test_data_src (List[List[s
a4_neural_machine_translation_s2s_attention/run.py:296
↓ 1 callersMethodbeam_search
Given a single source sentence, perform beam search, yielding translations in the target language. @param src_sent (List[str]): a single sour
a5_neural_machine_translation_convnet_subword/nmt_model.py:266
↓ 1 callersMethodbeam_search
Given a single source sentence, perform beam search, yielding translations in the target language. @param src_sent (List[str]): a single sour
a4_neural_machine_translation_s2s_attention/nmt_model.py:394
↓ 1 callersMethodbuild
Build Vocabulary. @param src_sents (list[str]): Source sentences provided by read_corpus() function @param tgt_sents (list[str]): Tar
a5_neural_machine_translation_convnet_subword/vocab.py:223
↓ 1 callersMethodbuild
Build Vocabulary. @param src_sents (list[str]): Source sentences provided by read_corpus() function @param tgt_sents (list[str]): Tar
a4_neural_machine_translation_s2s_attention/vocab.py:163
↓ 1 callersFunctioncompute_corpus_level_bleu_score
Given decoding results and reference sentences, compute corpus-level BLEU score. @param references (List[List[str]]): a list of gold-standard ref
a5_neural_machine_translation_convnet_subword/run.py:93
↓ 1 callersFunctioncompute_corpus_level_bleu_score
Given decoding results and reference sentences, compute corpus-level BLEU score. @param references (List[List[str]]): a list of gold-standard ref
a4_neural_machine_translation_s2s_attention/run.py:92
↓ 1 callersMethodcreate_instances
(self, examples)
a3_neural_dependency_parsing/utils/parser_utils.py:199
↓ 1 callersFunctiondecode
Performs decoding on a test set, and save the best-scoring decoding results. If the target gold-standard sentences are given, the function also c
a5_neural_machine_translation_convnet_subword/run.py:263
↓ 1 callersFunctiondecode
Performs decoding on a test set, and save the best-scoring decoding results. If the target gold-standard sentences are given, the function also c
a4_neural_machine_translation_s2s_attention/run.py:261
↓ 1 callersMethoddecode
Compute combined output vectors for a batch. @param enc_hiddens (Tensor): Hidden states (b, src_len, h*2), where
a5_neural_machine_translation_convnet_subword/nmt_model.py:163
↓ 1 callersMethodembedding_lookup
Utilize `self.pretrained_embeddings` to map input `t` from input tokens (integers) to embedding vectors. PyTorch Notes:
a3_neural_dependency_parsing/parser_model.py:82
↓ 1 callersFunctionevaluate_ppl
Evaluate perplexity on dev sentences @param model (NMT): NMT Model @param dev_data (list of (src_sent, tgt_sent)): list of tuples containing
a5_neural_machine_translation_convnet_subword/run.py:63
↓ 1 callersFunctionevaluate_ppl
Evaluate perplexity on dev sentences @param model (NMT): NMT Model @param dev_data (list of (src_sent, tgt_sent)): list of tuples containing
a4_neural_machine_translation_s2s_attention/run.py:62
↓ 1 callersMethodforward
Forward pass of character decoder. @param input: tensor of integers, shape (length, batch) @param dec_hidden: internal state of the
a5_neural_machine_translation_convnet_subword/char_decoder.py:40
↓ 1 callersMethodforward
Apply the output of the convolution later (x_conv) through a highway network @param x (Tensor): Input x_cov gets applied to
a5_neural_machine_translation_convnet_subword/highway.py:29
↓ 1 callersMethodgenerate_sent_masks
Generate sentence masks for encoder hidden states. @param enc_hiddens (Tensor): encodings of shape (b, src_len, 2*h), where b = batch size,
a5_neural_machine_translation_convnet_subword/nmt_model.py:250
↓ 1 callersFunctiongetNegativeSamples
Samples K indexes which are not the outsideWordIdx
a2_word2vec/word2vec.py:71
↓ 1 callersFunctionget_minibatches
Iterates through the provided data one minibatch at at time. You can use this function to iterate through data in minibatches as follows:
a3_neural_dependency_parsing/utils/general_utils.py:14
↓ 1 callersMethodget_oracle
(self, stack, buf, ex)
a3_neural_dependency_parsing/utils/parser_utils.py:171
↓ 1 callersFunctionload_and_preprocess_data
(reduced=True)
a3_neural_dependency_parsing/utils/parser_utils.py:350
↓ 1 callersFunctionload_saved_params
A helper function that loads previously saved parameters and resets iteration start.
a2_word2vec/sgd.py:12
↓ 1 callersFunctionmain
Main func.
a5_neural_machine_translation_convnet_subword/run.py:321
↓ 1 callersFunctionmain
Main func.
a5_neural_machine_translation_convnet_subword/sanity_check.py:290
↓ 1 callersFunctionmain
Main func.
a4_neural_machine_translation_s2s_attention/run.py:319
↓ 1 callersFunctionmain
Main func.
a4_neural_machine_translation_s2s_attention/sanity_check.py:190
↓ 1 callersFunctionminibatches
(data, batch_size)
a3_neural_dependency_parsing/utils/parser_utils.py:342
↓ 1 callersFunctionpad_sents
Pad list of sentences according to the longest sentence in the batch. @param sents (list[list[int]]): list of sentences, where each sentence
a5_neural_machine_translation_convnet_subword/utils.py:57
↓ 1 callersFunctionpad_sents
Pad list of sentences according to the longest sentence in the batch. @param sents (list[list[str]]): list of sentences, where each sentence
a4_neural_machine_translation_s2s_attention/utils.py:20
↓ 1 callersMethodparse
Applies the provided transitions to this PartialParse @param transitions (list of str): The list of transitions in the order they should be a
a3_neural_dependency_parsing/parser_transitions.py:72
↓ 1 callersMethodpredict
(self, partial_parses)
a3_neural_dependency_parsing/parser_transitions.py:192
↓ 1 callersFunctionpunct
(language, pos)
a3_neural_dependency_parsing/utils/parser_utils.py:322
↓ 1 callersFunctionquestion_1d_sanity_check
Sanity check for question 1d. Compares student output to that of model with dummy data.
a4_neural_machine_translation_s2s_attention/sanity_check.py:87
↓ 1 callersFunctionquestion_1e_sanity_check
Sanity check for words2charindices function.
a5_neural_machine_translation_convnet_subword/sanity_check.py:60
↓ 1 callersFunctionquestion_1e_sanity_check
Sanity check for question 1e. Compares student output to that of model with dummy data.
a4_neural_machine_translation_s2s_attention/sanity_check.py:117
↓ 1 callersFunctionquestion_1f_sanity_check
Sanity check for pad_sents_char() function.
a5_neural_machine_translation_convnet_subword/sanity_check.py:189
↓ 1 callersFunctionquestion_1f_sanity_check
Sanity check for question 1f. Compares student output to that of model with dummy data.
a4_neural_machine_translation_s2s_attention/sanity_check.py:153
↓ 1 callersFunctionquestion_1g_sanity_check
Sanity check for pad_sents_char() function.
a5_neural_machine_translation_convnet_subword/sanity_check.py:162
↓ 1 callersFunctionquestion_1h_sanity_check
Sanity check for highway network
a5_neural_machine_translation_convnet_subword/sanity_check.py:129
↓ 1 callersFunctionquestion_1i_sanity_check
Sanity check for highway network
a5_neural_machine_translation_convnet_subword/sanity_check.py:93
↓ 1 callersFunctionquestion_1j_sanity_check
Sanity check for model_embeddings.py basic shape check
a5_neural_machine_translation_convnet_subword/sanity_check.py:209
↓ 1 callersFunctionquestion_2a_sanity_check
Sanity check for CharDecoder.__init__() basic shape check
a5_neural_machine_translation_convnet_subword/sanity_check.py:226
↓ 1 callersFunctionquestion_2b_sanity_check
Sanity check for CharDecoder.forward() basic shape check
a5_neural_machine_translation_convnet_subword/sanity_check.py:242
↓ 1 callersFunctionquestion_2c_sanity_check
Sanity check for CharDecoder.train_forward() basic shape check
a5_neural_machine_translation_convnet_subword/sanity_check.py:260
↓ 1 callersFunctionquestion_2d_sanity_check
Sanity check for CharDecoder.decode_greedy() basic shape check
a5_neural_machine_translation_convnet_subword/sanity_check.py:274
↓ 1 callersMethodreset
(self)
a3_neural_dependency_parsing/utils/parser_utils.py:408
↓ 1 callersFunctionsanity_check
()
a2_word2vec/sgd.py:111
↓ 1 callersMethodsave
Save the odel to a file. @param path (str): path to the model
a5_neural_machine_translation_convnet_subword/nmt_model.py:401
↓ 1 callersMethodsave
Save the odel to a file. @param path (str): path to the model
a4_neural_machine_translation_s2s_attention/nmt_model.py:503
↓ 1 callersFunctionsave_params
(iter, params)
a2_word2vec/sgd.py:34
↓ 1 callersFunctiontest_minibatch_parse
Simple tests for the minibatch_parse function Warning: these are not exhaustive
a3_neural_dependency_parsing/parser_transitions.py:204
↓ 1 callersFunctiontest_parse
Simple tests for the PartialParse.parse function Warning: these are not exhaustive
a3_neural_dependency_parsing/parser_transitions.py:172
↓ 1 callersFunctiontest_parse_step
Simple tests for the PartialParse.parse_step function Warning: these are not exhaustive
a3_neural_dependency_parsing/parser_transitions.py:160
↓ 1 callersFunctiontest_word2vec
Test the two word2vec implementations, before running on Stanford Sentiment Treebank
a2_word2vec/word2vec.py:223
↓ 1 callersMethodto_input_tensor
Convert list of sentences (words) into tensor with necessary padding for shorter sentences. @param sents (List[List[str]]): list of
a5_neural_machine_translation_convnet_subword/vocab.py:178
next →1–100 of 156, ranked by callers