locked
Result differences when using BPM and SparseBPM RRS feed

  • Question

  • I have a piece of code containing an instance of a SparseBPM and a normal BPM. I supply the two different instances with the same data and the same parameters. The data supplied is normalised, has a bias constant of 1, has only 2 features (not including the bias constant), and is not sparse. The result I get from the two BPMs is different. The difference between the results is significant - the standard BPM outputs resonable probabilities, however the SparseBPM outputs either (0.5 0.5) or (0 1) for any input.

    Does this occur due to difference in the operating principles of the two BPMs? Can the size of the training set have such a strong effect on the SparseBPM? Or is the data not supposed to be supplied in a similar format?

    Wednesday, April 10, 2013 9:51 PM

Answers

  • Hi Nikola

    Can you try the new version (released earlier this week).

    If you are still having problems, could you provide more details about your particular case?

    Thanks

    John

    • Marked as answer by NikolaLoncar Friday, April 26, 2013 7:16 PM
    Thursday, April 25, 2013 3:41 PM
    Owner
  • Hi Nik

    The problem is in the line val[1] = new double[] {0, 0.1};

    You have specified just one index, but two values. So, for example, if you make  val[1] = new double[] {0.1};, it will run.

    John

    • Marked as answer by NikolaLoncar Friday, April 26, 2013 7:16 PM
    Friday, April 26, 2013 12:32 PM
    Owner

All replies

  • Hi Nikola

    Can you try the new version (released earlier this week).

    If you are still having problems, could you provide more details about your particular case?

    Thanks

    John

    • Marked as answer by NikolaLoncar Friday, April 26, 2013 7:16 PM
    Thursday, April 25, 2013 3:41 PM
    Owner
  • Hi John,

    I just implemented a very simple example using the new version to make sure its not my code that is acting up and now I just keep receiving errors:

    • predictions[i] = this.testModel.engine.Infer<IList<Discrete>>(this.testModel.y)[0];
    • A first chance exception of type 'MicrosoftResearch.Infer.Utils.AssertFailedException' occurred in Infer.Runtime.dll
    • AssertFailedException: {"result.Count != indices[i].Count"}

    The example I used to test the new version is:

    BPMSparse test = new BPMSparse(2, 0.1, 2);
    int[][] ind = new int[2][];
    ind[0] = new int[] {0, 1};
    ind[1] = new int[] {0, 1};
    
    double[][] val = new double[2][];
    val[0] = new double[] {0.1, 0.9};
    val[1] = new double[] {0.9, 0.1};
    
    int[] labels = new int[] {0, 1};
    
    test.Train(ind, val, labels);
    
    ind[0] = new int[] {0, 1};
    ind[1] = new int[] {1};
    
    val[0] = new double[] {0.1, 0.9};
    val[1] = new double[] {0, 0.1};
    
    foreach (var discrete in test.Test(ind, val))
         Console.WriteLine(discrete);

    Before bothering you any further with case specific details I thought I'd mention this in case it is something to do with my set-up.

    Thanks,

    Nik

    Friday, April 26, 2013 4:10 AM
  • Hi Nik

    The problem is in the line val[1] = new double[] {0, 0.1};

    You have specified just one index, but two values. So, for example, if you make  val[1] = new double[] {0.1};, it will run.

    John

    • Marked as answer by NikolaLoncar Friday, April 26, 2013 7:16 PM
    Friday, April 26, 2013 12:32 PM
    Owner
  • Hi John,

    Thank you very much for pointing this out! Didn't notice that the input format changed.

    The initial difference in results is now gone as well when using version 2.5.

    Thanks,

    Nik

    Friday, April 26, 2013 7:15 PM