Models¶
BaseModule¶
CNN¶
-
class
caver.model.cnn.
CNN
(config, vocab_size=1000, label_num=100)[source]¶ - Parameters
This is the implementation of CNN from cnn_paper: Kim, Yoon. “Convolutional neural networks for sentence classification.” arXiv preprint arXiv:1408.5882 (2014).
text -> embedding -> conv -> relu -> BatchNorm -> max_pool -> mlp -> sigmoid
LSTM¶
fastText¶
SWEN¶
-
class
caver.model.swen.
SWEN
(**kwargs)[source]¶ - Parameters
window (int) – avg_pool window
This model is the implementation of SWEN-hier from swen_paper: Shen, Dinghan, et al. “Baseline Needs More Love: On Simple Word-Embedding-Based Models and Associated Pooling Mechanisms.”
text -> embedding -> avg_pool -> max_pool -> mlp -> sigmoid
HAN¶
-
class
caver.model.han.
HAN
(**kwargs)[source]¶ - Parameters
This model is the implementation of HAN(only word encoder and word attention) from han_paper: Yang, Zichao, et al. “Hierarchical attention networks for document classification.” Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. 2016.