Previous question · 624
Attention masking
mediumML Coding
Next question · 626
Top Monthly Profit City
hardDatabase
Random coding question

625. Projection onto box constraints

easy
GeneralGeneral
senior
Function contract
Inputs
x
np.ndarray
lower
np.ndarray
upper
np.ndarray
Returns
value
np.ndarray

Examples

Input
{
  "x": [
    2.5,
    -1,
    0.3,
    10
  ],
  "lower": [
    0,
    0,
    0,
    3
  ],
  "upper": [
    2,
    5,
    0.5,
    7
  ]
}
Output
[
  2,
  0,
  0.3,
  7
]

Constraints

Hint 1
Hint 2
Roles
ML Engineer
AI Engineer
Data Scientist
Research Scientist
Companies
GeneralGeneral
Levels
senior
entry
Tags
numpy
projection
clipping
constrained-optimization

Similar Questions

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