Computing Reputation for Discourse users with Aigents

Aigents with Anton Kolonin
SingularityNET
Published in
7 min readMar 27, 2020

Making Reputation Assessment with SingularityNET “Weighted Liquid Rank” algorithm available for any Discourse forum community.

In our previous two blog posts on this subject, we have discussed how to create and utilise personal social and graph analytics for Discourse communities with Aigents® and how the Aigents implementation of the SingularityNET Reputation API is designed.

In this the third blog post in the series, we’ll explore the practical aspects of using the Aigents® reputation engine to compute reputation ranks for Discourse forums. The results of the integration will be presented at the end of the post, so feel free to scroll down if you want to access the data straight away.

How to Plug Aigents into Discourse

The first thing you will need to do is to install and configure the Aigents server. Once this is done you will need to configure the Aigents server to start computing reputation for a Discourse server, which can be done in just four steps using chat with Aigents in the Web UI (as shown below), or using Aigents bot on any messenger such as on Telegram, Facebook Messenger or Slack. Please note that you should be an administrator on both Discourse and Aigents servers.

Aigents server to start computing reputation for a Discourse server in Aigents Web UI Demo chat using https://community.singularitynet.io/ forum and “akolonin” user as example.
  1. Set URL for Discourse forum being integrated saying “your discourse url https://mydiscourseforum.mysite.org” (use actual site name).
  2. Set API key for Discourse forum being integrated saying “your discourse key 111222333444555aaabbbcccddd” (use actual API key from Discourse admin console).
  3. Set primary Reputation System for Aigents server saying “your reputation system discourse” (Aigents server may have multiple reputation systems running but the only one will be maintained automatically, so you may skip this step but will have to do daily updates of the reputation states).
  4. Set discourse id for either entire Aigents server or the current use saying either “your discourse id discourse-admin-username” or “my discourse id discourse-admin-username” (the discourse id discourse-admin-username have to be real username on Discourse server and it has to be unique in Aigents, so if you are acting as a Discourse user in Aigents yourself, you should use the second option, being admin both of Aigents and Discourse).

There is an extra step that you may want to take — set up the retention period, because the Aigents server cleanups the data older than X number of days configured with this server option. So if you want to handle Discourse reputation data for one year period, type “your retention period 365” in chat.

Once the above is set-up, you can start updating Discourse data in Aigents operating with a reputation of a connected Discourse community.

Updating Discourse Data in Aigents

The synchronisation of Discourse data, including Reputation, is done by Aigents on a daily basis automatically, but if you like you can speed things up.

In order to resynchronise the interaction logs between the community users with Aigents Temporal Graph database, you just need to type “you crawl discourse” in Aigents chat.

