Question: need help with python code - Let's considec the problem of data normalization/scaling in statistics and machine learning it is often desirable to convert data
- Let's considec the problem of data normalization/scaling in statistics and machine learning it is often desirable to convert data to a specified range, for example scale the data so that the values falls between 0 and 1, which is called min-max rescaling. Suppose you have a vector (or one dimensional array) of values x, then the min-max rescaled values are given by. x=max(x)min(x)xmin(x) For your exercise, first perform min-max rescaling over a one-dimensional array. Next, assume you are given a two dimensional array; where you need to perform min-max rescaling on each column separately. Test that your code works as expected! rnganp.randon.default_rng( () \# one diensional array: x= rng. standard normal ( size =(5e), * code for min-max rescaling of an array (one line of code) X=rng.standard_nornal (51ze=(50,20)) \# code for min-max rescaling of a 2 -d array 7. can be done in one tine of code. \# moke sure you don't use for loops? To evaluate your code for min-max rescaling compute the following (assuming that your rescaled matrix is stored in a variable named x rescaled): \[ \begin{array}{l} \operatorname{print}(x \text { rescaled,min }(a x 1 s=0)) \\ \text { print }(\text { X_rescaled,nax }(a x i s=0)) \end{array} \]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
