MCPcopy Create free account
hub / github.com/chinawithfrank/ChatBotCourse / __init__

Method __init__

chatbotv3/encoder_decoder_seq2seq.py:13–27  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

11
12class MyLSTM(object):
13 def __init__(self):
14 self.max_abs_weight = 32 # 最大权重绝对值,用来对词向量做正规化
15 self.max_seq_len = 8 # 最大句子长度(词)
16 self.word_vec_dim = 0 # 词向量维度,读vectors.bin二进制时动态确定
17 self.epoch = 1000
18 self.word_vector_dict = {} # 词向量词典,加载vectors.bin读入
19 self.one_hot_word_vector_dict = {} # 根据样本词汇生成的softmax用的词向量
20 self.word_id_word_dict = {}
21 self.one_hot_word_vectors_dim = 1 # softmax用的词向量维度,从1开始,保留0作为EOS的word_id
22 self.eos_word_id = 0
23 self.eos_word = 'EOS'
24 self.vectors_bin_file = './vectors.bin' # 词向量二进制
25 self.model_dir = './model/model' # 模型文件路径
26 self.n_hidden = 1000 # lstm隐藏状态单元数目
27 self.learning_rate = 0.01 # 学习率
28
29 def load_one_hot_word_vectors(self):
30

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected