smile exception -43 all potential entries are zeros

The engine.
Post Reply
thoriqsalafi
Posts: 3
Joined: Mon May 26, 2014 3:06 am

smile exception -43 all potential entries are zeros

Post by thoriqsalafi »

Hi,

I am using jsmile for android and I think I have define all the nodes and the state as well as the connection, and seems it is working after I execute 2 or 3 times, but after 4/5 times I update to a new belief there is error like this

/AndroidRuntime(1954): Caused by: smile.SMILEException: SMILE error -43 in function UpdateBeliefs. Logged information: All potential entries are zeros for node ....
06-03 09:58:46.590: E/AndroidRuntime(1954): All potential entries are zeros for node ... etc

so what is the problem here? and how to solve it? thanks
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: smile exception -43 all potential entries are zeros

Post by shooltz[BayesFusion] »

so what is the problem here? and how to solve it? thanks
It's usually one of these two:
- conflicting evidence
- network structure which yields the jointree where precision loss happens (for example the naive bayes network with single parent and 1000+ children).

Can you post your network here?
thoriqsalafi
Posts: 3
Joined: Mon May 26, 2014 3:06 am

Re: smile exception -43 all potential entries are zeros

Post by thoriqsalafi »

I cant save the node and get error -2 so this is my code for the network. please help thanks

