Previous question · 1343
Batch normalization forward pass
mediumML Coding
Next question · 1345
Score Gap Analysis
easyDatabase
Random coding question

1344. Ordinal encoding

easy
GeneralGeneral
senior
Function contract
Inputs
values
np.ndarray
unknown_value
int
ordered_categories
np.ndarray
Returns
value
np.ndarray

Examples

Input
{
  "values": [
    "M",
    "S",
    "XL",
    "XS"
  ],
  "unknown_value": -1,
  "ordered_categories": [
    "XS",
    "S",
    "M",
    "L",
    "XL"
  ]
}
Output
[
  2,
  1,
  4,
  0
]

Constraints

Hint 1
Hint 2
Hint 3
Roles
ML Engineer
AI Engineer
Data Scientist
Research Scientist
Analytics Engineer
Companies
GeneralGeneral
Levels
senior
entry
Tags
ordinal-encoding
hash-map
categorical-features
python-list-comprehension

Similar Questions

Linear Regressionmedium
ML Coding
Activation function relueasy
ML Coding
Text normalizationmedium
ML Coding
34 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