LogoLogo
  • OpenRank
    • Ranking and Reputation
    • Use Cases
  • The Reputation Stack
    • Data
    • OpenRank Protocol
    • Apps and Clients
  • Integrations
    • Farcaster
      • Openrank Scores Onchain
      • Ranking Strategies on Farcaster
      • Global Profile Ranking
        • 🔵Top Profiles (based on Following)
        • 🔵Top Profiles (based on Engagement)
        • 🟢Profile Rank (based on Following)
        • 🟢Profile Rank (based on Engagement)
      • Channel User Rankings
        • 🔵Top Profiles in Channel
        • 🟢Profile Rank in Channel
      • Personalized Network
        • Direct Network
          • 🟢Get Direct Following
          • 🟢Get Direct Engagement
        • Extended Network
          • 🟢Personalized Following
          • 🟢Personalized Engagement
      • Frames
        • 🔵Top Frames
        • 🟢Personalized Recommended Frames
      • Feeds
        • For You Feed
          • 🔵For You
          • 🔵For You (by Authorship)
        • Channel Feed
          • 🔵Channel Trending Casts
      • Metadata
        • 🟢Get FIDs for Addresses
        • 🟢Get Handles For Addresses
        • 🟢Get Addresses for FIDs
        • 🟢Get Addresses for Handles
      • Ideas to Build using OpenRank APIs
      • Neynar x OpenRank Guides (WIP)
        • Build "For You" Feeds for your Client, using Neynar and OpenRank
        • Build "User Search" using Neynar and OpenRanks' Global Ranking API
        • Build "Suggested follow list" based on OpenRank and Neynar
        • Build Channel Trending Feeds for your Client using Neynar and OpenRank APIs
        • Build "Discover New Users Feed" using Neynar and OpenRanks Global Ranking API
        • Build Power Badges for your Client using Global & Personalized Ranking APIs by OpenRank
        • Build "Sort Replies" on a cast using Neynar and OpenRanks' Global Ranking API
    • Clanker OpenRank Scores
    • Lens Protocol
      • Ranking Strategies on Lens
      • Lens Profile APIs
      • Lens Content APIs
      • Lens Profile Insights
    • Metamask SPD
    • Onchain Graphs and Feeds
    • Upcoming Integrations
    • GitHub Developers & Repo Ranking
  • Reputation Algorithms
    • EigenTrust
    • Hubs and Authorities
    • Latent Semantic Analysis
  • OpenRank SDK
    • Introduction
    • Creating your first reputation graph
    • Publishing Rankings with OpenRank SDK
    • Guides
      • Tipping based User Rankings powered by OpenRank
    • Installation
    • SDK References
      • EigenTrust
        • Installation and Use
        • Examples for using EigenTrust
      • Hubs & Authorities
        • Installation and Use
        • Examples for using Hubs & Authorities (Coming soon)
      • Latent Semantic Analysis (Coming soon)
Powered by GitBook
LogoLogo

SOCIALS

  • Github
  • Farcaster

Copyright 2024

On this page
  1. OpenRank SDK

Creating your first reputation graph

This is a getting started guide that lets you create a set of rankings (trust graph) for a sample dataset provided

PreviousIntroductionNextPublishing Rankings with OpenRank SDK

Last updated 9 months ago

Overview

OpenRank SDK allows you to compute trust rankings among peer to peer interaction data using the as one of the available options. You'll need to provide local trust data.

Installation

First, install the OpenRank SDK:

pip install openrank-sdk

Sample Local Trust Data (Input)

Local trust represents trust relationships between peers:

codelocaltrust = [
    {"i": "alice", "j": "bob", "v": 100},
    {"i": "charlie", "j": "bob", "v": 100},
    {"i": "alice", "j": "charlie", "v": 75}
]

Alternatively, use a CSV file:

from,to,value
alice,bob,100
charlie,bob,100
alice,charlie,75

Running the EigenTrust Algorithm

To compute trust rankings, use the EigenTrust class:

from openrank_sdk import EigenTrust

api_key = 'your_api_key'
a = EigenTrust(api_key=api_key)

# Option A - Using local variables
a.run_eigentrust(localtrust)
a.run_eigentrust(localtrust, pretrust)

# Option B - Using CSV files
a.run_eigentrust_from_csv("./lt.csv")
a.run_eigentrust_from_csv("./lt.csv", "./pt.csv")

Example Output

The output will show the trust rankings:

pythonCopy code[
  {'i': 'Charlie', 'v': 0.485969387755102},
  {'i': 'Bob', 'v': 0.2933673469387755},
  {'i': 'Alice', 'v': 0.22066326530612243}
]

This introduction covers the basic steps to create a trust graph using OpenRank SDK.

EigenTrust algorithm