Search found 69 matches

by piotr [BayesFusion]
Thu Jun 04, 2020 9:03 am
Forum: SMILE
Topic: Enable diagnosis for nodes using pysmile wrapper
Replies: 5
Views: 59916

Re: Enable diagnosis for nodes using pysmile wrapper

First argument of set_node_diag_type method is node handle or node ID. Second argument represents diagnostic type. By default, all nodes are Auxiliary.

You can change diagnostic type by calling e.g.


net.set_node_diag_type("Fault Node ID", pysmile.NodeDiagType.FAULT)
net.set_node_diag_type("First ...
by piotr [BayesFusion]
Tue Apr 14, 2020 4:16 pm
Forum: SMILE
Topic: node backgorund color and node discretization
Replies: 2
Views: 8110

Re: node backgorund color and node discretization

Ad 1

Node background color could be setted this way:

net.set_node_bg_color(handle, 0x0000ff)
net.set_node_bg_color(handle, 0x123456)

Hexadecimal numbers seem to be the easiest way when it comes to color reading, however, SMILE was initially written in the Windows environment, so color format is ...
by piotr [BayesFusion]
Fri Nov 29, 2019 12:59 pm
Forum: SMILE
Topic: Parameter learner not optimising a DBN's temporal CPT's in PySMILE
Replies: 8
Views: 21554

Re: Parameter learner not optimising a DBN's temporal CPT's in PySMILE

Network matching in SMILE wrappers works with BN's only. However, this functionality would be added in 1.4.2 release (first week of December), so if you are not in hurry, we advise you to wait a few days. In otherwise, you have to match network manually.
by piotr [BayesFusion]
Tue Nov 26, 2019 10:35 am
Forum: SMILE
Topic: Reading temporal arcs and small bug in SMILE wrapper documentation
Replies: 4
Views: 13657

Re: Reading temporal arcs and small bug in SMILE wrapper documentation

Unfortunately, there is no function that returns all temporal arcs in Network, but you can narrow down the search area and iterate nodes placed on Temporal Plate by net.get_temporal_children(node) - it should be slightly faster than net.get_temporal_parents(node, order).
by piotr [BayesFusion]
Mon Nov 25, 2019 11:05 am
Forum: SMILE
Topic: Reading temporal arcs and small bug in SMILE wrapper documentation
Replies: 4
Views: 13657

Re: Reading temporal arcs and small bug in SMILE wrapper documentation

TemporalInfo is a class that contains three fields - handle, id and order.
Fields could be accesed by:

parentArr = net.get_temporal_parents(node, order)
parentArr[0].handle
parentArr[0].id
parentArr[0].order

(with assumption, that temporal arcs exists, so parentArr is not empty)

Exception ...
by piotr [BayesFusion]
Mon May 27, 2019 1:07 pm
Forum: SMILE
Topic: S-function in Simulink
Replies: 5
Views: 15857

Re: S-function in Simulink

There is slightly-improved Smile-Matlab wrapper:
matsmile.cpp
It has minimal functionality to support Discrete Bayesian Networks.

Hello program that uses wrapper looks like this:
net = matsmile('newNetwork');
matsmile('readFile', net, 'VentureBN.xdsl');
matsmile('setEvidence', net, 'Forecast ...
by piotr [BayesFusion]
Wed May 15, 2019 7:00 pm
Forum: SMILE
Topic: S-function in Simulink
Replies: 5
Views: 15857

Re: S-function in Simulink

matsmile.cpp

I added node and outcome validation, so the debugging process should be easier now. Getting node value depends on its type, but most common case (CPT node) is described here https://support.bayesfusion.com/docs/SMILE/using_node_value.html . If your network contains Equation nodes ...
by piotr [BayesFusion]
Tue May 07, 2019 4:51 pm
Forum: SMILE
Topic: S-function in Simulink
Replies: 5
Views: 15857

Re: S-function in Simulink

matsmile.cpp

At first, you have to make sure, that C++ compiler chosen by Matlab is compatible with Smile binaries.


mex -setup cpp


If there is compatibility, change directory to the one where the Smile was unpacked.


cd('full/path/to/smile/directory');


The easiest way I found was to ...
by piotr [BayesFusion]
Tue Dec 11, 2018 7:32 pm
Forum: SMILE
Topic: Sample code (Python preferred) for Dynamic Bayesian Network
Replies: 14
Views: 44482

Re: Sample code (Python preferred) for Dynamic Bayesian Network

self.change_evidence_and_update(net, 'e_proponer', 1, 'Bajo')
self.change_evidence_and_update(net, 'e_aportar', 2, 'Bajo')
self.change_evidence_and_update(net, 'e_proponer', 4, 'Medio')
self.change_evidence_and_update(net, 'e_aportar', 5, 'Medio')
self.change_evidence_and_update(net, 'e ...
by piotr [BayesFusion]
Mon Nov 19, 2018 3:00 pm
Forum: SMILE
Topic: Sample code (Python preferred) for Dynamic Bayesian Network
Replies: 14
Views: 44482

Re: Sample code (Python preferred) for Dynamic Bayesian Network

We have noticed that something is not quite right with network definition. You probably have not set nodes definition for t=0 (ex. Proponer_E)
def_ex.PNG

It should be set with method set_node_definition (not like other slices - set_node_temporal_definition). Also notice, that in SMILE 'time ...
by piotr [BayesFusion]
Fri Nov 16, 2018 3:04 pm
Forum: SMILE
Topic: Sample code (Python preferred) for Dynamic Bayesian Network
Replies: 14
Views: 44482

Re: Sample code (Python preferred) for Dynamic Bayesian Network

def print_posteriors(net, node_handle):
node_id = net.get_node_id(node_handle)
if net.is_evidence(node_handle):
print(node_id + " has evidence set (" +
net.get_outcome_id(node_handle,
net.get_evidence(node_handle)) + ")")
else :
posteriors = net.get_node_value(node_handle)
n = net.get ...
by piotr [BayesFusion]
Tue Nov 06, 2018 10:40 am
Forum: SMILE
Topic: Sample code (Python preferred) for Dynamic Bayesian Network
Replies: 14
Views: 44482

Re: Sample code (Python preferred) for Dynamic Bayesian Network

Why beliefs initialization goes through 10 steps in time?
It depends on Slice (Step) Count variable. You can change it by calling ex. net.set_slice_count(4) (four steps). Remember to update beliefs.

How do I add evidences along time? (I have a guess on this one, but I ask it just in case I am ...
by piotr [BayesFusion]
Fri Nov 02, 2018 10:00 am
Forum: SMILE
Topic: Sample code (Python preferred) for Dynamic Bayesian Network
Replies: 14
Views: 44482

Re: Sample code (Python preferred) for Dynamic Bayesian Network


def print_posteriors(self, net, node_handle):
node_id = net.get_node_id(node_handle)
if net.is_evidence(node_handle):
print(node_id + " has evidence set (" +
net.get_outcome_id(node_handle,
net.get_evidence(node_handle)) + ")")
else :
posteriors = net.get_node_value(node_handle)
for i in ...
by piotr [BayesFusion]
Wed Oct 31, 2018 12:34 pm
Forum: SMILE
Topic: Sample code (Python preferred) for Dynamic Bayesian Network
Replies: 14
Views: 44482

Re: Sample code (Python preferred) for Dynamic Bayesian Network

I'll try to explain PySmile DBN usage based on GeNIe documentation: https://support.bayesfusion.com/docs/GeNIe/dbns_creatingdbn.html


1. Create CPT nodes, ex.

net.add_node("Location")
net.add_node("Rain")
net.add_node("Umbrella")

2. Set node temporal types plate_explained.png

net.set_node ...
by piotr [BayesFusion]
Tue Aug 07, 2018 7:16 am
Forum: SMILE
Topic: pysmile k-fold CV
Replies: 5
Views: 57344

Re: pysmile k-fold CV

1.
I'm assuming, that you initialized dataset and network properly (as ex. ds and net).


node_id = "someNodeIdentifier"
matching = ds.match_network(net)
validator = pysmile.Validator(net, ds, matching)
validator.add_class_node(node_id)
em = pysmile.Learning.EM()
em.learn(ds, net, matching ...