Dear all,
is there any possibility to use the methods Sensitivity Analysis and Strength of influence in jSmile? Or is there any workaround?
For my work, I'm trying to find the most important nodes for the calculation of the specific target node.
I would be really thankful for your help!
Best regards,
Juliane
Strength of Influence and Sensitivity Analysis in jSmile
-
- Site Admin
- Posts: 1419
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Strength of Influence and Sensitivity Analysis in jSmile
Sensitivity analysis is only available from C++ SMILE (not from jSMILE)
Strength of influence is a feature implemented only in GeNIe.
Strength of influence is a feature implemented only in GeNIe.
Re: Strength of Influence and Sensitivity Analysis in jSmile
Thanks for the quick reply!
Is there any documentation about how the Sensitivity Analysis works? So, I can implement it by myself?
Best regards,
Juliane
Is there any documentation about how the Sensitivity Analysis works? So, I can implement it by myself?
Best regards,
Juliane
-
- Site Admin
- Posts: 1419
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Strength of Influence and Sensitivity Analysis in jSmile
The sensitivity analysis chapter in SMILE docs is not ready yet. I'm including a simple function calling into SMILE to calculate the sensitivity of the PBC on age in the hepar model (included in GeNIe). Please read the GeNIe manual chapter titled "Sensitivity analysis in Bayesian networks" before proceeding; it contains the description of SMILE's implementation of sensitivity analysis, for which GeNIe only provides an user interface.
sensitivity.h in your SMILE directory contains the declaration of the sensitivity API. The names of the methods should be self-explaining, but of course we'll be happy to answer any questions you post here.
sensitivity.h in your SMILE directory contains the declaration of the sensitivity API. The names of the methods should be self-explaining, but of course we'll be happy to answer any questions you post here.
Code: Select all
int SensitivityExample()
{
DSL_network net;
int res = net.ReadFile(... hepar filename here ...);
if (DSL_OKAY != res)
{
return res;
}
net.ClearAllTargets();
int hTarget = net.FindNode("PBC");
if (hTarget < 0)
{
return hTarget;
}
net.SetTarget(hTarget);
// optionally set evidence here - sensitivity depends on the evidence
DSL_sensitivity sens;
res = sens.Calculate(net);
if (DSL_OKAY != res)
{
return res;
}
// we're going to calculate how P(PBC=present) changes when the CPT of age changes
int h = net.FindNode("age");
if (h < 0)
{
return h;
}
std::vector<const DSL_Dmatrix *> coeffs;
// zero in make_pair is the index of the 'present' state in PBC
sens.GetCoefficients(h, std::make_pair(hTarget, 0), coeffs);
if (coeffs.empty())
{
printf("Node has no effect on target with the current evidence.");
return DSL_NO_ITEM;
}
// coeffs will have 4 DSL_Dmatrix objects for alpha, beta, gamma, delta
// each DSL_Dmatrix has the same size
// see GeNIe docs for the description of the coefficients
int mtxElemCount = coeffs.front()->GetSize();
for (int i = 0; i < mtxElemCount; i++)
{
printf("%d:", i);
for (size_t j = 0; j < coeffs.size(); j++)
{
const DSL_Dmatrix &mtx = *coeffs[j];
printf(" %g", mtx[i]);
}
printf("\n");
}
return DSL_OKAY;
}
Re: Strength of Influence and Sensitivity Analysis in jSmile
Hello again,
because I'm using jSmile, I'm trying to translate your C++ code to java. However, there is no such class like DSL_sensitivity or sensitivity in general in your jSmile. Do you may also have an idea how to make the Sensitivity Analysis in Java?
Thanks in advance!
because I'm using jSmile, I'm trying to translate your C++ code to java. However, there is no such class like DSL_sensitivity or sensitivity in general in your jSmile. Do you may also have an idea how to make the Sensitivity Analysis in Java?
Thanks in advance!
-
- Site Admin
- Posts: 1419
- Joined: Mon Nov 26, 2007 5:51 pm
Re: Strength of Influence and Sensitivity Analysis in jSmile
As I wrote on January 4th in the post #2 in this thread, sensitivity is only available from C++.
Re: Strength of Influence and Sensitivity Analysis in jSmile
Ok, thank you!
However, that's too bad :( I really need this function or a method to calculate the importance of each node for the target node...
If you have any idea, please let me know!
However, that's too bad :( I really need this function or a method to calculate the importance of each node for the target node...
If you have any idea, please let me know!