Reddits 된 공식과
조금 떨어져 하락은 기본적으로 당신은 레딧의 공식을 사용할 수 있습니다. 뒤에
기본 사항 :
def hotness(track)
s = track.playedCount
s = s + 2*track.downloadCount
s = s + 3*track.likeCount
s = s + 4*track.favCount
baseScore = log(max(s,1))
timeDiff = (now - track.uploaded).toWeeks
if(timeDiff > 1)
x = timeDiff - 1
baseScore = baseScore * exp(-8*x*x)
return baseScore
요인 exp(-8*x*x)
당신에게 떨어져 원하는 드롭을 줄 것이다 : 시스템은 upvotes을 지원하기 때문에이 같은 결과를 체중 수
점수가 올라가는 것보다 빠르게 0이되는 기능을 사용할 수 있습니다. 우리의 점수에 log
을 사용했기 때문에 심지어 선형 함수도 곱해질 수 있습니다 (점수가 기하 급수적으로 증가하지 않는 한).
그래서 점수를 수정하고 싶지 않은 경우에만 1
을 반환하는 함수가 필요합니다. 위의 예는 다음과 같은 기능을합니다.
multiplier(x) = x > 1 ? exp(-8*x*x) : 1
가파른 곡선이 덜 필요하면 승수를 변경할 수 있습니다.
++ C에서
예는 소정의 트랙에 대한 확률은 주어진 시간에서 50 %이다 재생할 수 있다고 1 % 좋아하는 0.1 %와 같이 10 %를 다운로드 할 수 있습니다. 그런 다음 C++ 프로그램 점수 동작 당신에게 견적을 줄 것이다 :
#include <iostream>
#include <fstream>
#include <random>
#include <ctime>
#include <cmath>
struct track{
track() : uploadTime(0),playCount(0),downCount(0),likeCount(0),faveCount(0){}
std::time_t uploadTime;
unsigned int playCount;
unsigned int downCount;
unsigned int likeCount;
unsigned int faveCount;
void addPlay(unsigned int n = 1){ playCount += n;}
void addDown(unsigned int n = 1){ downCount += n;}
void addLike(unsigned int n = 1){ likeCount += n;}
void addFave(unsigned int n = 1){ faveCount += n;}
unsigned int baseScore(){
return playCount +
2 * downCount +
3 * likeCount +
4 * faveCount;
}
};
int main(){
track test;
const unsigned int dayLength = 24 * 3600;
const unsigned int weekLength = dayLength * 7;
std::mt19937 gen(std::time(0));
std::bernoulli_distribution playProb(0.5);
std::bernoulli_distribution downProb(0.1);
std::bernoulli_distribution likeProb(0.01);
std::bernoulli_distribution faveProb(0.001);
std::ofstream fakeRecord("fakeRecord.dat");
std::ofstream fakeRecordDecay("fakeRecordDecay.dat");
for(unsigned int i = 0; i < weekLength * 3; i += 3600){
test.addPlay(playProb(gen));
test.addDown(downProb(gen));
test.addLike(likeProb(gen));
test.addFave(faveProb(gen));
double baseScore = std::log(std::max<unsigned int>(1,test.baseScore()));
double timePoint = static_cast<double>(i)/weekLength;
fakeRecord << timePoint << " " << baseScore << std::endl;
if(timePoint > 1){
double x = timePoint - 1;
fakeRecordDecay << timePoint << " " << (baseScore * std::exp(-8*x*x)) << std::endl;
}
else
fakeRecordDecay << timePoint << " " << baseScore << std::endl;
}
return 0;
}
결과 :
이 당신을 위해 충분합니다.
그럼 뭐가 문제입니까? –
시간이 지남에 따라 뜨거운 콘텐츠가 표시 되나요? [열기 방정식] (http://en.wikipedia.org/wiki/Heat_equation)에 대해 이야기하고 있습니까? 나, 진지하게, 당신 자신에 대해 생각해야만합니다. 열 방정식이 당신에게 아이디어를 줄 수는 있습니다. – Zeta
그럼 질문은 정말로 내가 찾는 방정식의 종류입니다. 나는 Zeta가 이것을 대답했다고 생각합니다. 나는 정확히이 수준의 수학과 방정식에 열정이 없다. 나는 누군가가 전에 이것에 대한 경험이 있었으면하고 유용한 블로그를 찾았 으면한다. –