Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve: improved rating algorithm wip #49

Merged
merged 3 commits into from
Jul 15, 2020
Merged

improve: improved rating algorithm wip #49

merged 3 commits into from
Jul 15, 2020

Conversation

anuraghazra
Copy link
Owner

@anuraghazra anuraghazra commented Jul 14, 2020

Related issues
#41
#39

NOTE: i suck at math, so i'm just experimenting and doing trial and error to get the correct results.

@@ -1,3 +1,21 @@
// https://stackoverflow.com/a/5263759/10629172
function normalcdf(mean, sigma, to) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really have no idea what this does but i'm just experimenting it's a Cumulative distribution function : https://stackoverflow.com/questions/5259421/cumulative-distribution-function-in-javascript/5263759#5263759

Comment on lines +34 to +51
const REPO_OFFSET = 1;

const ALL_OFFSETS =
CONTRIBS_OFFSET +
ISSUES_OFFSET +
STARS_OFFSET +
PRS_OFFSET +
FOLLOWERS_OFFSET +
REPO_OFFSET;

const FIRST_STEP = 0;
const SECOND_STEP = 5;
const THIRD_STEP = 20;
const FOURTH_STEP = 50;
const FIFTH_STEP = 130;
const RANK_S_VALUE = 1;
const RANK_DOUBLE_A_VALUE = 25;
const RANK_A2_VALUE = 45;
const RANK_A3_VALUE = 60;
const RANK_B_VALUE = 100;

const TOTAL_VALUES =
RANK_S_VALUE + RANK_A2_VALUE + RANK_A3_VALUE + RANK_B_VALUE;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding all the OFFSETS & conditional values and feeding it to that function, all values are result of trial and errors

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anuraghazra Hi, I wanted to know , what are these offsets are for and how are they calculated??/

} else if (score > FOURTH_STEP && score <= FIFTH_STEP) {
level = "A++";
} else if (score > FIFTH_STEP) {
if (normalizedScore < RANK_S_VALUE) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

normalizedScore is for some reason reverse that means the better your score is the normalized score would be closer to 0

Users like

  • yyx990803
  • kentcdodds
  • gaearon

all are close to 0

@anuraghazra
Copy link
Owner Author

related to #40 #41

#41 (comment)

@vinayaksh42 @garvit-joshi can you guys check and see if anything you want to improve or review the code?

@anuraghazra
Copy link
Owner Author

anuraghazra commented Jul 14, 2020

Development preview
use this preview link to check the updates https://github-readme-stats.anuraghazra1.vercel.app/api?username=kentcdodds (note: don't use it on production)

Copy link

@vinayaksh42 vinayaksh42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, surely a much better way to calculate ranks.

@garvit-joshi
Copy link

I am not that good with maths either, but preview is quite Amazing

@anuraghazra
Copy link
Owner Author

Development preview
use this preview link to check the updates https://github-readme-stats.anuraghazra1.vercel.app/api?username=kentcdodds (note: don't use it on production)

I think guys this is a lot better. @garvit-joshi @vinayaksh42 perfectly balanced to A and A++ and S, S+ ranks are hard to get, even kentcdodds did not get S+ rank.

also fixed #39 as you can see MichaelDeBoey had 19k stars which was because of forks so i filtered them out.

@@ -26,7 +26,7 @@ const fetcher = (variables, token) => {
followers {
totalCount
}
repositories(first: 100, orderBy: { direction: DESC, field: STARGAZERS }) {
repositories(first: 100, ownerAffiliations: OWNER, isFork: false, orderBy: {direction: DESC, field: STARGAZERS}) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filter out own repos, and forked repos

@anuraghazra anuraghazra merged commit 987fb0c into master Jul 15, 2020
@anuraghazra anuraghazra deleted the ranking-algo branch October 31, 2020 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants