Code Monkey home page Code Monkey logo

Comments (5)

zxlzr avatar zxlzr commented on July 1, 2024

请问您超参数用的是什么,建议您多跑几个epoch 调一下参数试试看,transe是个强基线效果不错的。

from openbg500.

TimelordRi avatar TimelordRi commented on July 1, 2024

您好!建议尝试一下https://github.com/OpenBGBenchmark/OpenBG-IMG/tree/main/TransE 中的参数设置。

from openbg500.

xiaocheng99 avatar xiaocheng99 commented on July 1, 2024

代码的参数设置是借鉴的OpenBG-IMG/tree/main/TransE 中的参数设置
`# dataloader for training
train_dataloader = TrainDataLoader(
in_path = data_path,
nbatches = 100,
threads = 8,
sampling_mode = "normal",
bern_flag = 1,
filter_flag = 1,
neg_ent = 25,
neg_rel = 0)

dataloader for test

test_dataloader = TestDataLoader(data_path, "link")

define the model

transe = TransE(
ent_tot = train_dataloader.get_ent_tot(),
rel_tot = train_dataloader.get_rel_tot(),
dim = 200,
p_norm = 1,
norm_flag = True)

define the loss function

model = NegativeSampling(
model = transe,
loss = MarginLoss(margin = 5.0),
batch_size = train_dataloader.get_batch_size()
)

train the model

trainer = Trainer(model = model, data_loader = train_dataloader, train_times = 1000, alpha = 1.0, use_gpu = True)
trainer.run()
transe.save_checkpoint('./checkpoints/openbg_500.ckpt')
`

最后跑出来的结果是这样的

`metric: MRR MR hit@10 hit@3 hit@1
l(raw): 0.000000 0.000000 0.000000 0.000000 0.000000
r(raw): 0.000018 131553.234375 0.000000 0.000000 0.000000
averaged(raw): 0.000009 65776.617188 0.000000 0.000000 0.000000

l(filter): 0.000000 0.000000 0.000000 0.000000 0.000000
r(filter): 0.000018 131553.234375 0.000000 0.000000 0.000000
averaged(filter): 0.000009 65776.617188 0.000000 0.000000 0.000000
type constraint results:
metric: MRR MR hit@10 hit@3 hit@1
l(raw): 0.000000 0.000000 0.000000 0.000000 0.000000
r(raw): 0.055832 479.256195 0.194600 0.044200 0.000000
averaged(raw): 0.027916 239.628098 0.097300 0.022100 0.000000

l(filter): 0.000000 0.000000 0.000000 0.000000 0.000000
r(filter): 0.055832 479.256195 0.194600 0.044200 0.000000
averaged(filter): 0.027916 239.628098 0.097300 0.022100 0.000000
MRR: 0.027916, MR: 239.628098, HITS@10: 0.097300, HITS@3: 0.022100, HITS@1: 0.000000
`

from openbg500.

TimelordRi avatar TimelordRi commented on July 1, 2024

你好,我尝试复现了一下,问题在于OpenKE中用于计算指标的文件是test文件,请你检查一下你的test文件是否包含完整的三元组。我们提供的OpenBG500数据集中所使用的test只包含头实体和关系,预测尾实体的过程需要像https://github.com/OpenBGBenchmark/OpenBG-IMG/tree/main/TransE 中一样,先把尾实体使用ent_000000来填充,然后再生成result文件,如果你遵循的是以上步骤,请你将result文件提交到阿里云天池OpenBG Benchmark中进行结果评测。如果你想在本地使用OpenKE取得正确的结果,请你使用以下数据集中的OpenBG500_answer.tsv文件来替代你的test文件进行模型评估,谢谢。
https://drive.google.com/file/d/1pD_icqV-lLbCXN2rfBaq-Y5i_XcKVCzM/view

from openbg500.

xiaocheng99 avatar xiaocheng99 commented on July 1, 2024

问题已经解决 感谢答疑!!

from openbg500.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.