linqs / psl-examples

Various examples to showcase the functionality of PSL.
61 stars 38 forks source link

Where is psl-cli.jar #11

Closed datduong closed 4 years ago

datduong commented 4 years ago

Hi, I am inexperience in Java. On the help website https://psl.linqs.org/blog/2018/07/15/getting-started-with-psl.html. We can use psl-cli.jar to run our own .data and .psl with

java -jar psl-cli.jar --infer --model [name of model file].psl --data [name of data file].data

Where is this psl-cli.jar located in the psl-example github? Thanks.

eriq-augustine commented 4 years ago

Hey Dat,

We don't directly store the jar in the repository (since it is often bad form to keep compiled artifacts in the repo). If you are use the run.sh script in the psl-examples repo, then the script will fetch the PSL jar for you (if it doesn't already see it).

Regardless, you can find the PSL jars in our Maven repository here: https://linqs-data.soe.ucsc.edu/maven/repositories/psl-releases/org/linqs/psl-cli/

However in the next release of PSL, we will be officially moving to Maven Central (the default place to put dependencies and jars). So our new location for jars will be: https://mvnrepository.com/artifact/org.linqs/psl-cli

datduong commented 4 years ago

Thanks for the quick reply. I have another question which can be quite dumb.

I am copying the preference-prediction example (user --> joke rating). For now, I am using some fake data before I will input my real data. I was able to get the psl-cli-2.1.0.jar after I run the ruh.sh; however, I am getting the error when running psl-cli-2.1.0.jar

java -jar psl-cli-2.1.0.jar --learn --model rule.psl --data input.data 0 [main] INFO org.linqs.psl.cli.Launcher - Loading data Unexpected exception! java.lang.IllegalArgumentException: Data on row 0 length does not match for observations: Expecting: 2, Got: 1 at org.linqs.psl.database.rdbms.RDBMSInserter.insertInternal(RDBMSInserter.java:152) at org.linqs.psl.database.rdbms.RDBMSInserter.insertAll(RDBMSInserter.java:119) at org.linqs.psl.database.loading.Inserter.loadDelimitedData(Inserter.java:90) at org.linqs.psl.database.loading.Inserter.loadDelimitedDataAutomatic(Inserter.java:160) at org.linqs.psl.database.loading.Inserter.loadDelimitedDataAutomatic(Inserter.java:136) at org.linqs.psl.cli.DataLoader.loadData(DataLoader.java:122) at org.linqs.psl.cli.DataLoader.loadPartitions(DataLoader.java:98) at org.linqs.psl.cli.DataLoader.load(DataLoader.java:77) at org.linqs.psl.cli.Launcher.loadData(Launcher.java:233) at org.linqs.psl.cli.Launcher.run(Launcher.java:386) at org.linqs.psl.cli.Launcher.main(Launcher.java:660) at org.linqs.psl.cli.Launcher.main(Launcher.java:649)

It is pretty clear that one of the input files should have 2 input variables and 1 output variables (3 columns total). However, it doesn't say which file has this problem. When I manually check, I see that all my files are specified correctly. This is the input https://github.com/datduong/PSLGOannotation/blob/master/MakeData/ExampleCode/input.data

The only 2 files with 2 inputs and 1 output are: Subset and ClassifierPredict. I have both files with 3 columns total (2 inputs and 1 output); for example, here https://github.com/datduong/PSLGOannotation/blob/master/MakeData/ExampleCode/ClassifierPredict.txt and here https://github.com/datduong/PSLGOannotation/blob/master/MakeData/ExampleCode/Subset.txt

Would you be able to tell me what can be the issue here? I have tried using both "space" and "tab" delimited. Thank you.

datduong commented 4 years ago

As it turns out, vim on my school server doesn't recognize the tabs in my text file created in the the visual studio code in windows. When I create the file in the linux system with tabs, then the code works. Thank you.

eriq-augustine commented 4 years ago

Nice, glad to hear you were able to figure it out.

For the future, a better place to post questions like this would be the PSL user's group: https://groups.google.com/forum/#!forum/psl-users

datduong commented 4 years ago

Thanks. I will snoop through this forum while I test my data. Thanks for the help and the code.