pLogicNet
pLogicNet copied to clipboard
Load data with different triples format
trafficstars
When you have a train dataset that entities contains ":" (for example, one entity could be an url) the program will crash since it is the character than the program use for adding the probability value to the entity.
#Save the predictions on test data
with open(local_path + '/pred_kge.txt', 'w') as fo:
for h, r, t, f, rk, l in preds:
fo.write('{}\t{}\t{}\t{}\t{}\n'.format(id2entity[h], id2relation[r], id2entity[t], f, rk))
for e, val in l:
fo.write('{}:{:.4f} '.format(id2entity[e], val))
fo.write('\n')
So when the program try to split the value in order to evaluate the model, it will not split it properly and it will crash.
preds = [[pred.split(':')[0], float(pred.split(':')[1])] for pred in preds]
Maybe, I would recomend to change the character to another one since it can appear in url entities. Another option maybe would be try to select in a different way the probability value and the entity.