/** * Sets the distribution of a normal variable with normal and multinomial parents in the AMIDST model from the * corresponding distribution in the Hugin model. * For each assignment of the multinomial parents, a CLG distribution is set. * @param huginVar the Hugin variable with the distribution to be converted. * @throws ExceptionHugin */ private void setNormal_MultinomialNormalParents(Node huginVar) throws ExceptionHugin { int indexNode = this.huginBN.getNodes().indexOf(huginVar); Variable amidstVar = this.amidstBN.getVariables().getVariableById(indexNode); Normal_MultinomialNormalParents dist = this.amidstBN.getConditionalDistribution(amidstVar); List<Variable> multinomialParents = dist.getMultinomialParents(); int numParentAssignments = MultinomialIndex.getNumberOfPossibleAssignments(multinomialParents); for(int i=0;i<numParentAssignments;i++) { ConditionalLinearGaussian normalNormal = dist.getNormal_NormalParentsDistribution(i); double huginIntercept = ((ContinuousChanceNode)huginVar).getAlpha(i); normalNormal.setIntercept(huginIntercept); List<Variable> normalParents = dist.getNormalParents(); int numParents = normalParents.size(); double[] coefficients = new double[numParents]; for(int j=0;j<numParents;j++){ String nameAmidstNormalParent = normalParents.get(j).getName(); ContinuousChanceNode huginParent = (ContinuousChanceNode)this.huginBN.getNodeByName(nameAmidstNormalParent); coefficients[j]= ((ContinuousChanceNode)huginVar).getBeta(huginParent,i); } normalNormal.setCoeffParents(coefficients); double huginVariance = ((ContinuousChanceNode)huginVar).getGamma(i); normalNormal.setVariance(huginVariance); } }
/** * Sets the distribution of a normal variable with normal parents in the AMIDST model * from the corresponding distribution in the Hugin model. * @param huginVar the Hugin variable with the distribution to be converted. * @throws ExceptionHugin */ private void setNormal_NormalParents(Node huginVar) throws ExceptionHugin { int indexNode = this.huginBN.getNodes().indexOf(huginVar); Variable amidstVar = this.amidstBN.getVariables().getVariableById(indexNode); ConditionalLinearGaussian dist = this.amidstBN.getConditionalDistribution(amidstVar); double huginIntercept = ((ContinuousChanceNode)huginVar).getAlpha(0); dist.setIntercept(huginIntercept); NodeList huginParents = huginVar.getParents(); int numParents = huginParents.size(); double[] coefficients = new double[numParents]; for(int i=0;i<numParents;i++){ ContinuousChanceNode huginParent = (ContinuousChanceNode)huginParents.get(i); coefficients[i]= ((ContinuousChanceNode)huginVar).getBeta(huginParent,0); } dist.setCoeffParents(coefficients); double huginVariance = ((ContinuousChanceNode)huginVar).getGamma(0); dist.setVariance(huginVariance); }
tempprob.getNormal_NormalParentsDistribution(0).setIntercept(0.0); tempprob.getNormal_NormalParentsDistribution(0).setCoeffForParent(temperatureBuilding,1.0); tempprob.getNormal_NormalParentsDistribution(0).setVariance(1); tempprob.getNormal_NormalParentsDistribution(1).setVariance(3); t1prob.setCoeffForParent(temperature[i], 1.0); t1prob.setIntercept(0.0); t1prob.setVariance(1.5); t2prob.setVariance(1.5);
t1prob.setCoeffForParent(temperature, 1.0); t1prob.setIntercept(0.0); t1prob.setVariance(1.5); t2prob.setVariance(1.5);
t1prob.setCoeffForParent(temperature, 1.0); t1prob.setIntercept(0.0); t1prob.setVariance(1.5); t2prob.setVariance(1.5); tempprobTimeT.getNormal_NormalParentsDistribution(0).setIntercept(0); tempprobTimeT.getNormal_NormalParentsDistribution(0).setCoeffForParent(temperature.getInterfaceVariable(),1); tempprobTimeT.getNormal_NormalParentsDistribution(0).setVariance(0.00001); t1probTimeT.setVariance(1.5); t2probTimeT.setVariance(1.5);
t1prob.setCoeffForParent(temperature, 1.0); t1prob.setIntercept(0.0); t1prob.setVariance(1.5); t2prob.setVariance(1.5);
tempTimeT.getNormal_NormalParentsDistribution(1).setIntercept(tempprob.getNormal(0).getMean()+10); tempTimeT.getNormal_NormalParentsDistribution(1).setCoeffForParent(temperature.getInterfaceVariable(),0.0); tempTimeT.getNormal_NormalParentsDistribution(1).setVariance(tempprob.getNormal(0).getVariance());