Caveat: it may take a long time, depending on the volume of the discourse communications (for instance, resynchronisation of https://community.singularitynet.io/ took about two days). The logic of synchronisation can be discovered in the Aigents Discourse plugin code.

While synchronisation is running, you can keep checking the results inside the “discourse” subfolder. Tip: There is no way to stop the first (and only the first) resynchronisation process, so if you find it goes too far into the past, looking in the produced database files in this folder, you can simply restart the server and move onto the following steps. The subsequent re-synchronisations will be done incrementally and stopped automatically.

Further, once the resynchronisation process is in place, the computation o Reputation will be done silently under the hood, but you can enforce it as well, saying “reputation update” in the chat. Tip: Reputation update is done using default parameters of the Reputation System so if you want parameters other than the default, set them in advance as discussed further.

Operating the Reputation System

The Aigents implementation of the SingularityNET Reputation System API can be accessed in two ways — using SingularityNET Reputation in Python and using native Aigents chat (as shown above, but using a specific set of commands) or Aigents REST-style API (using the same commands).

  1. The SingularityNET Reputation in Python provides interfaces to source ratings (clear_ratings, put_ratings, get_ratings) and computed reputation ranks (clear_ranks, update_ranks, get_ranks, get_ranks_dict) as well as interface to deal with computation parameters (set_parameters, get_parameters). To run the Aigents version of Python interface, use the Aigents wrapper with server connection and authentication parameters of the same Aigents admin user as above. Tip: The parameters are not persistent, so if you restart the Aigents server you need to re-set the parameters with your designated values again.
  2. Using Aigents chat Aigents REST-style Reputation API which implements the same SingularityNET Reputation API as above and few more options that we will be using below. The Aigents Reputationer subsystem entry point is act() method which is referenced by its Conversation subsystem’s tryReputationer() method. The configuration and authentication of the Aigents REST-style API are available.

Getting the Discourse Reputation Data

Once the above is set up, and the resynchronisation is complete, we can use one of two options to get the data — as shown in the Aigents chat (but you can do it over HTTP in the same way).

Using Aigents Web Demo to set up, update and get reputation ranks for Discourse community

The following commands can be used.

  1. reputation network discourse clear ranks” — to zap all computed reputation ranks but keep all synchronised ratings (“reputation network discourse clear ratings” will do that erasing the resynchronisation results, so don’t do the latter).
  2. “reputation network discourse set parameters default 0.5 decayed 0.5 conservatism 0.8” — to set the designated parameters like we have found to be the best for the case below. See the default parameters in Aigents ReputationParameters code.
  3. reputation update” — is not a Reputation API command but an Aigents server macro command which recomputes reputation ranks for every day starting retention period days back till yesterday.
  4. reputation network discourse get ranks since YYYY–MM–DD until YYYY–MM–DD id user1, id user2, id user3” — setting range of dates to retrieve the reputation ranks and listing every user id to get retrieved, like “reputation network discourse get ranks since 2018–05–01 until 2018–05–30 id bengoertzel, id ibby, id Tim, id akolonin, id Arif” as we will present further.
  5. reputation network discourse get ranks date YYYY–MM–DD id user1, id user2, id user3” — to retrieve the reputation ranks for a specific date and listing every user id to get retrieved, like “reputation network discourse get ranks date 2018–05–01 id bengoertzel, id ibby, id Tim, id akolonin, id Arif”.
  6. reputation network discourse get ranks date YYYY–MM–DD” — to retrieve the reputation ranks for a specific date for every user, like “reputation network discourse get ranks date 2018–05–01”.
  7. “my format json” or “my format text” — to get results either in JSON or plain text format.

Making sense of the results

We have done a case study for the first three months of the https://community.singularitynet.io/ Discourse forum during the first three months of its operation, involving the top three influencers discovered during our earlier study with Discourse Aigents Reputation Graph analysis (users called bengoertzel, ibby and Tim) having two semi-random others added to the study (Arif and akolonin).

Exploring the default and decayed parameters set as 0.1 (above) and 0.5 (below), with conservatism set as 0.5

We ran the script above with different values of default and decayed parameters (0.1 and 0.5) for the Weighted Liquid Rank Reputation Algorithm to see how the levels of the reputation ranks of the users change over time with conservatism set to 0.5. As expected, the lower value of the parameters effected to faster decay of the reputation in periods of inactivity, compared to other users.

Exploring the conservatism parameter set as 0.5 (above) and 0.8 (below) with default and decayed parameters set as 0.5

Further, we then chose the default and decayed to be 0.5 and re-ran the same script with conservatism set as 0.5 and 0.8 to find the curves of the reputation ranks to become much smoother and less sensitive to temporarily periods of user inactivity.

Thus far, we have found Aigents implementation of the SingularityNET Reputation System API with Weighted Liquid Rank algorithm pretty usable to compute reputations of the users in any Discourse community.

We ask you to try it and let us know your feedback!

Join Us

SingularityNET plans to reinforce and expand its collaborations to shape the coming AI Singularity into a positive one, for all. To read more about our recent news click here.

And if you have an idea for AI tools or services you’d like to see appear on the platform, you can request them on the Request for AI Portal.

--

--

Aigents with Anton Kolonin
SingularityNET

Creating personal artificial intelligence and agents of collective intelligence for individuals and small businesses.