Issue
I am trying to normal distribute my data by using sklearn standard scaler but by default it normalises the data column-wise and not row-wise. How can I use sklearn standardscaler so that it normalises by rows and not columns?
Solution
If you have your data in a numpy array then you can pass the transpose of your array instead of passing the original array. Then after scaling it you can again take its transpose to get original scaled array. Like so:
a = numpy.array(original_array)
a_scaled = StandardScaler.fit_transform(a.T)
a_scaled = a_scaled.T
Answered By - techytushar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.