About prior

3 views
Skip to first unread message

changhe

unread,
Nov 17, 2010, 1:38:40 PM11/17/10
to pebl-project
Hi,All
I want to add some prior before learning.My code is following:
...
pr=prior.Prior(299,required_edges=[(0,0),(0,1)])
learner = greedy.GreedyLearner(dataset,pr)
ex1result = learner.run()
...

The number 299 is the number of nodes in my data.
But I cannot get the edges =[(0,0),(0,1)] in my reaults.
Is something wrong in my code?
Can you give me some suggestions? Thank you!


Best,
Changhe

Abhik Shah

unread,
Nov 17, 2010, 2:33:14 PM11/17/10
to pebl-p...@googlegroups.com
Hi,

The first required edge (0,0) introduces a cycle and this is not
allowed for Bayesian networks. What results are you getting? I'm
assuming that the result object returned by the learner actually
includes no networks.

Abhik.

changhe

unread,
Nov 17, 2010, 3:09:58 PM11/17/10
to pebl-project
Hi,

I use the edge list [(1,2),(2,3)] this time.
And
...
pr=prior.Prior(299,required_edges[(1,2),(2,3)] )
learner = greedy.GreedyLearner(dataset,pr)
ex1result = learner.run()
L=len(ex1result.networks)
net=ex1result.networks[L-1]
print net.score
print list(net.edges)
...

The returned is following.

>>>-inf
>>>[(0, 81), (0, 233), (2, 132), (3, 157), (3, 263), (4, 240),.....

The edge list is not in them. The value of the score is not right!


Thank you!

Changhe
> > Changhe- 隐藏被引用文字 -
>
> - 显示引用的文字 -

Abhik Shah

unread,
Nov 20, 2010, 1:48:06 PM11/20/10
to pebl-p...@googlegroups.com
Hi,

I think I know the cause for this.. The greedy learner doesn't
specifically look at the prior when suggesting networks. So, it
probably cannot find a single network to use as the seed for the
greedy learner because the prior returns -Infinity for any network
without required edges.

This is a limitation of the existing greedy learner. With small number
of nodes, the learner will randomly find networks with the required
edges but not for large networks. For now, you can supply a seed
network that already has the required edges:

seednet = network.Network(dataset.variables, [(1,2),(2,3)])
learner = greedy.GreedyLearner(dataset, pr, seed=seednet)

This way, the search is already starting at a valid network.

Thanks,
Abhik


2010/11/17 changhe <fuch...@gmail.com>:

changhe

unread,
Nov 22, 2010, 10:57:53 AM11/22/10
to pebl-project
Thanks lot, Abhik

Best,
Changhe

On 11月20日, 下午12时48分, Abhik Shah <abhiks...@gmail.com> wrote:
> Hi,
>
> I think I know the cause for this.. The greedy learner doesn't
> specifically look at the prior when suggesting networks. So, it
> probably cannot find a single network to use as the seed for the
> greedy learner because the prior returns -Infinity for any network
> without required edges.
>
> This is a limitation of the existing greedy learner. With small number
> of nodes, the learner will randomly find networks with the required
> edges but not for large networks. For now, you can supply a seed
> network that already has the required edges:
>
> seednet = network.Network(dataset.variables, [(1,2),(2,3)])
> learner = greedy.GreedyLearner(dataset, pr, seed=seednet)
>
> This way, the search is already starting at a valid network.
>
> Thanks,
> Abhik
>
> 2010/11/17 changhe <fuchan...@gmail.com>:
> >> - 显示引用的文字 -- 隐藏被引用文字 -
>
> - 显示引用的文字 -
Reply all
Reply to author
Forward
0 new messages