Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i have numpy array fo certain size and i am providing that array as an input to my random forest classifier in scikit learn. The issue some of the array rows have values in exponential form. for example :
Python
[  9.80896897e-02   5.59544777e-02   2.49288714e-02   9.89025877e-03
   4.06448991e-03   2.30321095e-03   1.21934697e-03   8.12897981e-04
   5.41931988e-04   1.21934697e-03   1.35482997e-03   1.89676196e-03
   3.11610893e-03   2.16772795e-03   3.65804092e-03   1.49031297e-03
   3.92900691e-03   1.08386398e-03   1.49031297e-03   3.65804092e-03
   6.50318385e-03   1.25999187e-02   4.52513210e-02   9.21284379e-02
   6.20647609e-01]


What I have tried:

I have tried to use np.around upto 8 decimal places but that does not work. If i tried to have value of more that 4 decimal point it makes it in exponential form.

Also, tried to convert those values to np.float128 form but the moment i pass those value to classifier.fit() function it again internally convert them float64 form.

Supressing the print form also didn't help.
Posted
Comments
phil.o 9-Dec-17 11:38am    
What is the problem with this representation? You do realize that it is just another way to represent a floating point number, do you? And that 9.808968897e-02 and 0.09808968897 are two distinct representations of the same value?
Richard MacCutchan 9-Dec-17 13:03pm    
You need to learn the difference between values held in memory and their visual representation.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900