CAT | Projects
15
A software agent using bayesian trust, and decision tree learning
0 Comments | Posted by Chris Fournier in Projects, Software Agents, trust
As a group term project for my Software Agents Design course, Catalin Patulea, Mike Lepard, Pierre Dinnissen and I developed a software agent using Java for the Agent Reputation and Trust (ART) Testbed, called the CCMPAgent. Unlike most academic software projects, our professor encouraged us to not only develop an agent, but also separate the code into distinct, reusable components with a certain degree of software quality. Our particular agent had two interesting components: a WEKA based learning framework; and the bayesian trust framework. The learning framework was required so that the agent could understand how to act inside the ART testbed (which is essentially a game setting, pitting all the software agents playing against each other), and the trust framework was required to by the agent to keep track of whether it should cooperate, or not, with the other agents it was competing against. To add to the quality, we wrote javadoc documentation, performed unit testing on key components, and wrote documentation that described the system.
The ART testbed
The ART testbed is designed to test a software agent’s ‘trust’ functionality. The agents all participate in a game, and interact with eachother, where the goal is to end up with the most virtual currency at the end. Specifically, it is an art trading game:
“Clients request appraisals for paintings from different eras; if an appraiser agent does not have the expertise to complete the appraisal, it can request, at a price, opinions from other appraiser agents. Appraiser agents may also purchase from each other reputation information about other appraisers. Appraiser agents must decide when, and from whom, to request opinions and reputation information to generate accurate appraisals for clients. Appraisers receive more clients, and thus more profit, for producing more accurate appraisals. The winning appraiser agent is selected as the appraiser with the highest bank account balance.” [ART]
Navigating ART is a difficult task, and if you too want to develop an agent then read the: game description, ART usage documentation, ART 2.1.1 javadoc, and start by looking at our SimpleCCMPAgent as an example.
What is trust?
Trust between software agents is a measurement of the degree to which a software agent trusts the other entities it interacts with. How do we determine whether we can interact with another, in a particular context, and trust that we will have a satisfactory encounter? Will another agent lie to us if we ask them a question, or will they cooperate? How do we take the information we know about another and determine whether we should trust them? Some information we could be provided with includes satisfaction of past encounters, recommendations from agents about other agents, and initial preconceptions.
Trust can be applied to P2P networks to determine whether we trust particular nodes to provide files, or other information. Does it have a fake file? Or does it have a real file, but is the node’s network connection unstable, making it untrustworthy?
If you want to add trust metrics to your software, there are many existing trust frameworks to choose from, including Peer Trust, Advogato, Eigen Trust, and Bayesian Trust. To handle trust in our agent, we chose to implement Bayesian Trust, detailed in the paper entitled “B-trust: Bayesian trust framework for pervasive computing” [Quercia et al.] by D. Quercia, S. Hailes, and L. Capra. We chose this paper because it’s data structures scale linearly with respect to the number of other agents tracked; and it embodies what the paper describes as three main properties of trust:
- Subjectiveness: identical actions taken by different agents may lead to different levels of trust;
- Context-dependence: trust in one context does not necessarily transfer to another; and
- Dynamism: trust should increase after successful observations, and decay over time.
After implementing this paper, we enabled our agent to track the trustworthiness of the other agents it interacted with in the ART testbed (given recommendations from other agents, which may have been untrustworthy themselves, and direct interactions). For further information on trust, see the slides of the talks by Steve Marsh, and his other publications.
Bayestrustlib
A few changes were made in the math seen in the original B-trust paper, and are summed up in our term report [pdf] on the agent for our class [CCMPAgent]. The framework is written in Java (1.5), and is licensed under the BSD license. You can download the bayestrustlib [jar] itself, view the source, and the javadoc documentation needed to use it. The bayestrustlib project itself contains 58 unit tests to verify the underlying math.
Usage
Using the bayestrustlib is quite easy. Simply add bayestrustlib.jar to your project, and create a new instance of the BayesTrust class. You must specify the number of levels of trust your agent will understand, and all the potential contexts (interactions) you will have.
int nLevels = 3;
List contexts = new LinkedList();
Context c1 = new Context("asking for a recommendation");
Context c2 = new Context("asking for an appraisal");
contexts.add(c1);
contexts.add(c2);
BayesTrust trust = new BayesTrust(nLevels, contexts);
When you meet a new entity (agent, or human) that you intend to interact with, you have to notify the library about it’s name.
Peer p2 = new Peer("agent 2");
trust.addPeer(p1);
trust.addPeer(p2);
If you have an encounter with an entity, you can record your satisfaction in the encounter with the entity as a continuous value between 0 and 1 (which should relate to your trust levels you have defined).
trust.storeEncounter(c1, p1, satisfaction);
If you ask an entity for a recommendation about another entity, you can record that value as a continuous value between 0 and 1.
trust.storeRecommendation(c1, p1, p2, recommendation);
After collecting data, you may wish to determine your level of trust in another agent for a particular context. This allows you to determine whether you should interact with a particular entity, and situation.
But how do we know that we have collected enough information to trust this trust value? Trust values are initialized to a trust value that has low confidence. After calls to storeEncounter(), and storeRecommendation(), we can assume that our confidence should increase. To measure the confidence in a trust value, we measure the variance of our probability mass function of our trust values (more details on this can be found in the Bayesian Trust Framework, Theory section of our term report [pdf]), which can be obtained by calling the following API:
That covers the basic functionality of bayestrustlib, and don’t worry, if you make a mistake on the input values, a number of custom exceptions will inform you of how you went wrong. For a complete example of an implementation, see the BayesTrustNetwork class of the CCMPAgent agent project.
References
[ART] Agent Reputation and Trust (ART) Testbed.Game Description. http://megatron.iiia.csic.es/art-testbed/competition_rules.htm; accessed Dec. 15, 2009, Feb. 28 2008.
[Quercia et al.] D. Quercia, S. Hailes, and L. Capra, “B-trust: Bayesian trust framework for pervasive computing,” in iTrust, pp. 298-312, 2006.
[CCMPAgent] C. Patulea, C. Fournier, M. Lepard, and P. Dinnissen, “SYSC 5103 Term Project: CCMP Agent for the ART 2.1.1 Test Framework.” http://cloud.github.com/downloads/cfournie/ccmpagent/report.pdf; accessed Dec. 15, 2009, Dec. 7 2009.


