osome-iu/osometweet

Add FIB score functionality

mr-devs opened this issue · 1 comments

Would be great to build the below into the package somewhere...

def get_fib_scores(rt_counts):
    """
    Calculate the FIB-index.
    
    INPUT:
    - rt_counts (list) : list of retweet count values for all 
    retweets sent by a single user.
    
    OUTPUT:
    - fib_position (int) : super_spreader index where the retweet
    count value (of a sorted list of retweets) is greater than or
    cd  equal to the position in that list.
    """

    rt_counts.sort()

    # The "[::-1]" below makes this for-loop iterate from the last number instead of starting at zero. 
    for fib_position in range(1,len(rt_counts)+1)[::-1]:
        if rt_counts[-fib_position] >= fib_position:
            return fib_position
    
    # If the above criteria is never met, we return the fib_position as zero.
    fib_position = 0
    return fib_position

For anyone else seeing this, this is equivalent to the h-index algorithm - the above is the adapted version for the superspreaders project.

Here is a link to an out-of-the-box script that can take data directly from Moe's tavern.

  • Add function (maybe to utils.py?)
  • Remake the above linked-to script, but for twitter data from V2.

I don't think this makes sense anymore. What makes it the FIB index is just the type of data being processed (RT counts of misinformation-containing posts) - if anything we can just add a basic h-index function. I like that idea but, it sort of renders this issue useless. As a result, I'm closing this.