0.5.9 • Published 1 year ago

openrarity v0.5.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Openrarity

openRerity core algorithm JS implementation use sky personal js lib

安装 Install

npm i openrarity

测试 Test

npm test
// normal rank
// same rank

基线测试 Benchmark

npm run benchmark
/* gen Collection items: 100,000   Rarity calc time: 651 ms -- Mac M2

  { v: 1.010524265698629, toeknId: 53076, rank: 1 },
  { v: 1.009992300140172, toeknId: 10548, rank: 2 },
  '.....',
  { v: 0.9894947869513546, toeknId: 44396, rank: 100000 }
*/

覆盖率 Coverage

npm run cov
/*
----------------|---------|----------|---------|---------|-------------------
File            | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------------|---------|----------|---------|---------|-------------------
All files       |     100 |      100 |     100 |     100 |
----------------|---------|----------|---------|---------|-------------------
*/

测试用例 Test Case

const tokenScore = require('openrarity')

let metaData2 = [
  {
    trait1: 'value1',
    trait2: 'value1',
    trait3: 'value1'
  },
  {
    trait1: 'value1',
    trait2: 'value1',
    trait3: 'value1'
  },
  {
    trait1: 'value2',
    trait2: 'value1',
    trait3: 'value3'
  },
  {
    trait1: 'value2',
    trait2: 'value2',
    trait3: 'value3'
  },
  {
    trait1: 'value3 ',
    trait2: 'value3',
    trait3: 'value3'
  }
]
let r = tokenScore(metaData2)

/*
=>
  [
    { v: 1.3926137488801251, toeknId: 4, rank: 1 },
    { v: 1.1338031424711967, toeknId: 3, rank: 2 },
    { v: 0.8749925360622679, toeknId: 0, rank: 3 },
    { v: 0.8749925360622679, toeknId: 1, rank: 3 },
    { v: 0.7235980365241422, toeknId: 2, rank: 4 }
  ]
*/

算法步骤 Algorithm Step

  • Generate trait value map without undefined(blank) trait
  • Generate undefined(blank) trait for every token
  • Generate trait value stats include traitEntropy
  • Generate token trait probability list
0.5.9

1 year ago

0.5.8

2 years ago

0.5.7

2 years ago

0.5.6

2 years ago

0.5.5

2 years ago

0.5.4

2 years ago

0.5.3

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago