We haven't had a KBC in a while, and it's sad that the newest users haven't experienced their unadulterated glory yet, so here is a new one.
What will be this question's comment threads h-index?
We define this question's comment threads h-index as:
Where is the highest number such that this question has comment threads with at least unique users each, and is the number of comment threads with at least unique users.
A thread's users are all the users who commented on it, including the top level comment. Only users who joined before 2021-03-29 and are level 2+ at time of resolution will be counted.
The author has generated a secret resolution time between 2021-04-03 09:00:00 and 2021-04-03 21:00:00 (UTC+).
At the secret resolution time, the h-index will be determined, and this question will be retroactively closed and resolved. Only comments posted before the resolution time will count.
I know this isn't actually a KBC.
The h-index will be computed with this script:
import requests, json
from collections import defaultdict
from functools import lru_cache
def get_comments():
url = "https://www.metaculus.com/api2/comments/?order_by=-created_time&question=6945"
comments = []
while url is not None:
data = json.loads(requests.get(url).text)
url = data["next"]
comments += data["results"]
return comments
def get_thread_user_counts(comments):
comment_threads = defaultdict(set)
for c in comments:
if c["created_time"] > "2021-04-03 09:00:00":
continue
comment_threads[c["id"] if c["parent"] is None else c["parent"]].add(c["author"])
return list(map(lambda s: len([u for u in s if is_user_valid(u)]), comment_threads.values()))
@lru_cache
def is_user_valid(user_id):
url = f"https://www.metaculus.com/api2/users/{user_id}/"
data = json.loads(requests.get(url).text)
return data["date_joined"] < "2021-03-29" and data["level"] >= 2
def get_h_index(values):
h_index_arr = [0 for _ in range(len(values)+1)]
for v in values:
h_index_arr[min(v,len(values) )] += 1
total = 0
for (i, v) in reversed(list(enumerate(h_index_arr))):
total += v
if total >= i:
return i + len([0 for j in values if j >= i+1])/(i+1)
return 0
comments = get_comments()
values = get_thread_user_counts(comments)
print(get_h_index(values))