crslab.model.recommendation.textcnn package¶
Submodules¶
TextCNN¶
References
Kim, Yoon. “Convolutional Neural Networks for Sentence Classification.” in EMNLP 2014.
-
class
crslab.model.recommendation.textcnn.textcnn.
TextCNNModel
(opt, device, vocab, side_data)[source]¶ Bases:
crslab.model.base.BaseModel
-
movie_num
¶ A integer indicating the number of items.
-
num_filters
¶ A string indicating the number of filter in CNN.
-
embed
¶ A integer indicating the size of embedding layer.
-
filter_sizes
¶ A string indicating the size of filter in CNN.
-
dropout
¶ A float indicating the dropout rate.
- Parameters
opt (dict) – A dictionary record the hyper parameters.
device (torch.device) – A variable indicating which device to place the data and model.
vocab (dict) – A dictionary record the vocabulary information.
side_data (dict) – A dictionary record the side data.
-
forward
(batch, mode)[source]¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-