mauro-idsia / blip

Bayesian network Learning Improved Project
GNU Lesser General Public License v3.0
30 stars 11 forks source link

Exception thrown #4

Open petracca opened 7 years ago

petracca commented 7 years ago

Hello,

I am trying to run my own dataset through the tool, but an exception is thrown and I am not sure how to work around -- I believe the format of input file is fine, and I can provide the dataset as a mean to reproduce the issue.

Thank you for any input.

$ java -jar blip.jar scorer.sq -c bdeu -d data/problem.dat -j data/problem.jkl -n 3 -t 10
Sep 12, 2017 1:28:16 PM ch.idsia.blip.core.utils.other.RandomStuff logExp
SEVERE: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.rangeCheck(ArrayList.java:653)
        at java.util.ArrayList.get(ArrayList.java:429)
        at ch.idsia.blip.core.common.io.dat.DatFileReader.readValuesCache(DatFileReader.java:94)
        at ch.idsia.blip.core.common.io.dat.DatFileReader.read(DatFileReader.java:149)
        at ch.idsia.blip.core.utils.other.RandomStuff.getDataSet(RandomStuff.java:336)
        at ch.idsia.blip.core.utils.other.RandomStuff.getDataSet(RandomStuff.java:296)
        at ch.idsia.blip.api.learn.scorer.ScorerApi.exec(ScorerApi.java:48)
        at ch.idsia.blip.api.learn.scorer.SeqScorerApi.exec(SeqScorerApi.java:9)
        at ch.idsia.blip.api.Api.defaultMain(Api.java:56)
        at ch.idsia.blip.api.learn.scorer.SeqScorerApi.main(SeqScorerApi.java:15)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at ch.idsia.blip.api.Blip.main(Blip.java:62)

Sep 12, 2017 1:28:16 PM ch.idsia.blip.api.Api defaultMain
SEVERE: Error in: ch.idsia.blip.api.learn.scorer.SeqScorerApi
Sep 12, 2017 1:28:16 PM ch.idsia.blip.core.utils.other.RandomStuff logExp
SEVERE: java.lang.NullPointerException
java.lang.NullPointerException
        at ch.idsia.blip.core.learn.scorer.BaseScorer.prepare(BaseScorer.java:71)
        at ch.idsia.blip.core.learn.scorer.BaseScorer.go(BaseScorer.java:87)
        at ch.idsia.blip.api.learn.scorer.ScorerApi.exec(ScorerApi.java:48)
        at ch.idsia.blip.api.learn.scorer.SeqScorerApi.exec(SeqScorerApi.java:9)
        at ch.idsia.blip.api.Api.defaultMain(Api.java:56)
        at ch.idsia.blip.api.learn.scorer.SeqScorerApi.main(SeqScorerApi.java:15)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at ch.idsia.blip.api.Blip.main(Blip.java:62)
mauro-idsia commented 7 years ago

Hi,

if you can provide the dataset I can take a look into the issue.

petracca commented 7 years ago

Hi,

This is an example dataset -- I had to rename as .txt because github would not accept .dat in a post problem.txt

Thank you for your time.

mauro-idsia commented 7 years ago

I've added the details on the data input format on the readme. Here they are:

First line: list of variables names, separated by space;
Second line: list of variables cardinalities, separated by space;
Following lines: list of values taken by the variables in each datapoint, separated by space.

(the value that a variable takes should always be lower that the declared cardinality)