概率软逻辑(PSL,Probabilistic soft logic)常见错误及解决方案-持续收集


1. Can only call getAtom() on persisted RandomVariableAtoms......Cannot access......

【解决方法】由于在使用MPEInference的时候,输入targetPartition分区中的原子没有和推断输出的原子一一对应。关系应该是:目标原子 >= 推理输出原子
当无法保证上述关系时,可使用 LazyMPEInference


2. Failed to execute a general update [DROP SCHEMA public CASCADE].

【解决方法】此问题是在使用PostgreSQLDriver时,出现在多次运行之后,报错具体原因未知,解决方法是从命令行下先进入postgreSQL的安装目录bin文件夹,用命令删除数据库(和用户),再运行一遍groovy文件,报未找到psl数据库之后,回到命令行创建数据库 “psl” (和用户)。命令如下:

删除用户用命令: dropuser -U postgres [username]
删除数据库命令: dropdb -U postgres [dbname] #dbname为psl
创建用户用命令: createuser -U postgres -s [username] #username为当前

3.Any variable used in a negated (non-functional) predicate must also participate in a positive (non-functional) predicate.

【解决方法】PSL将拒绝以下类型的规则:

10.0: Friends(A, B) & !friends(B, C) -> Friends(A, C) ^2

请更改为:

10.0: Friends(A, B) & !friends(B, C) -> !Friends(A, C) ^2

直接理解意思为:朋友的敌人也是敌人。


4.ERROR: invalid input syntax for integer: "xxx" 在位置:COPY xxxx_predicate, line 1, column uniqueintid_0: "xxxx"

【解决方法】由于输入数据非UniqueIntID类型导致错误,可将UniqueIntID更改为UniqueStringID或String,为了计算效率最好将数据编码为整数类型。


5.org.linqs.psl.model.atom.RandomVariableAtom cannot be cast to org.linqs.psl.model.atom.ObservedAtom

【解决方法】此问题出现于实验结果输出模块,其中

truthDB = dataStore.getDatabase(partitions.get(truth), [xx,xx] as Set);

[xx,xx] as Set是设置closed谓词,因为验证用的真实数据不可变,所以一定要在xx位置全部指明。


6.ERROR: relation "xxxxxxxxxxxxx_predicate_uniquestring" already exists

【解决方法】此问题由于使用postgres数据库时定义的谓词名称变态长而导致。
解决方法:1.缩短谓词名称(数据量巨大,特别是自动定义谓词时,手动操作不现实)。2.转码,可以使用PSL的自带转码功能版本。


7.Variable, [xxx] is DeferredFunctionalUniqueID and connot be replaced by String

【解决方法】由于谓词的ConstantType属性为String,并且在规则里使用(A!=B)的形式
要么将谓词的ConstantType属性改为UniqueStringID,要么将规则里所有的(A!=B)形式去掉,当然,结果的准确度要受影响。


你可能感兴趣的:(概率软逻辑(PSL,Probabilistic soft logic)常见错误及解决方案-持续收集)