Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

10
LINES

< > BotCompany Repo | #1035313 // scoreForIndexInProbabilisticList

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (83L/1K).

// converts the index of a correct guess in a probabilistic
// list to a score between 0 and 1

// properties:
// -index 0 gets score 1
// -higher indices get lower scores
// -index -1 (not found) gets score 0
static double scoreForIndexInProbabilisticList(int index) {
  ret index < 0 ? 0 : distanceToProbability(index);
}

Author comment

Began life as a copy of #1035312

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035313
Snippet name: scoreForIndexInProbabilisticList
Eternal ID of this version: #1035313/1
Text MD5: 5937aef0d3f6a07b49ff9e14d2523026
Transpilation MD5: 17acd1d328c3c355a4b1f65bcda0c919
Author: stefan
Category: javax / maths
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-30 18:53:41
Source code size: 332 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 70 / 94
Referenced in: [show references]