Ranking NFTs :
Here's a small description of how the rarity score is calculated and how the NFTs are ranked in the provided script:
Rarity Score Calculation:
The script assigns a rarity score to each trait based on its rarity. The rarer the trait, the higher the rarity score.
The rarity score for each trait is calculated by taking the inverse of the occurrence count.
For example, if a trait has an occurrence count of 10, its rarity score will be (1/10)*10000 = 1000. If a trait has an occurrence count of 100, its rarity score will be (1/100)*10000 = 100.
This calculation ensures that rarer traits have higher rarity scores.
Ranking NFTs:
The script iterates over each NFT and calculates its rarity score based on the traits it possesses.
The rarity score for an NFT is determined by summing up the rarity scores of all the traits present in that NFT.
NFTs with higher rarity scores are considered rarer and are given higher ranks.
The NFTs are then sorted in descending order based on their rarity scores, with the highest rarity score obtaining the highest rank.
By calculating the rarity score for each NFT based on the rarity of its traits and sorting them based on their rarity scores, the script ranks the NFTs in descending order of rarity. The highest-ranked NFT will have the rarest combination of traits, while the lower-ranked NFTs will have less rare combinations of traits.
Last updated