【问题标题】:Understanding terms for h-index calculation了解 h 指数计算的术语
【发布时间】:2020-08-01 08:35:01
【问题描述】:

我正在尝试为我的研究引用创建一个 h-index 计算器 (https://en.wikipedia.org/wiki/H-index#Calculation),但我对如何以代码形式表示数学感到困惑(可悲的是,这不是我的强项)。以下是来自 wiki 的计算:

h 指数(f) =

并排时 max min 是什么意思?我似乎无法在网上找到任何关于它的信息。我认为最大值下方的“i”代表等式中使用的值范围的开始。我查看了多个网站以获得比大量 IF 语句更简单/更优雅的计算,但无济于事。

抱歉,如果这不是在正确类型的论坛上发布的。我不是要别人写代码,只是想帮助理解如何在 python 或 excel 中表示不同的术语。

感谢您的帮助

【问题讨论】:

  • 这个想法是,对于i 的每个值,您取 i 和 f(i) 的最小值,然后获得这些值的最大值(对于所有 i)。请注意,您的数据必须首先进行排序,以便 f 递减,正如 Wikipedia 文章中所解释的那样。

标签: python excel calculation


【解决方案1】:
def get_h_index(citations):
    citations = sorted(citations, reverse=True)
    for idx, item in enumerate(citations, 1):
        if item < idx:
            break
    return idx - 1

citations = [10,8,5,4,3]
h_index = get_h_index(citations)
print(h_index)
# yields 4

other_citations = [25,8,5,3,3]
h_index = get_h_index(other_citations)
print(h_index)
# yields 3

【讨论】:

  • 你也可以给enumerate一个起始值:for idx, item in enumerate(citations, 1): if citations[idx] &lt; idx:
  • @ThierryLathuille 在这种情况下我不会这样做,因为那样你就必须在 for 循环中访问 c​​itations[idx-1] ,因此 1-indexing 的收益被内部增加的复杂性所抵消的循环。通常,我完全支持 1 索引枚举。
  • 哦,我误读了您的代码并照原样复制粘贴...无论如何,您根本不应该使用citations[idx],因为它是item。所以,要走的路是:for idx, item in enumerate(citations, 1): if item &lt; idx:。这就是enumerate 的全部意义所在。
  • 啊,对,你仍然返回 idx - 1 这有点尴尬,但也许是一个小的改进。我已经编辑了代码。
【解决方案2】:

如果你想计算 h-index,你可以使用scholarmetrics 模块。 https://scholarmetrics.readthedocs.io/en/latest/

【讨论】:

    【解决方案3】:

    maxmin 没有什么特别的含义 你是在寻求最大化 f(i)i 的最小值。

    对于 i 的每个值,您计算 f(i)i 并取这两个值中的较小值(最小值)。如果我们称这个最小值为 g(i),我们正在寻找 g(i) 的最大值。

    【讨论】:

      猜你喜欢
      • 2011-09-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多