Hi,
I found the learning results from the Smile were different from that using Genie. There are only three nodes, A, B, H. An arc from H to A and B respectively.
The CPT from H to A is
H h0 h1
a0 0.9215585808924782 0.1103564750941653
a1 0.0784414191075218 0.8896435249058347
It said: EM log-likelihood: 0.0
BUT, I tried to use the EM learning tool in Genie, the results are different:
H h0 h1
a0 0.9548764887866235 0.1536610658888118
a1 0.04512351121337653 0.8463389341111882
It said: Log(p) = -13.5
It has to note that the setEqSampleSize(0) was also used in Genie.
My code were as follows:
................
// Set up and config EM
EM em = new EM();
em.setEqSampleSize(0);
em.setRandomizeParameters(true);
em.setSeed(SEED_VALUE);
em.learn(data, network, data.matchNetwork(network));
The learning data are:
A B H
a0 b0 N/A
a0 b0 N/A
a0 b0 N/A
a0 b0 N/A
a0 b0 N/A
a0 b0 N/A
a1 b1 N/A
a1 b1 N/A
a1 b1 N/A
a1 b1 N/A
a0 b1 N/A
a1 b0 N/A
Thank you!
Have a nice weekends!
Regards,
Yang
The differences of the learning results
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: The differences of the learning results
The actual value of SEED_VALUE is missing from your post.My code were as follows:
em.setSeed(SEED_VALUE);
Re: The differences of the learning results
Hi,
The SEED_VALUE is 0.
Thanks!
Yang
The SEED_VALUE is 0.
Thanks!
Yang
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: The differences of the learning results
Zero seed causes the pseudorandom generator to initialize using the clock, effectively you're running a non-repeatable experiment.
Re: The differences of the learning results
Hi shooltz,
What the meaning of "setSeed"? Can I just discard the lines, as follow
SEED_VALUE = 0;
em.setSeed(SEED_VALUE);
Thank you!
Have a nice Weekend!
Best wishes,
Yang
What the meaning of "setSeed"? Can I just discard the lines, as follow
SEED_VALUE = 0;
em.setSeed(SEED_VALUE);
Thank you!
Have a nice Weekend!
Best wishes,
Yang
-
- Site Admin
- Posts: 1417
- Joined: Mon Nov 26, 2007 5:51 pm
Re: The differences of the learning results
The setSeed method initializes the seed for the pseudorandom generator used to randomize the parameters (if randomization is enabled). By fixing it at non-zero value you'll get the same initial values of the parameters before actual learning occurs.musicpxg wrote: What the meaning of "setSeed"? Can I just discard the lines, as follow
SEED_VALUE = 0;
em.setSeed(SEED_VALUE);
If set to zero (which is the default), the generator will pick its initial state based on the system time. Effectively, each time you run the program you'll get different set of initial CPTs.
If you want to get repeatable results, you'll definitely need to fix the seed at some value. Also note that your current call - setSeed(0) - is a no-op, because zero is the default value.