I am trying to explore different skimage metrics on 1D array . I have two array noisy signal and clean signal. Code snippet is given below .
import numpy as np
import skimage.metrics as M
clean_signal = np.arange(1,10, .1)
noisy_signal = clean_signal+np.random.normal(0,1,90)
M.mean_squared_error(noisy_signal, clean_signal)
M.peak_signal_noise_ratio(noisy_signal, clean_signal)
M.variation_of_information(noisy_signal, clean_signal)
Metrics which are given in code snippet are giving following errors .
For adapted_rand_error and variation_of_information I get Error
TypeError: 'numpy.float64' object cannot be interpreted as an integer
and for peak_signal_noise_ratio I get error
ValueError: image_true has intensity values outside the range expected for its data type. Please manually specify the data_range.
I would like to know how to fix these errors.
Thanks in advance
From the documentation, the function
skimage.metrics.variation_of_informationonly accepts integer images:The same is true for
adapted_rand_errorFor your other function, the error message is already telling you much. If we check the documentation again, you can see that the call signature is
You are supposed to specify the
data_rangeparameter, in your case(min(noisy_signal ),max(noisy_signal ))should do