@xyo-network/crypto-nft-collection-diviner-score-plugin 2.75.15 → 2.75.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/docs.json +12 -12
  2. package/package.json +15 -15
  3. package/dist/browser/Diviner.cjs +0 -143
  4. package/dist/browser/Diviner.cjs.map +0 -1
  5. package/dist/browser/Diviner.js +0 -126
  6. package/dist/browser/Diviner.js.map +0 -1
  7. package/dist/browser/Plugin.cjs +0 -159
  8. package/dist/browser/Plugin.cjs.map +0 -1
  9. package/dist/browser/Plugin.js +0 -142
  10. package/dist/browser/Plugin.js.map +0 -1
  11. package/dist/browser/lib/index.cjs +0 -115
  12. package/dist/browser/lib/index.cjs.map +0 -1
  13. package/dist/browser/lib/index.js +0 -92
  14. package/dist/browser/lib/index.js.map +0 -1
  15. package/dist/browser/lib/rating/analyzeNftCollection.cjs +0 -115
  16. package/dist/browser/lib/rating/analyzeNftCollection.cjs.map +0 -1
  17. package/dist/browser/lib/rating/analyzeNftCollection.js +0 -92
  18. package/dist/browser/lib/rating/analyzeNftCollection.js.map +0 -1
  19. package/dist/browser/lib/rating/criteria/index.cjs +0 -101
  20. package/dist/browser/lib/rating/criteria/index.cjs.map +0 -1
  21. package/dist/browser/lib/rating/criteria/index.js +0 -78
  22. package/dist/browser/lib/rating/criteria/index.js.map +0 -1
  23. package/dist/browser/lib/rating/criteria/scoring/index.cjs +0 -97
  24. package/dist/browser/lib/rating/criteria/scoring/index.cjs.map +0 -1
  25. package/dist/browser/lib/rating/criteria/scoring/index.js +0 -74
  26. package/dist/browser/lib/rating/criteria/scoring/index.js.map +0 -1
  27. package/dist/browser/lib/rating/criteria/scoring/metadata/index.cjs +0 -76
  28. package/dist/browser/lib/rating/criteria/scoring/metadata/index.cjs.map +0 -1
  29. package/dist/browser/lib/rating/criteria/scoring/metadata/index.js +0 -53
  30. package/dist/browser/lib/rating/criteria/scoring/metadata/index.js.map +0 -1
  31. package/dist/browser/lib/rating/criteria/scoring/metadata/metadata.cjs +0 -76
  32. package/dist/browser/lib/rating/criteria/scoring/metadata/metadata.cjs.map +0 -1
  33. package/dist/browser/lib/rating/criteria/scoring/metadata/metadata.js +0 -53
  34. package/dist/browser/lib/rating/criteria/scoring/metadata/metadata.js.map +0 -1
  35. package/dist/browser/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.cjs +0 -42
  36. package/dist/browser/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.cjs.map +0 -1
  37. package/dist/browser/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.js +0 -21
  38. package/dist/browser/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.js.map +0 -1
  39. package/dist/browser/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.cjs +0 -46
  40. package/dist/browser/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.cjs.map +0 -1
  41. package/dist/browser/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.js +0 -25
  42. package/dist/browser/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.js.map +0 -1
  43. package/dist/browser/lib/rating/criteria/scoring/total.cjs +0 -44
  44. package/dist/browser/lib/rating/criteria/scoring/total.cjs.map +0 -1
  45. package/dist/browser/lib/rating/criteria/scoring/total.js +0 -23
  46. package/dist/browser/lib/rating/criteria/scoring/total.js.map +0 -1
  47. package/dist/browser/lib/rating/index.cjs +0 -115
  48. package/dist/browser/lib/rating/index.cjs.map +0 -1
  49. package/dist/browser/lib/rating/index.js +0 -92
  50. package/dist/browser/lib/rating/index.js.map +0 -1
  51. package/dist/node/Diviner.js +0 -147
  52. package/dist/node/Diviner.js.map +0 -1
  53. package/dist/node/Diviner.mjs +0 -126
  54. package/dist/node/Diviner.mjs.map +0 -1
  55. package/dist/node/Plugin.js +0 -163
  56. package/dist/node/Plugin.js.map +0 -1
  57. package/dist/node/Plugin.mjs +0 -142
  58. package/dist/node/Plugin.mjs.map +0 -1
  59. package/dist/node/lib/index.js +0 -119
  60. package/dist/node/lib/index.js.map +0 -1
  61. package/dist/node/lib/index.mjs +0 -92
  62. package/dist/node/lib/index.mjs.map +0 -1
  63. package/dist/node/lib/rating/analyzeNftCollection.js +0 -119
  64. package/dist/node/lib/rating/analyzeNftCollection.js.map +0 -1
  65. package/dist/node/lib/rating/analyzeNftCollection.mjs +0 -92
  66. package/dist/node/lib/rating/analyzeNftCollection.mjs.map +0 -1
  67. package/dist/node/lib/rating/criteria/index.js +0 -105
  68. package/dist/node/lib/rating/criteria/index.js.map +0 -1
  69. package/dist/node/lib/rating/criteria/index.mjs +0 -78
  70. package/dist/node/lib/rating/criteria/index.mjs.map +0 -1
  71. package/dist/node/lib/rating/criteria/scoring/index.js +0 -103
  72. package/dist/node/lib/rating/criteria/scoring/index.js.map +0 -1
  73. package/dist/node/lib/rating/criteria/scoring/index.mjs +0 -74
  74. package/dist/node/lib/rating/criteria/scoring/index.mjs.map +0 -1
  75. package/dist/node/lib/rating/criteria/scoring/metadata/index.js +0 -81
  76. package/dist/node/lib/rating/criteria/scoring/metadata/index.js.map +0 -1
  77. package/dist/node/lib/rating/criteria/scoring/metadata/index.mjs +0 -53
  78. package/dist/node/lib/rating/criteria/scoring/metadata/index.mjs.map +0 -1
  79. package/dist/node/lib/rating/criteria/scoring/metadata/metadata.js +0 -81
  80. package/dist/node/lib/rating/criteria/scoring/metadata/metadata.js.map +0 -1
  81. package/dist/node/lib/rating/criteria/scoring/metadata/metadata.mjs +0 -53
  82. package/dist/node/lib/rating/criteria/scoring/metadata/metadata.mjs.map +0 -1
  83. package/dist/node/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.js +0 -46
  84. package/dist/node/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.js.map +0 -1
  85. package/dist/node/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.mjs +0 -21
  86. package/dist/node/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.mjs.map +0 -1
  87. package/dist/node/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.js +0 -50
  88. package/dist/node/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.js.map +0 -1
  89. package/dist/node/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.mjs +0 -25
  90. package/dist/node/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.mjs.map +0 -1
  91. package/dist/node/lib/rating/criteria/scoring/total.js +0 -48
  92. package/dist/node/lib/rating/criteria/scoring/total.js.map +0 -1
  93. package/dist/node/lib/rating/criteria/scoring/total.mjs +0 -23
  94. package/dist/node/lib/rating/criteria/scoring/total.mjs.map +0 -1
  95. package/dist/node/lib/rating/index.js +0 -119
  96. package/dist/node/lib/rating/index.js.map +0 -1
  97. package/dist/node/lib/rating/index.mjs +0 -92
  98. package/dist/node/lib/rating/index.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/index.ts","../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts","../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts","../../../../../../../src/lib/rating/criteria/scoring/metadata/metadata.ts"],"sourcesContent":["export * from './metadata'\n","import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\nconst maxScore = 10\n\nexport const scoreIndividualAttributes = (info: NftCollectionAttributeMetrics): Score => {\n const { attributes } = info.metrics.metadata\n const entries = Object.entries(attributes)\n if (entries.length === 0) return [0, maxScore]\n const scores = Object.entries(attributes)\n .map(([_trait, { values }]) => {\n return Object.entries(values).map<Score>(([_traitValue, metrics]) => {\n const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore)\n return [rarity, maxScore]\n })\n })\n .flat()\n const total = scores.reduce<Score>(([a, b], [c, d]) => [a + c, b + d], [0, 0])\n return normalize(total, maxScore)\n}\n","import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\nconst maxScore = 10\n\n/**\n * Mean: What value is the distribution centered around\n */\nconst defaultMu = 0.15\n\n/**\n * Standard Deviation: How spread out is the distribution\n */\nconst defaultSigma = 0.1\n\n/**\n * Calculates the Gaussian probability density\n * @param x\n * @param mu Mean\n * @param sigma Standard Deviation\n * @returns\n */\nconst gaussianProbabilityDensity = (x: number, mu: number = defaultMu, sigma: number = defaultSigma): number => {\n const sqrtTwoPi = Math.sqrt(2 * Math.PI)\n const denominator = sigma * sqrtTwoPi\n const power = -0.5 * Math.pow((x - mu) / sigma, 2)\n return (1 / denominator) * Math.exp(power)\n}\n\n/**\n * For a Gaussian distribution, the peak of the distribution is the mean\n */\nconst maxProbabilityDensity = gaussianProbabilityDensity(defaultMu)\n\n/**\n * We're working on some assumptions here:\n *\n * - If you have a 100% chance of getting a trait, everyone get's a trophy\n * - If you have a 50% chance of getting a trait, it's not rare\n * - If you have a 0% chance of getting a trait, it's not fun\n *\n * So we're looking for something Pareto-ish (somewhere between\n * 80/20 or 90/10) as that's a good & sustainable model for the\n * distribution of many traits in real life.\n * However, we also don't want to maximally reward collections\n * that have a lot of single attributes distributed uniformly\n * (basically a 0% trait probably) as that's perfectly entropic\n * but not very interesting (some overlap is desirable).\n * So we're using a Gaussian distribution to model the\n * probability density of the joint probability of all traits\n * centered around 15%.\n * @param info\n * @returns\n */\nexport const scoreTotalAttributes = (info: NftCollectionAttributeMetrics): Score => {\n const { attributes } = info.metrics.metadata\n // This has somewhat of a filtering function by causing anything with 100% probability to\n // add no value to the end score\n const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {\n return acc * metrics.binomial.p\n }, 1)\n const probabilityDensity = gaussianProbabilityDensity(jointProbability)\n const score: Score = [probabilityDensity, maxProbabilityDensity]\n return normalize(score, maxScore)\n}\n","import { NftCollectionInfo } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { WeightedScoringCriteria } from '@xyo-network/crypto-nft-score-model'\n\nimport { scoreIndividualAttributes } from './scoreIndividualAttributes'\nimport { scoreTotalAttributes } from './scoreTotalAttributes'\n\nexport const attributeScoringCriteria: { [key: string]: WeightedScoringCriteria<NftCollectionInfo> } = {\n 'Metadata Attributes Individual': { score: scoreIndividualAttributes, weight: 2 },\n 'Metadata Attributes Total': { score: scoreTotalAttributes, weight: 2 },\n}\n\nexport const scoreMetadata: { [key: string]: WeightedScoringCriteria<NftCollectionInfo> } = {\n ...attributeScoringCriteria,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,oCAAiC;AAEjC,IAAM,WAAW;AAEV,IAAM,4BAA4B,CAAC,SAA+C;AACvF,QAAM,EAAE,WAAW,IAAI,KAAK,QAAQ;AACpC,QAAM,UAAU,OAAO,QAAQ,UAAU;AACzC,MAAI,QAAQ,WAAW;AAAG,WAAO,CAAC,GAAG,QAAQ;AAC7C,QAAM,SAAS,OAAO,QAAQ,UAAU,EACrC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM;AAC7B,WAAO,OAAO,QAAQ,MAAM,EAAE,IAAW,CAAC,CAAC,aAAa,OAAO,MAAM;AACnE,YAAM,SAAS,KAAK,IAAI,KAAK,OAAO,IAAI,QAAQ,SAAS,KAAK,QAAQ,GAAG,QAAQ;AACjF,aAAO,CAAC,QAAQ,QAAQ;AAAA,IAC1B,CAAC;AAAA,EACH,CAAC,EACA,KAAK;AACR,QAAM,QAAQ,OAAO,OAAc,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7E,aAAO,yCAAU,OAAO,QAAQ;AAClC;;;AClBA,IAAAA,iCAAiC;AAEjC,IAAMC,YAAW;AAKjB,IAAM,YAAY;AAKlB,IAAM,eAAe;AASrB,IAAM,6BAA6B,CAAC,GAAW,KAAa,WAAW,QAAgB,iBAAyB;AAC9G,QAAM,YAAY,KAAK,KAAK,IAAI,KAAK,EAAE;AACvC,QAAM,cAAc,QAAQ;AAC5B,QAAM,QAAQ,OAAO,KAAK,KAAK,IAAI,MAAM,OAAO,CAAC;AACjD,SAAQ,IAAI,cAAe,KAAK,IAAI,KAAK;AAC3C;AAKA,IAAM,wBAAwB,2BAA2B,SAAS;AAsB3D,IAAM,uBAAuB,CAAC,SAA+C;AAClF,QAAM,EAAE,WAAW,IAAI,KAAK,QAAQ;AAGpC,QAAM,mBAAmB,OAAO,QAAQ,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM;AACzF,WAAO,MAAM,QAAQ,SAAS;AAAA,EAChC,GAAG,CAAC;AACJ,QAAM,qBAAqB,2BAA2B,gBAAgB;AACtE,QAAM,QAAe,CAAC,oBAAoB,qBAAqB;AAC/D,aAAO,0CAAU,OAAOA,SAAQ;AAClC;;;AC1DO,IAAM,2BAA0F;AAAA,EACrG,kCAAkC,EAAE,OAAO,2BAA2B,QAAQ,EAAE;AAAA,EAChF,6BAA6B,EAAE,OAAO,sBAAsB,QAAQ,EAAE;AACxE;AAEO,IAAM,gBAA+E;AAAA,EAC1F,GAAG;AACL;","names":["import_crypto_nft_score_model","maxScore"]}
@@ -1,53 +0,0 @@
1
- // src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts
2
- import { normalize } from "@xyo-network/crypto-nft-score-model";
3
- var maxScore = 10;
4
- var scoreIndividualAttributes = (info) => {
5
- const { attributes } = info.metrics.metadata;
6
- const entries = Object.entries(attributes);
7
- if (entries.length === 0)
8
- return [0, maxScore];
9
- const scores = Object.entries(attributes).map(([_trait, { values }]) => {
10
- return Object.entries(values).map(([_traitValue, metrics]) => {
11
- const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore);
12
- return [rarity, maxScore];
13
- });
14
- }).flat();
15
- const total = scores.reduce(([a, b], [c, d]) => [a + c, b + d], [0, 0]);
16
- return normalize(total, maxScore);
17
- };
18
-
19
- // src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts
20
- import { normalize as normalize2 } from "@xyo-network/crypto-nft-score-model";
21
- var maxScore2 = 10;
22
- var defaultMu = 0.15;
23
- var defaultSigma = 0.1;
24
- var gaussianProbabilityDensity = (x, mu = defaultMu, sigma = defaultSigma) => {
25
- const sqrtTwoPi = Math.sqrt(2 * Math.PI);
26
- const denominator = sigma * sqrtTwoPi;
27
- const power = -0.5 * Math.pow((x - mu) / sigma, 2);
28
- return 1 / denominator * Math.exp(power);
29
- };
30
- var maxProbabilityDensity = gaussianProbabilityDensity(defaultMu);
31
- var scoreTotalAttributes = (info) => {
32
- const { attributes } = info.metrics.metadata;
33
- const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {
34
- return acc * metrics.binomial.p;
35
- }, 1);
36
- const probabilityDensity = gaussianProbabilityDensity(jointProbability);
37
- const score = [probabilityDensity, maxProbabilityDensity];
38
- return normalize2(score, maxScore2);
39
- };
40
-
41
- // src/lib/rating/criteria/scoring/metadata/metadata.ts
42
- var attributeScoringCriteria = {
43
- "Metadata Attributes Individual": { score: scoreIndividualAttributes, weight: 2 },
44
- "Metadata Attributes Total": { score: scoreTotalAttributes, weight: 2 }
45
- };
46
- var scoreMetadata = {
47
- ...attributeScoringCriteria
48
- };
49
- export {
50
- attributeScoringCriteria,
51
- scoreMetadata
52
- };
53
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts","../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts","../../../../../../../src/lib/rating/criteria/scoring/metadata/metadata.ts"],"sourcesContent":["import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\nconst maxScore = 10\n\nexport const scoreIndividualAttributes = (info: NftCollectionAttributeMetrics): Score => {\n const { attributes } = info.metrics.metadata\n const entries = Object.entries(attributes)\n if (entries.length === 0) return [0, maxScore]\n const scores = Object.entries(attributes)\n .map(([_trait, { values }]) => {\n return Object.entries(values).map<Score>(([_traitValue, metrics]) => {\n const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore)\n return [rarity, maxScore]\n })\n })\n .flat()\n const total = scores.reduce<Score>(([a, b], [c, d]) => [a + c, b + d], [0, 0])\n return normalize(total, maxScore)\n}\n","import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\nconst maxScore = 10\n\n/**\n * Mean: What value is the distribution centered around\n */\nconst defaultMu = 0.15\n\n/**\n * Standard Deviation: How spread out is the distribution\n */\nconst defaultSigma = 0.1\n\n/**\n * Calculates the Gaussian probability density\n * @param x\n * @param mu Mean\n * @param sigma Standard Deviation\n * @returns\n */\nconst gaussianProbabilityDensity = (x: number, mu: number = defaultMu, sigma: number = defaultSigma): number => {\n const sqrtTwoPi = Math.sqrt(2 * Math.PI)\n const denominator = sigma * sqrtTwoPi\n const power = -0.5 * Math.pow((x - mu) / sigma, 2)\n return (1 / denominator) * Math.exp(power)\n}\n\n/**\n * For a Gaussian distribution, the peak of the distribution is the mean\n */\nconst maxProbabilityDensity = gaussianProbabilityDensity(defaultMu)\n\n/**\n * We're working on some assumptions here:\n *\n * - If you have a 100% chance of getting a trait, everyone get's a trophy\n * - If you have a 50% chance of getting a trait, it's not rare\n * - If you have a 0% chance of getting a trait, it's not fun\n *\n * So we're looking for something Pareto-ish (somewhere between\n * 80/20 or 90/10) as that's a good & sustainable model for the\n * distribution of many traits in real life.\n * However, we also don't want to maximally reward collections\n * that have a lot of single attributes distributed uniformly\n * (basically a 0% trait probably) as that's perfectly entropic\n * but not very interesting (some overlap is desirable).\n * So we're using a Gaussian distribution to model the\n * probability density of the joint probability of all traits\n * centered around 15%.\n * @param info\n * @returns\n */\nexport const scoreTotalAttributes = (info: NftCollectionAttributeMetrics): Score => {\n const { attributes } = info.metrics.metadata\n // This has somewhat of a filtering function by causing anything with 100% probability to\n // add no value to the end score\n const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {\n return acc * metrics.binomial.p\n }, 1)\n const probabilityDensity = gaussianProbabilityDensity(jointProbability)\n const score: Score = [probabilityDensity, maxProbabilityDensity]\n return normalize(score, maxScore)\n}\n","import { NftCollectionInfo } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { WeightedScoringCriteria } from '@xyo-network/crypto-nft-score-model'\n\nimport { scoreIndividualAttributes } from './scoreIndividualAttributes'\nimport { scoreTotalAttributes } from './scoreTotalAttributes'\n\nexport const attributeScoringCriteria: { [key: string]: WeightedScoringCriteria<NftCollectionInfo> } = {\n 'Metadata Attributes Individual': { score: scoreIndividualAttributes, weight: 2 },\n 'Metadata Attributes Total': { score: scoreTotalAttributes, weight: 2 },\n}\n\nexport const scoreMetadata: { [key: string]: WeightedScoringCriteria<NftCollectionInfo> } = {\n ...attributeScoringCriteria,\n}\n"],"mappings":";AACA,SAAS,iBAAwB;AAEjC,IAAM,WAAW;AAEV,IAAM,4BAA4B,CAAC,SAA+C;AACvF,QAAM,EAAE,WAAW,IAAI,KAAK,QAAQ;AACpC,QAAM,UAAU,OAAO,QAAQ,UAAU;AACzC,MAAI,QAAQ,WAAW;AAAG,WAAO,CAAC,GAAG,QAAQ;AAC7C,QAAM,SAAS,OAAO,QAAQ,UAAU,EACrC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM;AAC7B,WAAO,OAAO,QAAQ,MAAM,EAAE,IAAW,CAAC,CAAC,aAAa,OAAO,MAAM;AACnE,YAAM,SAAS,KAAK,IAAI,KAAK,OAAO,IAAI,QAAQ,SAAS,KAAK,QAAQ,GAAG,QAAQ;AACjF,aAAO,CAAC,QAAQ,QAAQ;AAAA,IAC1B,CAAC;AAAA,EACH,CAAC,EACA,KAAK;AACR,QAAM,QAAQ,OAAO,OAAc,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7E,SAAO,UAAU,OAAO,QAAQ;AAClC;;;AClBA,SAAS,aAAAA,kBAAwB;AAEjC,IAAMC,YAAW;AAKjB,IAAM,YAAY;AAKlB,IAAM,eAAe;AASrB,IAAM,6BAA6B,CAAC,GAAW,KAAa,WAAW,QAAgB,iBAAyB;AAC9G,QAAM,YAAY,KAAK,KAAK,IAAI,KAAK,EAAE;AACvC,QAAM,cAAc,QAAQ;AAC5B,QAAM,QAAQ,OAAO,KAAK,KAAK,IAAI,MAAM,OAAO,CAAC;AACjD,SAAQ,IAAI,cAAe,KAAK,IAAI,KAAK;AAC3C;AAKA,IAAM,wBAAwB,2BAA2B,SAAS;AAsB3D,IAAM,uBAAuB,CAAC,SAA+C;AAClF,QAAM,EAAE,WAAW,IAAI,KAAK,QAAQ;AAGpC,QAAM,mBAAmB,OAAO,QAAQ,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM;AACzF,WAAO,MAAM,QAAQ,SAAS;AAAA,EAChC,GAAG,CAAC;AACJ,QAAM,qBAAqB,2BAA2B,gBAAgB;AACtE,QAAM,QAAe,CAAC,oBAAoB,qBAAqB;AAC/D,SAAOD,WAAU,OAAOC,SAAQ;AAClC;;;AC1DO,IAAM,2BAA0F;AAAA,EACrG,kCAAkC,EAAE,OAAO,2BAA2B,QAAQ,EAAE;AAAA,EAChF,6BAA6B,EAAE,OAAO,sBAAsB,QAAQ,EAAE;AACxE;AAEO,IAAM,gBAA+E;AAAA,EAC1F,GAAG;AACL;","names":["normalize","maxScore"]}
@@ -1,81 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/lib/rating/criteria/scoring/metadata/metadata.ts
21
- var metadata_exports = {};
22
- __export(metadata_exports, {
23
- attributeScoringCriteria: () => attributeScoringCriteria,
24
- scoreMetadata: () => scoreMetadata
25
- });
26
- module.exports = __toCommonJS(metadata_exports);
27
-
28
- // src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts
29
- var import_crypto_nft_score_model = require("@xyo-network/crypto-nft-score-model");
30
- var maxScore = 10;
31
- var scoreIndividualAttributes = (info) => {
32
- const { attributes } = info.metrics.metadata;
33
- const entries = Object.entries(attributes);
34
- if (entries.length === 0)
35
- return [0, maxScore];
36
- const scores = Object.entries(attributes).map(([_trait, { values }]) => {
37
- return Object.entries(values).map(([_traitValue, metrics]) => {
38
- const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore);
39
- return [rarity, maxScore];
40
- });
41
- }).flat();
42
- const total = scores.reduce(([a, b], [c, d]) => [a + c, b + d], [0, 0]);
43
- return (0, import_crypto_nft_score_model.normalize)(total, maxScore);
44
- };
45
-
46
- // src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts
47
- var import_crypto_nft_score_model2 = require("@xyo-network/crypto-nft-score-model");
48
- var maxScore2 = 10;
49
- var defaultMu = 0.15;
50
- var defaultSigma = 0.1;
51
- var gaussianProbabilityDensity = (x, mu = defaultMu, sigma = defaultSigma) => {
52
- const sqrtTwoPi = Math.sqrt(2 * Math.PI);
53
- const denominator = sigma * sqrtTwoPi;
54
- const power = -0.5 * Math.pow((x - mu) / sigma, 2);
55
- return 1 / denominator * Math.exp(power);
56
- };
57
- var maxProbabilityDensity = gaussianProbabilityDensity(defaultMu);
58
- var scoreTotalAttributes = (info) => {
59
- const { attributes } = info.metrics.metadata;
60
- const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {
61
- return acc * metrics.binomial.p;
62
- }, 1);
63
- const probabilityDensity = gaussianProbabilityDensity(jointProbability);
64
- const score = [probabilityDensity, maxProbabilityDensity];
65
- return (0, import_crypto_nft_score_model2.normalize)(score, maxScore2);
66
- };
67
-
68
- // src/lib/rating/criteria/scoring/metadata/metadata.ts
69
- var attributeScoringCriteria = {
70
- "Metadata Attributes Individual": { score: scoreIndividualAttributes, weight: 2 },
71
- "Metadata Attributes Total": { score: scoreTotalAttributes, weight: 2 }
72
- };
73
- var scoreMetadata = {
74
- ...attributeScoringCriteria
75
- };
76
- // Annotate the CommonJS export names for ESM import in node:
77
- 0 && (module.exports = {
78
- attributeScoringCriteria,
79
- scoreMetadata
80
- });
81
- //# sourceMappingURL=metadata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/metadata.ts","../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts","../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts"],"sourcesContent":["import { NftCollectionInfo } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { WeightedScoringCriteria } from '@xyo-network/crypto-nft-score-model'\n\nimport { scoreIndividualAttributes } from './scoreIndividualAttributes'\nimport { scoreTotalAttributes } from './scoreTotalAttributes'\n\nexport const attributeScoringCriteria: { [key: string]: WeightedScoringCriteria<NftCollectionInfo> } = {\n 'Metadata Attributes Individual': { score: scoreIndividualAttributes, weight: 2 },\n 'Metadata Attributes Total': { score: scoreTotalAttributes, weight: 2 },\n}\n\nexport const scoreMetadata: { [key: string]: WeightedScoringCriteria<NftCollectionInfo> } = {\n ...attributeScoringCriteria,\n}\n","import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\nconst maxScore = 10\n\nexport const scoreIndividualAttributes = (info: NftCollectionAttributeMetrics): Score => {\n const { attributes } = info.metrics.metadata\n const entries = Object.entries(attributes)\n if (entries.length === 0) return [0, maxScore]\n const scores = Object.entries(attributes)\n .map(([_trait, { values }]) => {\n return Object.entries(values).map<Score>(([_traitValue, metrics]) => {\n const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore)\n return [rarity, maxScore]\n })\n })\n .flat()\n const total = scores.reduce<Score>(([a, b], [c, d]) => [a + c, b + d], [0, 0])\n return normalize(total, maxScore)\n}\n","import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\nconst maxScore = 10\n\n/**\n * Mean: What value is the distribution centered around\n */\nconst defaultMu = 0.15\n\n/**\n * Standard Deviation: How spread out is the distribution\n */\nconst defaultSigma = 0.1\n\n/**\n * Calculates the Gaussian probability density\n * @param x\n * @param mu Mean\n * @param sigma Standard Deviation\n * @returns\n */\nconst gaussianProbabilityDensity = (x: number, mu: number = defaultMu, sigma: number = defaultSigma): number => {\n const sqrtTwoPi = Math.sqrt(2 * Math.PI)\n const denominator = sigma * sqrtTwoPi\n const power = -0.5 * Math.pow((x - mu) / sigma, 2)\n return (1 / denominator) * Math.exp(power)\n}\n\n/**\n * For a Gaussian distribution, the peak of the distribution is the mean\n */\nconst maxProbabilityDensity = gaussianProbabilityDensity(defaultMu)\n\n/**\n * We're working on some assumptions here:\n *\n * - If you have a 100% chance of getting a trait, everyone get's a trophy\n * - If you have a 50% chance of getting a trait, it's not rare\n * - If you have a 0% chance of getting a trait, it's not fun\n *\n * So we're looking for something Pareto-ish (somewhere between\n * 80/20 or 90/10) as that's a good & sustainable model for the\n * distribution of many traits in real life.\n * However, we also don't want to maximally reward collections\n * that have a lot of single attributes distributed uniformly\n * (basically a 0% trait probably) as that's perfectly entropic\n * but not very interesting (some overlap is desirable).\n * So we're using a Gaussian distribution to model the\n * probability density of the joint probability of all traits\n * centered around 15%.\n * @param info\n * @returns\n */\nexport const scoreTotalAttributes = (info: NftCollectionAttributeMetrics): Score => {\n const { attributes } = info.metrics.metadata\n // This has somewhat of a filtering function by causing anything with 100% probability to\n // add no value to the end score\n const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {\n return acc * metrics.binomial.p\n }, 1)\n const probabilityDensity = gaussianProbabilityDensity(jointProbability)\n const score: Score = [probabilityDensity, maxProbabilityDensity]\n return normalize(score, maxScore)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,oCAAiC;AAEjC,IAAM,WAAW;AAEV,IAAM,4BAA4B,CAAC,SAA+C;AACvF,QAAM,EAAE,WAAW,IAAI,KAAK,QAAQ;AACpC,QAAM,UAAU,OAAO,QAAQ,UAAU;AACzC,MAAI,QAAQ,WAAW;AAAG,WAAO,CAAC,GAAG,QAAQ;AAC7C,QAAM,SAAS,OAAO,QAAQ,UAAU,EACrC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM;AAC7B,WAAO,OAAO,QAAQ,MAAM,EAAE,IAAW,CAAC,CAAC,aAAa,OAAO,MAAM;AACnE,YAAM,SAAS,KAAK,IAAI,KAAK,OAAO,IAAI,QAAQ,SAAS,KAAK,QAAQ,GAAG,QAAQ;AACjF,aAAO,CAAC,QAAQ,QAAQ;AAAA,IAC1B,CAAC;AAAA,EACH,CAAC,EACA,KAAK;AACR,QAAM,QAAQ,OAAO,OAAc,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7E,aAAO,yCAAU,OAAO,QAAQ;AAClC;;;AClBA,IAAAA,iCAAiC;AAEjC,IAAMC,YAAW;AAKjB,IAAM,YAAY;AAKlB,IAAM,eAAe;AASrB,IAAM,6BAA6B,CAAC,GAAW,KAAa,WAAW,QAAgB,iBAAyB;AAC9G,QAAM,YAAY,KAAK,KAAK,IAAI,KAAK,EAAE;AACvC,QAAM,cAAc,QAAQ;AAC5B,QAAM,QAAQ,OAAO,KAAK,KAAK,IAAI,MAAM,OAAO,CAAC;AACjD,SAAQ,IAAI,cAAe,KAAK,IAAI,KAAK;AAC3C;AAKA,IAAM,wBAAwB,2BAA2B,SAAS;AAsB3D,IAAM,uBAAuB,CAAC,SAA+C;AAClF,QAAM,EAAE,WAAW,IAAI,KAAK,QAAQ;AAGpC,QAAM,mBAAmB,OAAO,QAAQ,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM;AACzF,WAAO,MAAM,QAAQ,SAAS;AAAA,EAChC,GAAG,CAAC;AACJ,QAAM,qBAAqB,2BAA2B,gBAAgB;AACtE,QAAM,QAAe,CAAC,oBAAoB,qBAAqB;AAC/D,aAAO,0CAAU,OAAOA,SAAQ;AAClC;;;AF1DO,IAAM,2BAA0F;AAAA,EACrG,kCAAkC,EAAE,OAAO,2BAA2B,QAAQ,EAAE;AAAA,EAChF,6BAA6B,EAAE,OAAO,sBAAsB,QAAQ,EAAE;AACxE;AAEO,IAAM,gBAA+E;AAAA,EAC1F,GAAG;AACL;","names":["import_crypto_nft_score_model","maxScore"]}
@@ -1,53 +0,0 @@
1
- // src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts
2
- import { normalize } from "@xyo-network/crypto-nft-score-model";
3
- var maxScore = 10;
4
- var scoreIndividualAttributes = (info) => {
5
- const { attributes } = info.metrics.metadata;
6
- const entries = Object.entries(attributes);
7
- if (entries.length === 0)
8
- return [0, maxScore];
9
- const scores = Object.entries(attributes).map(([_trait, { values }]) => {
10
- return Object.entries(values).map(([_traitValue, metrics]) => {
11
- const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore);
12
- return [rarity, maxScore];
13
- });
14
- }).flat();
15
- const total = scores.reduce(([a, b], [c, d]) => [a + c, b + d], [0, 0]);
16
- return normalize(total, maxScore);
17
- };
18
-
19
- // src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts
20
- import { normalize as normalize2 } from "@xyo-network/crypto-nft-score-model";
21
- var maxScore2 = 10;
22
- var defaultMu = 0.15;
23
- var defaultSigma = 0.1;
24
- var gaussianProbabilityDensity = (x, mu = defaultMu, sigma = defaultSigma) => {
25
- const sqrtTwoPi = Math.sqrt(2 * Math.PI);
26
- const denominator = sigma * sqrtTwoPi;
27
- const power = -0.5 * Math.pow((x - mu) / sigma, 2);
28
- return 1 / denominator * Math.exp(power);
29
- };
30
- var maxProbabilityDensity = gaussianProbabilityDensity(defaultMu);
31
- var scoreTotalAttributes = (info) => {
32
- const { attributes } = info.metrics.metadata;
33
- const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {
34
- return acc * metrics.binomial.p;
35
- }, 1);
36
- const probabilityDensity = gaussianProbabilityDensity(jointProbability);
37
- const score = [probabilityDensity, maxProbabilityDensity];
38
- return normalize2(score, maxScore2);
39
- };
40
-
41
- // src/lib/rating/criteria/scoring/metadata/metadata.ts
42
- var attributeScoringCriteria = {
43
- "Metadata Attributes Individual": { score: scoreIndividualAttributes, weight: 2 },
44
- "Metadata Attributes Total": { score: scoreTotalAttributes, weight: 2 }
45
- };
46
- var scoreMetadata = {
47
- ...attributeScoringCriteria
48
- };
49
- export {
50
- attributeScoringCriteria,
51
- scoreMetadata
52
- };
53
- //# sourceMappingURL=metadata.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts","../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts","../../../../../../../src/lib/rating/criteria/scoring/metadata/metadata.ts"],"sourcesContent":["import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\nconst maxScore = 10\n\nexport const scoreIndividualAttributes = (info: NftCollectionAttributeMetrics): Score => {\n const { attributes } = info.metrics.metadata\n const entries = Object.entries(attributes)\n if (entries.length === 0) return [0, maxScore]\n const scores = Object.entries(attributes)\n .map(([_trait, { values }]) => {\n return Object.entries(values).map<Score>(([_traitValue, metrics]) => {\n const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore)\n return [rarity, maxScore]\n })\n })\n .flat()\n const total = scores.reduce<Score>(([a, b], [c, d]) => [a + c, b + d], [0, 0])\n return normalize(total, maxScore)\n}\n","import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\nconst maxScore = 10\n\n/**\n * Mean: What value is the distribution centered around\n */\nconst defaultMu = 0.15\n\n/**\n * Standard Deviation: How spread out is the distribution\n */\nconst defaultSigma = 0.1\n\n/**\n * Calculates the Gaussian probability density\n * @param x\n * @param mu Mean\n * @param sigma Standard Deviation\n * @returns\n */\nconst gaussianProbabilityDensity = (x: number, mu: number = defaultMu, sigma: number = defaultSigma): number => {\n const sqrtTwoPi = Math.sqrt(2 * Math.PI)\n const denominator = sigma * sqrtTwoPi\n const power = -0.5 * Math.pow((x - mu) / sigma, 2)\n return (1 / denominator) * Math.exp(power)\n}\n\n/**\n * For a Gaussian distribution, the peak of the distribution is the mean\n */\nconst maxProbabilityDensity = gaussianProbabilityDensity(defaultMu)\n\n/**\n * We're working on some assumptions here:\n *\n * - If you have a 100% chance of getting a trait, everyone get's a trophy\n * - If you have a 50% chance of getting a trait, it's not rare\n * - If you have a 0% chance of getting a trait, it's not fun\n *\n * So we're looking for something Pareto-ish (somewhere between\n * 80/20 or 90/10) as that's a good & sustainable model for the\n * distribution of many traits in real life.\n * However, we also don't want to maximally reward collections\n * that have a lot of single attributes distributed uniformly\n * (basically a 0% trait probably) as that's perfectly entropic\n * but not very interesting (some overlap is desirable).\n * So we're using a Gaussian distribution to model the\n * probability density of the joint probability of all traits\n * centered around 15%.\n * @param info\n * @returns\n */\nexport const scoreTotalAttributes = (info: NftCollectionAttributeMetrics): Score => {\n const { attributes } = info.metrics.metadata\n // This has somewhat of a filtering function by causing anything with 100% probability to\n // add no value to the end score\n const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {\n return acc * metrics.binomial.p\n }, 1)\n const probabilityDensity = gaussianProbabilityDensity(jointProbability)\n const score: Score = [probabilityDensity, maxProbabilityDensity]\n return normalize(score, maxScore)\n}\n","import { NftCollectionInfo } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { WeightedScoringCriteria } from '@xyo-network/crypto-nft-score-model'\n\nimport { scoreIndividualAttributes } from './scoreIndividualAttributes'\nimport { scoreTotalAttributes } from './scoreTotalAttributes'\n\nexport const attributeScoringCriteria: { [key: string]: WeightedScoringCriteria<NftCollectionInfo> } = {\n 'Metadata Attributes Individual': { score: scoreIndividualAttributes, weight: 2 },\n 'Metadata Attributes Total': { score: scoreTotalAttributes, weight: 2 },\n}\n\nexport const scoreMetadata: { [key: string]: WeightedScoringCriteria<NftCollectionInfo> } = {\n ...attributeScoringCriteria,\n}\n"],"mappings":";AACA,SAAS,iBAAwB;AAEjC,IAAM,WAAW;AAEV,IAAM,4BAA4B,CAAC,SAA+C;AACvF,QAAM,EAAE,WAAW,IAAI,KAAK,QAAQ;AACpC,QAAM,UAAU,OAAO,QAAQ,UAAU;AACzC,MAAI,QAAQ,WAAW;AAAG,WAAO,CAAC,GAAG,QAAQ;AAC7C,QAAM,SAAS,OAAO,QAAQ,UAAU,EACrC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM;AAC7B,WAAO,OAAO,QAAQ,MAAM,EAAE,IAAW,CAAC,CAAC,aAAa,OAAO,MAAM;AACnE,YAAM,SAAS,KAAK,IAAI,KAAK,OAAO,IAAI,QAAQ,SAAS,KAAK,QAAQ,GAAG,QAAQ;AACjF,aAAO,CAAC,QAAQ,QAAQ;AAAA,IAC1B,CAAC;AAAA,EACH,CAAC,EACA,KAAK;AACR,QAAM,QAAQ,OAAO,OAAc,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7E,SAAO,UAAU,OAAO,QAAQ;AAClC;;;AClBA,SAAS,aAAAA,kBAAwB;AAEjC,IAAMC,YAAW;AAKjB,IAAM,YAAY;AAKlB,IAAM,eAAe;AASrB,IAAM,6BAA6B,CAAC,GAAW,KAAa,WAAW,QAAgB,iBAAyB;AAC9G,QAAM,YAAY,KAAK,KAAK,IAAI,KAAK,EAAE;AACvC,QAAM,cAAc,QAAQ;AAC5B,QAAM,QAAQ,OAAO,KAAK,KAAK,IAAI,MAAM,OAAO,CAAC;AACjD,SAAQ,IAAI,cAAe,KAAK,IAAI,KAAK;AAC3C;AAKA,IAAM,wBAAwB,2BAA2B,SAAS;AAsB3D,IAAM,uBAAuB,CAAC,SAA+C;AAClF,QAAM,EAAE,WAAW,IAAI,KAAK,QAAQ;AAGpC,QAAM,mBAAmB,OAAO,QAAQ,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM;AACzF,WAAO,MAAM,QAAQ,SAAS;AAAA,EAChC,GAAG,CAAC;AACJ,QAAM,qBAAqB,2BAA2B,gBAAgB;AACtE,QAAM,QAAe,CAAC,oBAAoB,qBAAqB;AAC/D,SAAOD,WAAU,OAAOC,SAAQ;AAClC;;;AC1DO,IAAM,2BAA0F;AAAA,EACrG,kCAAkC,EAAE,OAAO,2BAA2B,QAAQ,EAAE;AAAA,EAChF,6BAA6B,EAAE,OAAO,sBAAsB,QAAQ,EAAE;AACxE;AAEO,IAAM,gBAA+E;AAAA,EAC1F,GAAG;AACL;","names":["normalize","maxScore"]}
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts
21
- var scoreIndividualAttributes_exports = {};
22
- __export(scoreIndividualAttributes_exports, {
23
- scoreIndividualAttributes: () => scoreIndividualAttributes
24
- });
25
- module.exports = __toCommonJS(scoreIndividualAttributes_exports);
26
- var import_crypto_nft_score_model = require("@xyo-network/crypto-nft-score-model");
27
- var maxScore = 10;
28
- var scoreIndividualAttributes = (info) => {
29
- const { attributes } = info.metrics.metadata;
30
- const entries = Object.entries(attributes);
31
- if (entries.length === 0)
32
- return [0, maxScore];
33
- const scores = Object.entries(attributes).map(([_trait, { values }]) => {
34
- return Object.entries(values).map(([_traitValue, metrics]) => {
35
- const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore);
36
- return [rarity, maxScore];
37
- });
38
- }).flat();
39
- const total = scores.reduce(([a, b], [c, d]) => [a + c, b + d], [0, 0]);
40
- return (0, import_crypto_nft_score_model.normalize)(total, maxScore);
41
- };
42
- // Annotate the CommonJS export names for ESM import in node:
43
- 0 && (module.exports = {
44
- scoreIndividualAttributes
45
- });
46
- //# sourceMappingURL=scoreIndividualAttributes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts"],"sourcesContent":["import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\nconst maxScore = 10\n\nexport const scoreIndividualAttributes = (info: NftCollectionAttributeMetrics): Score => {\n const { attributes } = info.metrics.metadata\n const entries = Object.entries(attributes)\n if (entries.length === 0) return [0, maxScore]\n const scores = Object.entries(attributes)\n .map(([_trait, { values }]) => {\n return Object.entries(values).map<Score>(([_traitValue, metrics]) => {\n const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore)\n return [rarity, maxScore]\n })\n })\n .flat()\n const total = scores.reduce<Score>(([a, b], [c, d]) => [a + c, b + d], [0, 0])\n return normalize(total, maxScore)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oCAAiC;AAEjC,IAAM,WAAW;AAEV,IAAM,4BAA4B,CAAC,SAA+C;AACvF,QAAM,EAAE,WAAW,IAAI,KAAK,QAAQ;AACpC,QAAM,UAAU,OAAO,QAAQ,UAAU;AACzC,MAAI,QAAQ,WAAW;AAAG,WAAO,CAAC,GAAG,QAAQ;AAC7C,QAAM,SAAS,OAAO,QAAQ,UAAU,EACrC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM;AAC7B,WAAO,OAAO,QAAQ,MAAM,EAAE,IAAW,CAAC,CAAC,aAAa,OAAO,MAAM;AACnE,YAAM,SAAS,KAAK,IAAI,KAAK,OAAO,IAAI,QAAQ,SAAS,KAAK,QAAQ,GAAG,QAAQ;AACjF,aAAO,CAAC,QAAQ,QAAQ;AAAA,IAC1B,CAAC;AAAA,EACH,CAAC,EACA,KAAK;AACR,QAAM,QAAQ,OAAO,OAAc,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7E,aAAO,yCAAU,OAAO,QAAQ;AAClC;","names":[]}
@@ -1,21 +0,0 @@
1
- // src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts
2
- import { normalize } from "@xyo-network/crypto-nft-score-model";
3
- var maxScore = 10;
4
- var scoreIndividualAttributes = (info) => {
5
- const { attributes } = info.metrics.metadata;
6
- const entries = Object.entries(attributes);
7
- if (entries.length === 0)
8
- return [0, maxScore];
9
- const scores = Object.entries(attributes).map(([_trait, { values }]) => {
10
- return Object.entries(values).map(([_traitValue, metrics]) => {
11
- const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore);
12
- return [rarity, maxScore];
13
- });
14
- }).flat();
15
- const total = scores.reduce(([a, b], [c, d]) => [a + c, b + d], [0, 0]);
16
- return normalize(total, maxScore);
17
- };
18
- export {
19
- scoreIndividualAttributes
20
- };
21
- //# sourceMappingURL=scoreIndividualAttributes.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts"],"sourcesContent":["import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\nconst maxScore = 10\n\nexport const scoreIndividualAttributes = (info: NftCollectionAttributeMetrics): Score => {\n const { attributes } = info.metrics.metadata\n const entries = Object.entries(attributes)\n if (entries.length === 0) return [0, maxScore]\n const scores = Object.entries(attributes)\n .map(([_trait, { values }]) => {\n return Object.entries(values).map<Score>(([_traitValue, metrics]) => {\n const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore)\n return [rarity, maxScore]\n })\n })\n .flat()\n const total = scores.reduce<Score>(([a, b], [c, d]) => [a + c, b + d], [0, 0])\n return normalize(total, maxScore)\n}\n"],"mappings":";AACA,SAAS,iBAAwB;AAEjC,IAAM,WAAW;AAEV,IAAM,4BAA4B,CAAC,SAA+C;AACvF,QAAM,EAAE,WAAW,IAAI,KAAK,QAAQ;AACpC,QAAM,UAAU,OAAO,QAAQ,UAAU;AACzC,MAAI,QAAQ,WAAW;AAAG,WAAO,CAAC,GAAG,QAAQ;AAC7C,QAAM,SAAS,OAAO,QAAQ,UAAU,EACrC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM;AAC7B,WAAO,OAAO,QAAQ,MAAM,EAAE,IAAW,CAAC,CAAC,aAAa,OAAO,MAAM;AACnE,YAAM,SAAS,KAAK,IAAI,KAAK,OAAO,IAAI,QAAQ,SAAS,KAAK,QAAQ,GAAG,QAAQ;AACjF,aAAO,CAAC,QAAQ,QAAQ;AAAA,IAC1B,CAAC;AAAA,EACH,CAAC,EACA,KAAK;AACR,QAAM,QAAQ,OAAO,OAAc,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7E,SAAO,UAAU,OAAO,QAAQ;AAClC;","names":[]}
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts
21
- var scoreTotalAttributes_exports = {};
22
- __export(scoreTotalAttributes_exports, {
23
- scoreTotalAttributes: () => scoreTotalAttributes
24
- });
25
- module.exports = __toCommonJS(scoreTotalAttributes_exports);
26
- var import_crypto_nft_score_model = require("@xyo-network/crypto-nft-score-model");
27
- var maxScore = 10;
28
- var defaultMu = 0.15;
29
- var defaultSigma = 0.1;
30
- var gaussianProbabilityDensity = (x, mu = defaultMu, sigma = defaultSigma) => {
31
- const sqrtTwoPi = Math.sqrt(2 * Math.PI);
32
- const denominator = sigma * sqrtTwoPi;
33
- const power = -0.5 * Math.pow((x - mu) / sigma, 2);
34
- return 1 / denominator * Math.exp(power);
35
- };
36
- var maxProbabilityDensity = gaussianProbabilityDensity(defaultMu);
37
- var scoreTotalAttributes = (info) => {
38
- const { attributes } = info.metrics.metadata;
39
- const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {
40
- return acc * metrics.binomial.p;
41
- }, 1);
42
- const probabilityDensity = gaussianProbabilityDensity(jointProbability);
43
- const score = [probabilityDensity, maxProbabilityDensity];
44
- return (0, import_crypto_nft_score_model.normalize)(score, maxScore);
45
- };
46
- // Annotate the CommonJS export names for ESM import in node:
47
- 0 && (module.exports = {
48
- scoreTotalAttributes
49
- });
50
- //# sourceMappingURL=scoreTotalAttributes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts"],"sourcesContent":["import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\nconst maxScore = 10\n\n/**\n * Mean: What value is the distribution centered around\n */\nconst defaultMu = 0.15\n\n/**\n * Standard Deviation: How spread out is the distribution\n */\nconst defaultSigma = 0.1\n\n/**\n * Calculates the Gaussian probability density\n * @param x\n * @param mu Mean\n * @param sigma Standard Deviation\n * @returns\n */\nconst gaussianProbabilityDensity = (x: number, mu: number = defaultMu, sigma: number = defaultSigma): number => {\n const sqrtTwoPi = Math.sqrt(2 * Math.PI)\n const denominator = sigma * sqrtTwoPi\n const power = -0.5 * Math.pow((x - mu) / sigma, 2)\n return (1 / denominator) * Math.exp(power)\n}\n\n/**\n * For a Gaussian distribution, the peak of the distribution is the mean\n */\nconst maxProbabilityDensity = gaussianProbabilityDensity(defaultMu)\n\n/**\n * We're working on some assumptions here:\n *\n * - If you have a 100% chance of getting a trait, everyone get's a trophy\n * - If you have a 50% chance of getting a trait, it's not rare\n * - If you have a 0% chance of getting a trait, it's not fun\n *\n * So we're looking for something Pareto-ish (somewhere between\n * 80/20 or 90/10) as that's a good & sustainable model for the\n * distribution of many traits in real life.\n * However, we also don't want to maximally reward collections\n * that have a lot of single attributes distributed uniformly\n * (basically a 0% trait probably) as that's perfectly entropic\n * but not very interesting (some overlap is desirable).\n * So we're using a Gaussian distribution to model the\n * probability density of the joint probability of all traits\n * centered around 15%.\n * @param info\n * @returns\n */\nexport const scoreTotalAttributes = (info: NftCollectionAttributeMetrics): Score => {\n const { attributes } = info.metrics.metadata\n // This has somewhat of a filtering function by causing anything with 100% probability to\n // add no value to the end score\n const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {\n return acc * metrics.binomial.p\n }, 1)\n const probabilityDensity = gaussianProbabilityDensity(jointProbability)\n const score: Score = [probabilityDensity, maxProbabilityDensity]\n return normalize(score, maxScore)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oCAAiC;AAEjC,IAAM,WAAW;AAKjB,IAAM,YAAY;AAKlB,IAAM,eAAe;AASrB,IAAM,6BAA6B,CAAC,GAAW,KAAa,WAAW,QAAgB,iBAAyB;AAC9G,QAAM,YAAY,KAAK,KAAK,IAAI,KAAK,EAAE;AACvC,QAAM,cAAc,QAAQ;AAC5B,QAAM,QAAQ,OAAO,KAAK,KAAK,IAAI,MAAM,OAAO,CAAC;AACjD,SAAQ,IAAI,cAAe,KAAK,IAAI,KAAK;AAC3C;AAKA,IAAM,wBAAwB,2BAA2B,SAAS;AAsB3D,IAAM,uBAAuB,CAAC,SAA+C;AAClF,QAAM,EAAE,WAAW,IAAI,KAAK,QAAQ;AAGpC,QAAM,mBAAmB,OAAO,QAAQ,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM;AACzF,WAAO,MAAM,QAAQ,SAAS;AAAA,EAChC,GAAG,CAAC;AACJ,QAAM,qBAAqB,2BAA2B,gBAAgB;AACtE,QAAM,QAAe,CAAC,oBAAoB,qBAAqB;AAC/D,aAAO,yCAAU,OAAO,QAAQ;AAClC;","names":[]}
@@ -1,25 +0,0 @@
1
- // src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts
2
- import { normalize } from "@xyo-network/crypto-nft-score-model";
3
- var maxScore = 10;
4
- var defaultMu = 0.15;
5
- var defaultSigma = 0.1;
6
- var gaussianProbabilityDensity = (x, mu = defaultMu, sigma = defaultSigma) => {
7
- const sqrtTwoPi = Math.sqrt(2 * Math.PI);
8
- const denominator = sigma * sqrtTwoPi;
9
- const power = -0.5 * Math.pow((x - mu) / sigma, 2);
10
- return 1 / denominator * Math.exp(power);
11
- };
12
- var maxProbabilityDensity = gaussianProbabilityDensity(defaultMu);
13
- var scoreTotalAttributes = (info) => {
14
- const { attributes } = info.metrics.metadata;
15
- const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {
16
- return acc * metrics.binomial.p;
17
- }, 1);
18
- const probabilityDensity = gaussianProbabilityDensity(jointProbability);
19
- const score = [probabilityDensity, maxProbabilityDensity];
20
- return normalize(score, maxScore);
21
- };
22
- export {
23
- scoreTotalAttributes
24
- };
25
- //# sourceMappingURL=scoreTotalAttributes.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts"],"sourcesContent":["import { NftCollectionAttributeMetrics } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\nconst maxScore = 10\n\n/**\n * Mean: What value is the distribution centered around\n */\nconst defaultMu = 0.15\n\n/**\n * Standard Deviation: How spread out is the distribution\n */\nconst defaultSigma = 0.1\n\n/**\n * Calculates the Gaussian probability density\n * @param x\n * @param mu Mean\n * @param sigma Standard Deviation\n * @returns\n */\nconst gaussianProbabilityDensity = (x: number, mu: number = defaultMu, sigma: number = defaultSigma): number => {\n const sqrtTwoPi = Math.sqrt(2 * Math.PI)\n const denominator = sigma * sqrtTwoPi\n const power = -0.5 * Math.pow((x - mu) / sigma, 2)\n return (1 / denominator) * Math.exp(power)\n}\n\n/**\n * For a Gaussian distribution, the peak of the distribution is the mean\n */\nconst maxProbabilityDensity = gaussianProbabilityDensity(defaultMu)\n\n/**\n * We're working on some assumptions here:\n *\n * - If you have a 100% chance of getting a trait, everyone get's a trophy\n * - If you have a 50% chance of getting a trait, it's not rare\n * - If you have a 0% chance of getting a trait, it's not fun\n *\n * So we're looking for something Pareto-ish (somewhere between\n * 80/20 or 90/10) as that's a good & sustainable model for the\n * distribution of many traits in real life.\n * However, we also don't want to maximally reward collections\n * that have a lot of single attributes distributed uniformly\n * (basically a 0% trait probably) as that's perfectly entropic\n * but not very interesting (some overlap is desirable).\n * So we're using a Gaussian distribution to model the\n * probability density of the joint probability of all traits\n * centered around 15%.\n * @param info\n * @returns\n */\nexport const scoreTotalAttributes = (info: NftCollectionAttributeMetrics): Score => {\n const { attributes } = info.metrics.metadata\n // This has somewhat of a filtering function by causing anything with 100% probability to\n // add no value to the end score\n const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {\n return acc * metrics.binomial.p\n }, 1)\n const probabilityDensity = gaussianProbabilityDensity(jointProbability)\n const score: Score = [probabilityDensity, maxProbabilityDensity]\n return normalize(score, maxScore)\n}\n"],"mappings":";AACA,SAAS,iBAAwB;AAEjC,IAAM,WAAW;AAKjB,IAAM,YAAY;AAKlB,IAAM,eAAe;AASrB,IAAM,6BAA6B,CAAC,GAAW,KAAa,WAAW,QAAgB,iBAAyB;AAC9G,QAAM,YAAY,KAAK,KAAK,IAAI,KAAK,EAAE;AACvC,QAAM,cAAc,QAAQ;AAC5B,QAAM,QAAQ,OAAO,KAAK,KAAK,IAAI,MAAM,OAAO,CAAC;AACjD,SAAQ,IAAI,cAAe,KAAK,IAAI,KAAK;AAC3C;AAKA,IAAM,wBAAwB,2BAA2B,SAAS;AAsB3D,IAAM,uBAAuB,CAAC,SAA+C;AAClF,QAAM,EAAE,WAAW,IAAI,KAAK,QAAQ;AAGpC,QAAM,mBAAmB,OAAO,QAAQ,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM;AACzF,WAAO,MAAM,QAAQ,SAAS;AAAA,EAChC,GAAG,CAAC;AACJ,QAAM,qBAAqB,2BAA2B,gBAAgB;AACtE,QAAM,QAAe,CAAC,oBAAoB,qBAAqB;AAC/D,SAAO,UAAU,OAAO,QAAQ;AAClC;","names":[]}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/lib/rating/criteria/scoring/total.ts
21
- var total_exports = {};
22
- __export(total_exports, {
23
- scoreTotal: () => scoreTotal
24
- });
25
- module.exports = __toCommonJS(total_exports);
26
- var import_crypto_nft_score_model = require("@xyo-network/crypto-nft-score-model");
27
- var median = 810308398217352e-7;
28
- var defaultMu = Math.log(median);
29
- var defaultSigma = 3;
30
- var mode = Math.exp(defaultMu - Math.pow(defaultSigma, 2));
31
- var logNormalProbabilityDensity = (x, mu = defaultMu, sigma = defaultSigma) => {
32
- if (x <= 0)
33
- return 0;
34
- const logX = Math.log(x);
35
- return 1 / (x * sigma * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((logX - mu) / sigma, 2));
36
- };
37
- var maxProbabilityDensity = logNormalProbabilityDensity(mode);
38
- var maxScore = 10;
39
- var scoreTotal = (nft) => {
40
- const density = logNormalProbabilityDensity(nft.total);
41
- const score = [density, maxProbabilityDensity];
42
- return (0, import_crypto_nft_score_model.normalize)(score, maxScore);
43
- };
44
- // Annotate the CommonJS export names for ESM import in node:
45
- 0 && (module.exports = {
46
- scoreTotal
47
- });
48
- //# sourceMappingURL=total.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../src/lib/rating/criteria/scoring/total.ts"],"sourcesContent":["import { NftCollectionCount } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\n/**\n * This \"magic\" value was obtained using Solver in Excel\n * to find the median, with mu/sigma fixed, which maximizes\n * the distribution (the mode for lognormal) at 10,000\n */\nconst median = 81030839.8217352\nconst defaultMu = Math.log(median)\nconst defaultSigma = 3\nconst mode = Math.exp(defaultMu - Math.pow(defaultSigma, 2))\n/**\n * Calculates the log-normal probability density\n * @param x the value at which you want to calculate the probability density\n * @param mu mean of the associated normal distribution\n * @param sigma standard deviation of the associated normal distribution\n * @returns\n */\nconst logNormalProbabilityDensity = (x: number, mu: number = defaultMu, sigma: number = defaultSigma): number => {\n if (x <= 0) return 0\n const logX = Math.log(x)\n return (1 / (x * sigma * Math.sqrt(2 * Math.PI))) * Math.exp(-0.5 * Math.pow((logX - mu) / sigma, 2))\n}\n\n/**\n * For a lognormal distribution, the peak of the distribution is the mode\n */\nconst maxProbabilityDensity = logNormalProbabilityDensity(mode)\n\nconst maxScore = 10\n\n/**\n * We're working on some assumptions here:\n * - If there's < 1000 NFTs in your collection it starts becoming too niche\n * - If there's > 20,000 NFTs in your collection it starts becoming too broad\n * So there's a sweet spot somewhere between 2000 and 10,000\n * where a collection has enough NFTs to be interesting, but\n * not so many that it's teetering on a diluted money grab.\n * To model that we're using a log-normal distribution optimized\n * to maximally reward collections in the aforementioned range\n * @param nft\n * @returns\n */\nexport const scoreTotal = (nft: NftCollectionCount): Score => {\n const density = logNormalProbabilityDensity(nft.total)\n const score: Score = [density, maxProbabilityDensity]\n return normalize(score, maxScore)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oCAAiC;AAOjC,IAAM,SAAS;AACf,IAAM,YAAY,KAAK,IAAI,MAAM;AACjC,IAAM,eAAe;AACrB,IAAM,OAAO,KAAK,IAAI,YAAY,KAAK,IAAI,cAAc,CAAC,CAAC;AAQ3D,IAAM,8BAA8B,CAAC,GAAW,KAAa,WAAW,QAAgB,iBAAyB;AAC/G,MAAI,KAAK;AAAG,WAAO;AACnB,QAAM,OAAO,KAAK,IAAI,CAAC;AACvB,SAAQ,KAAK,IAAI,QAAQ,KAAK,KAAK,IAAI,KAAK,EAAE,KAAM,KAAK,IAAI,OAAO,KAAK,KAAK,OAAO,MAAM,OAAO,CAAC,CAAC;AACtG;AAKA,IAAM,wBAAwB,4BAA4B,IAAI;AAE9D,IAAM,WAAW;AAcV,IAAM,aAAa,CAAC,QAAmC;AAC5D,QAAM,UAAU,4BAA4B,IAAI,KAAK;AACrD,QAAM,QAAe,CAAC,SAAS,qBAAqB;AACpD,aAAO,yCAAU,OAAO,QAAQ;AAClC;","names":[]}
@@ -1,23 +0,0 @@
1
- // src/lib/rating/criteria/scoring/total.ts
2
- import { normalize } from "@xyo-network/crypto-nft-score-model";
3
- var median = 810308398217352e-7;
4
- var defaultMu = Math.log(median);
5
- var defaultSigma = 3;
6
- var mode = Math.exp(defaultMu - Math.pow(defaultSigma, 2));
7
- var logNormalProbabilityDensity = (x, mu = defaultMu, sigma = defaultSigma) => {
8
- if (x <= 0)
9
- return 0;
10
- const logX = Math.log(x);
11
- return 1 / (x * sigma * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((logX - mu) / sigma, 2));
12
- };
13
- var maxProbabilityDensity = logNormalProbabilityDensity(mode);
14
- var maxScore = 10;
15
- var scoreTotal = (nft) => {
16
- const density = logNormalProbabilityDensity(nft.total);
17
- const score = [density, maxProbabilityDensity];
18
- return normalize(score, maxScore);
19
- };
20
- export {
21
- scoreTotal
22
- };
23
- //# sourceMappingURL=total.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../src/lib/rating/criteria/scoring/total.ts"],"sourcesContent":["import { NftCollectionCount } from '@xyo-network/crypto-nft-collection-payload-plugin'\nimport { normalize, Score } from '@xyo-network/crypto-nft-score-model'\n\n/**\n * This \"magic\" value was obtained using Solver in Excel\n * to find the median, with mu/sigma fixed, which maximizes\n * the distribution (the mode for lognormal) at 10,000\n */\nconst median = 81030839.8217352\nconst defaultMu = Math.log(median)\nconst defaultSigma = 3\nconst mode = Math.exp(defaultMu - Math.pow(defaultSigma, 2))\n/**\n * Calculates the log-normal probability density\n * @param x the value at which you want to calculate the probability density\n * @param mu mean of the associated normal distribution\n * @param sigma standard deviation of the associated normal distribution\n * @returns\n */\nconst logNormalProbabilityDensity = (x: number, mu: number = defaultMu, sigma: number = defaultSigma): number => {\n if (x <= 0) return 0\n const logX = Math.log(x)\n return (1 / (x * sigma * Math.sqrt(2 * Math.PI))) * Math.exp(-0.5 * Math.pow((logX - mu) / sigma, 2))\n}\n\n/**\n * For a lognormal distribution, the peak of the distribution is the mode\n */\nconst maxProbabilityDensity = logNormalProbabilityDensity(mode)\n\nconst maxScore = 10\n\n/**\n * We're working on some assumptions here:\n * - If there's < 1000 NFTs in your collection it starts becoming too niche\n * - If there's > 20,000 NFTs in your collection it starts becoming too broad\n * So there's a sweet spot somewhere between 2000 and 10,000\n * where a collection has enough NFTs to be interesting, but\n * not so many that it's teetering on a diluted money grab.\n * To model that we're using a log-normal distribution optimized\n * to maximally reward collections in the aforementioned range\n * @param nft\n * @returns\n */\nexport const scoreTotal = (nft: NftCollectionCount): Score => {\n const density = logNormalProbabilityDensity(nft.total)\n const score: Score = [density, maxProbabilityDensity]\n return normalize(score, maxScore)\n}\n"],"mappings":";AACA,SAAS,iBAAwB;AAOjC,IAAM,SAAS;AACf,IAAM,YAAY,KAAK,IAAI,MAAM;AACjC,IAAM,eAAe;AACrB,IAAM,OAAO,KAAK,IAAI,YAAY,KAAK,IAAI,cAAc,CAAC,CAAC;AAQ3D,IAAM,8BAA8B,CAAC,GAAW,KAAa,WAAW,QAAgB,iBAAyB;AAC/G,MAAI,KAAK;AAAG,WAAO;AACnB,QAAM,OAAO,KAAK,IAAI,CAAC;AACvB,SAAQ,KAAK,IAAI,QAAQ,KAAK,KAAK,IAAI,KAAK,EAAE,KAAM,KAAK,IAAI,OAAO,KAAK,KAAK,OAAO,MAAM,OAAO,CAAC,CAAC;AACtG;AAKA,IAAM,wBAAwB,4BAA4B,IAAI;AAE9D,IAAM,WAAW;AAcV,IAAM,aAAa,CAAC,QAAmC;AAC5D,QAAM,UAAU,4BAA4B,IAAI,KAAK;AACrD,QAAM,QAAe,CAAC,SAAS,qBAAqB;AACpD,SAAO,UAAU,OAAO,QAAQ;AAClC;","names":[]}
@@ -1,119 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/lib/rating/index.ts
21
- var rating_exports = {};
22
- __export(rating_exports, {
23
- analyzeNftCollection: () => analyzeNftCollection
24
- });
25
- module.exports = __toCommonJS(rating_exports);
26
-
27
- // src/lib/rating/criteria/scoring/metadata/scoreIndividualAttributes.ts
28
- var import_crypto_nft_score_model = require("@xyo-network/crypto-nft-score-model");
29
- var maxScore = 10;
30
- var scoreIndividualAttributes = (info) => {
31
- const { attributes } = info.metrics.metadata;
32
- const entries = Object.entries(attributes);
33
- if (entries.length === 0)
34
- return [0, maxScore];
35
- const scores = Object.entries(attributes).map(([_trait, { values }]) => {
36
- return Object.entries(values).map(([_traitValue, metrics]) => {
37
- const rarity = Math.min(Math.round((1 - metrics.binomial.p) * maxScore), maxScore);
38
- return [rarity, maxScore];
39
- });
40
- }).flat();
41
- const total = scores.reduce(([a, b], [c, d]) => [a + c, b + d], [0, 0]);
42
- return (0, import_crypto_nft_score_model.normalize)(total, maxScore);
43
- };
44
-
45
- // src/lib/rating/criteria/scoring/metadata/scoreTotalAttributes.ts
46
- var import_crypto_nft_score_model2 = require("@xyo-network/crypto-nft-score-model");
47
- var maxScore2 = 10;
48
- var defaultMu = 0.15;
49
- var defaultSigma = 0.1;
50
- var gaussianProbabilityDensity = (x, mu = defaultMu, sigma = defaultSigma) => {
51
- const sqrtTwoPi = Math.sqrt(2 * Math.PI);
52
- const denominator = sigma * sqrtTwoPi;
53
- const power = -0.5 * Math.pow((x - mu) / sigma, 2);
54
- return 1 / denominator * Math.exp(power);
55
- };
56
- var maxProbabilityDensity = gaussianProbabilityDensity(defaultMu);
57
- var scoreTotalAttributes = (info) => {
58
- const { attributes } = info.metrics.metadata;
59
- const jointProbability = Object.entries(attributes).reduce((acc, [_trait, { metrics }]) => {
60
- return acc * metrics.binomial.p;
61
- }, 1);
62
- const probabilityDensity = gaussianProbabilityDensity(jointProbability);
63
- const score = [probabilityDensity, maxProbabilityDensity];
64
- return (0, import_crypto_nft_score_model2.normalize)(score, maxScore2);
65
- };
66
-
67
- // src/lib/rating/criteria/scoring/metadata/metadata.ts
68
- var attributeScoringCriteria = {
69
- "Metadata Attributes Individual": { score: scoreIndividualAttributes, weight: 2 },
70
- "Metadata Attributes Total": { score: scoreTotalAttributes, weight: 2 }
71
- };
72
- var scoreMetadata = {
73
- ...attributeScoringCriteria
74
- };
75
-
76
- // src/lib/rating/criteria/scoring/total.ts
77
- var import_crypto_nft_score_model3 = require("@xyo-network/crypto-nft-score-model");
78
- var median = 810308398217352e-7;
79
- var defaultMu2 = Math.log(median);
80
- var defaultSigma2 = 3;
81
- var mode = Math.exp(defaultMu2 - Math.pow(defaultSigma2, 2));
82
- var logNormalProbabilityDensity = (x, mu = defaultMu2, sigma = defaultSigma2) => {
83
- if (x <= 0)
84
- return 0;
85
- const logX = Math.log(x);
86
- return 1 / (x * sigma * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((logX - mu) / sigma, 2));
87
- };
88
- var maxProbabilityDensity2 = logNormalProbabilityDensity(mode);
89
- var maxScore3 = 10;
90
- var scoreTotal = (nft) => {
91
- const density = logNormalProbabilityDensity(nft.total);
92
- const score = [density, maxProbabilityDensity2];
93
- return (0, import_crypto_nft_score_model3.normalize)(score, maxScore3);
94
- };
95
-
96
- // src/lib/rating/criteria/index.ts
97
- var scoringCriteria = {
98
- ...scoreMetadata,
99
- Total: { score: scoreTotal, weight: 2 }
100
- };
101
-
102
- // src/lib/rating/analyzeNftCollection.ts
103
- var analyzeNftCollection = async (nft) => {
104
- const result = Object.fromEntries(
105
- await Promise.all(
106
- Object.entries(scoringCriteria).map(async ([key, { score, weight }]) => {
107
- const rawScore = await score(nft);
108
- const weighted = rawScore.map((v) => v * weight);
109
- return [key, weighted];
110
- })
111
- )
112
- );
113
- return result;
114
- };
115
- // Annotate the CommonJS export names for ESM import in node:
116
- 0 && (module.exports = {
117
- analyzeNftCollection
118
- });
119
- //# sourceMappingURL=index.js.map