Previous question · 1049
Capacity To Ship Packages Within D Days
mediumAlgorithms
Next question · 1051
Busiest Two Dayparts
hardDatabase

1050. Negative sampling

medium
GeneralGeneral
manager
Function contract
Inputs
k
int
docs
np.ndarray
queries
np.ndarray
positives
np.ndarray
Returns
value
np.ndarray

Examples

Input
{
  "k": 2,
  "docs": [
    [
      1,
      0,
      0
    ],
    [
      0.9,
      0.1,
      0
    ],
    [
      0,
      1,
      0
    ],
    [
      0,
      0.8,
      0.2
    ]
  ],
  "queries": [
    [
      1,
      0,
      0
    ],
    [
      0,
      1,
      0
    ]
  ],
  "positives": [
    0,
    2
  ]
}
Output
[
  [
    1,
    2
  ],
  [
    3,
    1
  ]
]

Constraints

Hint 1
Hint 2
Hint 3
Roles
ML Engineer
AI Engineer
Data Scientist
Research Scientist
Companies
GeneralGeneral
Levels
manager
staff
senior
Tags
cosine-similarity
hard-negative-mining
top-k-selection
numpy-vectorization

Similar Questions

Linear Regressionmedium
ML Coding
Activation function relueasy
ML Coding
Text normalizationmedium
ML Coding
22 people are solving this problem
Loading editor for the selected language
Ln 1, Col 1
Program Output
DATAINTERVIEW
Interactive coding terminal
Python / NumPy environment ready.
Type a command below or run code from the editor.
run scriptExecute the current editor contents
submitGrade the current editor contents against all solution test cases
python ("print hello world")Run an isolated Python command
helpShow all available commands