geo_median.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:chi-2016-localness 作者: joh12041 项目源码 文件源码
def objfunc(test_median, data_points):
    """This function calculates the sum of linear distances from the current candidate median to all points
    in the data set, as such it is the objective function that we are minimising.
    """
    temp = 0.0
    for i in range(0, len(data_points)):
        try:
            temp += vincenty(test_median, data_points[i]).kilometers
        except ValueError:
            # Vincenty doesn't always converge so fall back on great circle distance which is less accurate but always converges
            temp += great_circle(test_median, data_points[i]).kilometers
    return temp
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号