Code: Select all

        net.addNode(Network.NodeType.Cpt, "Outdoor");
        net.addNode(Network.NodeType.Cpt, "Dynamic");
        net.addNode(Network.NodeType.Cpt, "Office");
        net.addNode(Network.NodeType.Cpt, "Home");
        net.addNode(Network.NodeType.Cpt, "Busy");
        net.addNode(Network.NodeType.Cpt, "Static");
        net.addNode(Network.NodeType.Cpt, "Travelling");
        net.addNode(Network.NodeType.Cpt, "Working");
        net.addNode(Network.NodeType.Cpt, "Resting");
        net.addNode(Network.NodeType.Cpt, "NumberofCall");
        net.addNode(Network.NodeType.Cpt, "NumberofSMS");
        net.addNode(Network.NodeType.Cpt, "Interaction");
        net.addNode(Network.NodeType.Cpt, "Screen");
        net.addNode(Network.NodeType.Cpt, "RunningApps");
        net.addNode(Network.NodeType.Cpt, "PhoneUsage");
        net.addNode(Network.NodeType.Cpt, "ApplicationTypes");
        net.addNode(Network.NodeType.Cpt, "FriendlyContact");
        net.addNode(Network.NodeType.Cpt, "Date");
        net.addNode(Network.NodeType.Cpt, "Valence");
        net.addNode(Network.NodeType.Cpt, "TimeofTheDay");
        net.addNode(Network.NodeType.Cpt, "Arousal");

        net.setOutcomeId("Outdoor", 0, "Yes");
        net.setOutcomeId("Outdoor", 1, "No");
        net.setOutcomeId("Home", 0, "Yes");
        net.setOutcomeId("Home", 1, "No");
        net.setOutcomeId("Office", 0, "Yes");
        net.setOutcomeId("Office", 1, "No");
        net.setOutcomeId("Home", 0, "Yes");
        net.setOutcomeId("Home", 1, "No");
        net.setOutcomeId("Static", 0, "Yes");
        net.setOutcomeId("Static", 1, "No");
        net.setOutcomeId("Dynamic", 0, "Yes");
        net.setOutcomeId("Dynamic", 1, "No");
        net.setOutcomeId("Resting", 0, "Yes");
        net.setOutcomeId("Resting", 1, "No");
        net.setOutcomeId("Working", 0, "Yes");
        net.setOutcomeId("Working", 1, "No");
        net.setOutcomeId("Travelling", 0, "Yes");
        net.setOutcomeId("Travelling", 1, "No");
        net.setOutcomeId("FriendlyContact", 0, "Yes");
        net.setOutcomeId("FriendlyContact", 1, "No");
        net.setOutcomeId("NumberofSMS", 0, "High");
        net.setOutcomeId("NumberofSMS", 1, "Medium");
        net.addOutcome("NumberofSMS", "Low");
        net.setOutcomeId("NumberofCall", 0, "High");
        net.setOutcomeId("NumberofCall", 1, "Medium");
        net.addOutcome("NumberofCall", "Low");
        net.setOutcomeId("Screen", 0, "High");
        net.setOutcomeId("Screen", 1, "Medium");
        net.addOutcome("Screen", "Low");
        net.setOutcomeId("RunningApps", 0, "High");
        net.setOutcomeId("RunningApps", 1, "Medium");
        net.addOutcome("RunningApps", "Low");
        net.setOutcomeId("Valence", 0, "High");
        net.setOutcomeId("Valence", 1, "Medium");
        net.addOutcome("Valence", "Low");
        net.setOutcomeId("Arousal", 0, "High");
        net.setOutcomeId("Arousal", 1, "Medium");
        net.addOutcome("Arousal", "Low");
        net.setOutcomeId("ApplicationTypes", 0, "Entertainment");
        net.setOutcomeId("ApplicationTypes", 1, "Social");
        net.addOutcome("ApplicationTypes", "Productivity");
        net.setOutcomeId("Busy", 0, "High");
        net.setOutcomeId("Busy", 1, "Medium");
        net.addOutcome("Busy", "Low");
        net.setOutcomeId("Interaction", 0, "High");
        net.setOutcomeId("Interaction", 1, "Medium");
        net.addOutcome("Interaction", "Low");
        net.setOutcomeId("PhoneUsage", 0, "High");
        net.setOutcomeId("PhoneUsage", 1, "Medium");
        net.addOutcome("PhoneUsage", "Low");
        net.setOutcomeId("Date", 0, "Weekend");
        net.setOutcomeId("Date", 1, "SpecialDay");
        net.addOutcome("Date", "Weekday");
        net.setOutcomeId("TimeofTheDay", 0, "Morning");
        net.setOutcomeId("TimeofTheDay", 1, "Afternoon");
        net.addOutcome("TimeofTheDay", "Evening");
        
    	net.addArc("Outdoor", "Travelling");
    	net.addArc("Dynamic", "Travelling");
    	net.addArc("Office", "Working");
    	net.addArc("Static", "Working");
    	net.addArc("Static", "Resting");
    	net.addArc("Home", "Resting");
    	net.addArc("NumberofCall", "Interaction");
    	net.addArc("NumberofSMS", "Interaction");
    	net.addArc("Screen", "PhoneUsage");
    	net.addArc("RunningApps", "PhoneUsage");
    	net.addArc("Resting", "Busy");
    	net.addArc("Working", "Busy");
    	net.addArc("Travelling", "Busy");
    	net.addArc("PhoneUsage", "Arousal");
    	net.addArc("Interaction", "Busy");
    	net.addArc("ApplicationTypes", "Valence");
    	net.addArc("FriendlyContact", "Valence");
    	net.addArc("Date", "Valence");
    	net.addArc("Busy", "Valence");
    	net.addArc("TimeofTheDay", "Arousal");
    	net.addArc("Busy", "Arousal");
    	
    	double[] aOfficeDef = {0.5,0.5};
    	net.setNodeDefinition("Office", aOfficeDef);
    	net.setNodeDefinition("Home", aOfficeDef);
    	net.setNodeDefinition("Static", aOfficeDef);
    	net.setNodeDefinition("Dynamic", aOfficeDef);
    	net.setNodeDefinition("Outdoor", aOfficeDef);
    	net.setNodeDefinition("FriendlyContact", aOfficeDef);
    	
    	double[] aTravellingDef = {1, 0, 0.75, 0, 0, 1, 0.25, 1};
    	net.setNodeDefinition("Travelling", aTravellingDef);
    	net.setNodeDefinition("Working", aTravellingDef);
    	net.setNodeDefinition("Resting", aTravellingDef);
    	
    	double[] aNumberDef = {0.2, 0.6, 0.2};
    	net.setNodeDefinition("NumberofCall", aNumberDef);
    	net.setNodeDefinition("NumberofSMS", aNumberDef);
    	net.setNodeDefinition("RunningApps", aNumberDef);
    	net.setNodeDefinition("Screen", aNumberDef);
    	net.setNodeDefinition("TimeofTheDay", aNumberDef);
    	net.setNodeDefinition("ApplicationTypes", aNumberDef);
    	net.setNodeDefinition("Date", aNumberDef);
    	
    	double[] aInteractionDef = {1,0.45,0,0.65,0,0,0,0,0,0,0.55,1,0.35,1,0.45,1,0.65,0,0,0,0,0,0,0.55,0,0.35,1};
    	net.setNodeDefinition("Interaction", aInteractionDef);
    	
    	double[] aPhoneDef = {1,0.65,0.1,0.35,0,0,0,0,0,0,0.35,0.55,0.65,1,0.25,1,0.35,0,0,0,0.35,0,0,0.75,0,0.65,1};
    	net.setNodeDefinition("PhoneUsage", aPhoneDef);
    	
    	double[] aBusyDef = {0.9,0.9,0.55,0,0.9,0.9,0.8,0.55,0.75,0.75,0,0,0.75,0.8,0.65,0,0.5,0.5,0,0,0.5,0.7,0.4,0,0.1,0.1,0.45,0.4,0.1,0.1,0.2,0.45,0.25,0.25,0.65,0.2,0.25,0.2,0.3,0.65,0.5,0.5,0.1,0.1,0.5,0.3,0.5,0.1,0,0,0,0.6,0,0,0,0,0,0,0.35,0.8,0,0,0.05,0.35,0,0,0.9,0.9,0,0,0.1,0.9};
    	net.setNodeDefinition("Busy", aBusyDef);
    	
    	double[] aValenceDef = {0.45,0.8,1,0.4,0.5,0.65,0.25,0.5,0.8,0,0,0.1,0.05,0.25,0.45,0,0.15,0.25,0.45,0.8,1,0.4,0.5,0.65,0.3,0.6,0.8,0,0,0.1,0.1,0.25,0.45,0,0.05,0.25,0.2,0.3,0.4,0.2,0.4,0.6,0.1,0.2,0.5,0.2,0.3,0.2,0.1,0.3,0.5,0.1,0.4,0.5,0.45,0.2,0,0.4,0.4,0.25,0.55,0.35,0.15,0.25,0.5,0.75,0.55,0.55,0.45,0.25,0.35,0.55,0.45,0.2,0,0.4,0.4,0.25,0.4,0.25,0.15,0.5,0.65,0.75,0.5,0.55,0.45,0.25,0.45,0.55,0.5,0.6,0.5,0.5,0.3,0.3,0.5,0.5,0.5,0.3,0.3,0.5,0.5,0.4,0.4,0.5,0.5,0.4,0.1,0,0,0.2,0.1,0.1,0.2,0.15,0.05,0.75,0.5,0.15,0.4,0.2,0.1,0.75,0.5,0.2,0.1,0,0,0.2,0.1,0.1,0.3,0.15,0.05,0.5,0.35,0.15,0.4,0.2,0.1,0.75,0.5,0.2,0.3,0.1,0.1,0.3,0.3,0.1,0.4,0.3,0,0.5,0.4,0.3,0.4,0.3,0.1,0.4,0.1,0.1};
    	net.setNodeDefinition("Valence", aValenceDef);
    	
    	double[] aArousalDef = {0.7,0.5,0.4,0.6,0.4,0.4,0.2,0,0,0.6,0.5,0.4,0.6,0.3,0.4,0,0,0,0.2,0.2,0.1,0,0,0,0,0,0,0.3,0.4,0.2,0.3,0.4,0.3,0.5,0.3,0.2,0.4,0.5,0.6,0.4,0.6,0.3,0.8,0.6,0.4,0.5,0.3,0.3,0.5,0.4,0.2,0.3,0.1,0,0,0.1,0.4,0.1,0.2,0.3,0.3,0.7,0.8,0,0,0,0,0.1,0.3,0.2,0.4,0.6,0.3,0.5,0.6,0.5,0.6,0.8,0.7,0.9,1};
    	net.setNodeDefinition("Arousal", aArousalDef);
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: smile exception -43 all potential entries are zeros

