Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [recommenders-dev] About the Bayesian network in Eclipse Code Recommenders

Hi Cheng,

On 06.08.2012, at 17:35, Cheng Zhang wrote:

> Hi Marcel,
> 
> Thank you for spending more than an hour to help us understand the Bayesian network.
> 
> After our discussion, we have studied Bayesian network and the relevant
> code in Eclipse Code Recommenders more carefully. Still, we have a couple
> of questions:
> 
> 1. You pointed out to us the code that uses the built model, but we also
>    want to learn the way of model building. Unfortunately, we failed to
>    find the code for this part. Is this part of code not publicly available?
>    Or we just overlooked it?

See /org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ClassOverridesNetworkBuilder.java for an example how to create a bayesian network from some json input. It consists of two node types only: one "pattern node” and a list of "method nodes” encoding the overridable methods of a java base class. The method nodes encode the likelihood a method is overridden given a pattern in the pattern node. You will notice that we don’t use 1 and 0 as probabilities but MIN/MAX which are “close to 1/0”. This is because we want to allow some unexpected patterns.

If you could explain which structure your are trying to implement I may be able to assist with a more concrete example.

> 
> 2. In your previous approach (FSE' 09 paper), the method contexts are treated
>    as a feature which seems similar to other features (i.e. method calls).
>    In the current approach, the method contexts seem to be used differently
>    than the method calls (and you used orange and blue to distinguish the nodes).
>    Would you please explain a bit more on this?

see below.


> 3. Using the JDT debugger, we have inspected the run-time data of a Bayesian network. 
>    It seems that there are two layers in the network: the top layer is the "patterns" and
>    the bottom layer consists of the "method calls". Is our understanding correct?
>    Is it possible that a Bayesian network in Code Recommenders has more than two
>    layers? If so, would you please show us a simple example?

The current general network layout is depicted below:

PNG image

the MethodN, Patterns, and Contexts node is what you already know. Kinds and Definitions are ’new’. Note that you may observer values in all nodes *except* the patterns node. It’s just a “virtual node” that connects all information. You may observe a call to method3 for a variable v --> set Method3=true. Setting this value to true updates the probabilities of all other MethodN, Contexts, Kinds, Definitions Nodes in the net.
If you observe another method call, say, to Method2 --> set the state true of node Method2 to observed again. Again this updates the probabilities of all other nodes and their states. You now just have to read the values of each state in every node and create your proposals.


Can you draw a similar figure for your network? If you like we can work on such a structure together.


> Thanks again for your help and suggestions :)

HTH,
Marcel


> Best,
> Cheng 
> _______________________________________________
> recommenders-dev mailing list
> recommenders-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/recommenders-dev


Back to the top