我正试图根据类似数目、评论和接收和时间的重新定位,为社会网络制定一个简单的排名算法。 我阅读了正文使用的对等等级算法,试图做类似的事情,但我不能正确。
算法现在应显示公众职位。
这里是我尝试的:
let nComments = (from c in db.Comments where c.postid == r.pageOwner.PostId select c).Count()
let nReposts = (from s in db.Posts where s.RepostedFrom_postid == r.pageOwner.PostId select s).Count()
let nLikes = (from u in db.UserPageRelations where u.Post_id == r.pageOwner.PostId select u).Sum(s => s.Rate)
let TimeDecayFactor = ignoretime ? 1 : Math.Exp(-(DateTime.Now - Post.Date).TotalHours)
let TotalEdge = (1 * nComments + 3 * nLikes + 2 * nReposts + 1) * TimeDecayFactor
orderby (TotalEdge) descending
是否有更好的解决办法?