Post by shooltz[BayesFusion] »

thoriqsalafi wrote:I cant save the node and get error -2 so this is my code for the network.
Try calling Network.writeString() and copy its output. I'll also need the evidence which is set when you get the error -43.
thoriqsalafi
Posts: 3
Joined: Mon May 26, 2014 3:06 am

Re: smile exception -43 all potential entries are zeros

Post by thoriqsalafi »

thanks for help

i am confused because if i set the evidence like this, there is no error

Code: Select all

net.setEvidence("Home","No");
net.setEvidence("Outdoor","Yes");
net.setEvidence("Office","No");
net.setEvidence("Dynamic","Yes");
 net.setEvidence("FriendlyContact","Yes");
 net.setEvidence("NumberofSMS","High");
net.setEvidence("NumberofCall","High");
net.setEvidence("Screen","High");
 net.setEvidence("RunningApps","High");
net.setEvidence("Date", "Weekday");
 net.setEvidence("ApplicationTypes", "Entertainment");
but if I use this and select the spinner based on the above evidence I got error -43 it has been 2 days and I still got the error

Code: Select all

if(String.valueOf(movementspinner.getSelectedItem()).equals("Dynamic"))
    	{    	
    	net.setEvidence("Dynamic","Yes");
    	net.setEvidence("Static","No");
    	}
    	else
    	{
    		net.setEvidence("Dynamic","No");
        	net.setEvidence("Static","Yes");
    	}
    	
    	if(String.valueOf(locationspinner.getSelectedItem()).equals("Home"))
    	{    	
    	net.setEvidence("Home","Yes");
    	net.setEvidence("Outdoor","No");
    	net.setEvidence("Office", "No");
    	}
    	
    	else if(String.valueOf(locationspinner.getSelectedItem()).equals("Outdoor"))
    	{
    		net.setEvidence("Home","No");
        	net.setEvidence("Outdoor","Yes");
        	net.setEvidence("Office","No");
    	}
    	else if(String.valueOf(locationspinner.getSelectedItem()).equals("Office"))
    	{
    		net.setEvidence("Home","No");
        	net.setEvidence("Outdoor","No");
        	net.setEvidence("Office","Yes");
    	} 	
    	
    	if(String.valueOf(contactsspinner.getSelectedItem()).equals("Yes"))
    	{    	
    	net.setEvidence("FriendlyContact","Yes");
    	}
    	else
    	{
    		net.setEvidence("FriendlyContact", "No");
    	}
    	
    	if(String.valueOf(smsspinner.getSelectedItem()).equals("High"))
    	{    	
    	net.setEvidence("NumberofSMS","High");
    	}
    	else if(String.valueOf(smsspinner.getSelectedItem()).equals("Medium"))
    	{    	
    	net.setEvidence("NumberofSMS","Medium");
    	}
    	else if(String.valueOf(smsspinner.getSelectedItem()).equals("Low"))
    	{
    		net.setEvidence("NumberofSMS","Low");
    	}
    	
    	if(String.valueOf(callspinner.getSelectedItem()).equals("High"))
    	{    	
    	net.setEvidence("NumberofCall","High");
    	
    	}
    	else if(String.valueOf(callspinner.getSelectedItem()).equals("Medium"))
    	{    	
    	net.setEvidence("NumberofCall","Medium");
    	}
    	else if(String.valueOf(callspinner.getSelectedItem()).equals("Low0"))
    	{
    		net.setEvidence("NumberofCall","Low");
    	}
    	
    	if(String.valueOf(screen.getSelectedItem()).equals("High"))
    	{    	
    	net.setEvidence("Screen","High");
    	}
    	else if(String.valueOf(callspinner.getSelectedItem()).equals("Medium"))
    	{    	
    	net.setEvidence("Screen","Medium");
    	}
    	else
    	{
    		net.setEvidence("Screen","Low");
    	}
    	
    	if(String.valueOf(runningapps.getSelectedItem()).equals("High"))
    	{    	
    	net.setEvidence("RunningApps","High");
    	}
    	else if(String.valueOf(runningapps.getSelectedItem()).equals("Medium"))
    	{    	
    	net.setEvidence("RunningApps","Medium");
    	}
    	else if(String.valueOf(runningapps.getSelectedItem()).equals("Low"))
    	{
    		net.setEvidence("RunningApps","Low");
    	}
    	
    	if(String.valueOf(applicationsspinner.getSelectedItem()).equals("Entertainment"))
    	{    	
    	net.setEvidence("ApplicationTypes","Entertainment");
    	}
    	else if(String.valueOf(runningapps.getSelectedItem()).equals("Social"))
    	{    	
    	net.setEvidence("ApplicationTypes","Social");
    	}
    	else
    	{
    		net.setEvidence("ApplicationTypes","Productivity");
    	}
    	
    	Calendar c = Calendar.getInstance(); 
        dayofweek = c.get(Calendar.DAY_OF_WEEK);
    	if(dayofweek == 7 || dayofweek == 0)
        {
        	net.setEvidence("Date", "Weekend");
        }
        else
        {
        	net.setEvidence("Date", "Weekday");
        }   	
    	
    	net.setEvidence("TimeofTheDay", "Morning");
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: smile exception -43 all potential entries are zeros

Post by shooltz[BayesFusion] »

thoriqsalafi wrote: i am confused because if i set the evidence like this, there is no error
...
but if I use this and select the spinner based on the above evidence I got error -43 it has been 2 days and I still got the error
This suggests that error -43 is caused by conflicting evidence. SMILE contains some built-in checks which reject the conflicts in evidence, but there are some undetected borderline cases.

To properly investigate the problem, I'll need your network in .xdsl format AND the evidence causing the error -43. I'll be more than happy to help you, but I'm not going to write an Android app to reproduce the issue. If you are unable to succesfully call Network.writeFile, use Network.writeString and dump it to log.
Post Reply