MoleTrust
From TrustLet, a free, collaborative project for collecting and analyzing information about trust metrics.
MoleTrust is a local trust metric proposed by Paolo Massa and Paolo Avesani[1].
Users are ordered based on their distance from the source user, and only trust edges that go from distance n to distance n+1 are regarded. The trust value of users at distance x only depend on the already calculated trust values at distance x-1. The scores that are lower than a specific threshold value are discarded, and the trust score is the average of the incoming trust statements weighted over the trust scores of the nodes at distance x-1. It is possible to control the locality by setting the trust propagation horizon, I.e. the maximum distance to which trust can be propagated.
Contents |
[edit] An example
[edit] Input trust network
[edit] Moletrust first step (with active user "Alice", trust propagation horizon set to 2 and trust threshold set to 0.5)
Users are sorted based on shortest distance from the active user "Alice". Only users inside the trust propagation horizon are kept. Only trust edges going from users at distance n to users at distance n+1 are kept. Only trust edges greater than the trust threshold are kept.
[edit] Moletrust second step
The predicted trust score of a user is the average of all kept incoming trust edge values, weighted by the trust score of the user who has issued the trust statement.
For example, the predicted trust score of Eve is (0.8*0.6+1.0*0.9)/(0.8+1.0) = 0.767
[edit] Some Python code
def moletrust_generator(horizon = 3, pred_node_trust_threshold = 0.5,
edge_trust_threshold = 0.0):
"""Generate moletrust trust metric functions.
Parameters:
horizon: how many levels deep to search the network for a path
(the bigger the horizon the slower the calculation)
pred_node_trust_threshold: if an edge in the calculated chain
has a trust value below this it will be discarded, because we
know from this node on the chain is distrusted.
edge_trust_threshold: an edge with trust < edge_trust_threshold
will be thown out.
"""
def moletrust_tm(G, a, b):
debug = False
if debug:
print "predict trust from", a, "to", b
# Do something with connected_components here?
# UG = G.to_undirected()
# subgraphs = connected_component_subgraphs(UG)
# find a
# if b not in subgraph_with_a:
# return None
# path_length_dict and trust_map should be cached in a very smart way
path_length_dict = path.single_source_shortest_path_length(G, a, horizon)
if b not in path_length_dict or path_length_dict[b] > horizon:
return None
path_length_list = [(y,x) for x,y in path_length_dict.items()]
path_length_list.sort() # order by distance
# initialize trust map with node a and a bunch of empty dicts
trust_map = [{a: 1.0}] + [{}] * horizon
for (dist, node) in path_length_list[1:]:
useful_in_edges = [x in G.in_edges(node) if x[0] in trust_map[dist-1]]
# We have to benchmark this, it could be a lot faster?
#if len(useful_in_edges) == 1:
# pred_trust = G.trust_on_edge(useful_in_edges[0])
# not considering the negative trust (or e.g. <0.5)
# statements, very good for our accuracy! yay! big hugs!
useful_in_edges = [x in useful_in_edges if G.trust_on_edge(x) >= edge_trust_threshold]
for edge in useful_in_edges:
if debug: print "useful edge:", edge, "predecessor tvalue", trust_map[dist-1][edge[0]]
pred_trust = weighted_average([(G.trust_on_edge(x), trust_map[dist-1][x[0]])
for x in useful_in_edges])
if node == b:
return pred_trust
# only keep edges over pred_node_trust_threshold
if pred_trust >= pred_node_trust_threshold:
trust_map[dist][node] = pred_trust
return None
return moletrust_tm
[edit] References
- ↑ Massa, P.; Avesani, P. (2005). "Controversial users demand local trust metrics: an experimental study on epinions. com community (link)". Proceedings of the 25th American Association for Artificial Intelligence Conference.
- This article is a stub. You can help by expanding it.

