I am trying to hold the precision of a calculated field when converting two variables to a array. When calculating the value it is data type of <class 'numpy.float64'>
and when converting to an array it remains data type of <class 'numpy.float64'>
, however the value moves from 16 numbers -0.2484613592984996
after the decimal to 5 numbers -0.24846
after the decimal respectively.
Here is the code I am using and I tried to use float
when creating the array to maintain the data type:
ham_log = np.log(ham / data_len)
spam_log = np.log(spam / data_len)
log_class_priors = np.array([ham_log, spam_log]).astype(float)