【论文】2024/4/23▶️ROAN_DES

文章介绍了RoAN_DES类的参数初始化过程,包括负样本比例、dropout、嵌入维度等,以及实例化过程中模型中各种嵌入层和编码器的详细结构。
摘要由CSDN通过智能技术生成
# 创建参数对象
class Params:
    def __init__(self, neg_ratio, dropout, se_prop,ne,lr,reg_lambda,emb_dim, save_each,s_emb_dim,e_epoch,alp):
        self.neg_ratio = neg_ratio
        self.dropout = dropout
        self.s_emb_dim = s_emb_dim
        self.se_prop = se_prop
        self.ne = ne
        self.lr = lr
        self.reg_lambda = reg_lambda
        self.emb_dim = emb_dim
        self.s_emb_dim = int(se_prop * emb_dim)
        self.t_emb_dim = emb_dim - int(se_prop * emb_dim)
        self.save_each = save_each
        self.neg_ratio = neg_ratio
        self.dropout = dropout
        self.e_epoch = e_epoch
        self.se_prop = se_prop
        self.dim_ff = self.t_emb_dim * 2
        self.n_head = 4
        self.alp = alp
        self.d_k = self.t_emb_dim // self.n_head
        self.d_v = self.t_emb_dim // self.n_head


params = Params(
    neg_ratio=5,
    lr=0.001,
    reg_lambda=0.0,
    emb_dim=100,
    dropout=0.4,
    e_epoch=10,
    save_each=10,
    se_prop=0.36,
    alp=0.5,
    ne=500,
    s_emb_dim=68,


)
# 实例化 RoAN_DES 类
bsize = 512
dataset = 'icews14'
dataset = Dataset(dataset, bsize)
model = RoAN_DES(dataset, params)

print(model)
RoAN_DES(
  (ent_embs_h): Embedding(7128, 36)
  (ent_embs_t): Embedding(7128, 36)
  (rel_embs_f): Embedding(230, 100)
  (rel_embs_i): Embedding(230, 100)
  (m_freq_h): Embedding(7128, 64)
  (m_freq_t): Embedding(7128, 64)
  (d_freq_h): Embedding(7128, 64)
  (d_freq_t): Embedding(7128, 64)
  (y_freq_h): Embedding(7128, 64)
  (y_freq_t): Embedding(7128, 64)
  (m_phi_h): Embedding(7128, 64)
  (m_phi_t): Embedding(7128, 64)
  (d_phi_h): Embedding(7128, 64)
  (d_phi_t): Embedding(7128, 64)
  (y_phi_h): Embedding(7128, 64)
  (y_phi_t): Embedding(7128, 64)
  (m_amps_h): Embedding(7128, 64)
  (m_amps_t): Embedding(7128, 64)
  (d_amps_h): Embedding(7128, 64)
  (d_amps_t): Embedding(7128, 64)
  (y_amps_h): Embedding(7128, 64)
  (y_amps_t): Embedding(7128, 64)
  (Rel_emb): Rel_time_emb(
    (h_map_emb): Embedding(7128, 100)
    (t_map_emb): Embedding(7128, 100)
    (rel_emb_h): Embedding(231, 100)
    (rel_emb_t): Embedding(231, 100)
    (rel_emb_q): Embedding(230, 100)
    (year_emb): Embedding(1, 100)
    (month_emb): Embedding(12, 100)
    (day_emb): Embedding(31, 100)
    (his_encoder): Encoder(
      (multi): MultiHead(
        (Q): Linear(in_features=100, out_features=64, bias=True)
        (K): Linear(in_features=100, out_features=64, bias=True)
        (V): Linear(in_features=100, out_features=64, bias=True)
        (fc): Linear(in_features=64, out_features=100, bias=False)
        (layernorm): LayerNorm((100,), eps=1e-06, elementwise_affine=True)
        (dropout): Dropout(p=0.4, inplace=False)
        (rel_attn): ScaledDot(
          (dropout): Dropout(p=0.4, inplace=False)
        )
      )
      (ffn): FeedForward(
        (fc1): Linear(in_features=100, out_features=128, bias=True)
        (fc2): Linear(in_features=128, out_features=100, bias=True)
        (layernorm): LayerNorm((100,), eps=1e-06, elementwise_affine=True)
        (dropout): Dropout(p=0.4, inplace=False)
      )
    )
  )
)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值