-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
It seems like the MaximumLikelihoodEstimationModel is introducing NaNs somewhere. When trying it out with my data that has no NaN values anywhere I get an error:
ValueErrorTraceback (most recent call last)
<ipython-input-1-cf2cd2ac15d7> in <module>()
22 sub_mod_denoise_mle = MaximumLikelihoodEstimationModel(dataset_reader=dataset_reader)
23 sub_mod_denoise_mle_rest = MaximumLikelihoodEstimationModel(dataset_reader=dataset_reader_rest)
---> 24 result_denoise_mle = sub_mod_denoise_mle.run_modeling()
25 result_denoise_mle_rest = sub_mod_denoise_mle_rest.run_modeling()
26 corrs_denoised_mle.append(np.corrcoef(result_denoise_mle['quality_scores'],result_denoise_mle_rest['quality_scores']))
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/sureal/subjective_model.py in run_modeling(self, **kwargs)
61
62 def run_modeling(self, **kwargs):
---> 63 model_result = self._run_modeling(self.dataset_reader, **kwargs)
64 self._postprocess_model_result(model_result, **kwargs)
65 self.model_result = model_result
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/sureal/subjective_model.py in _run_modeling(cls, dataset_reader, **kwargs)
816 print(np.isnan(x_e).any())
817
--> 818 delta_x_e = linalg.norm(x_e_prev - x_e)
819
820 likelihood = np.sum(cls.loglikelihood_fcn(x_es, x_e, b_s, v_s, a_c, dataset_reader.content_id_of_dis_videos, 1, numerical_pdf))
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/scipy/linalg/misc.pyc in norm(a, ord, axis, keepdims)
135 """
136 # Differs from numpy only in non-finite handling and the use of blas.
--> 137 a = np.asarray_chkfinite(a)
138
139 # Only use optimized norms if axis and keepdims are not specified.
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/numpy/lib/function_base.pyc in asarray_chkfinite(a, dtype, order)
1231 if a.dtype.char in typecodes['AllFloat'] and not np.isfinite(a).all():
1232 raise ValueError(
-> 1233 "array must not contain infs or NaNs")
1234 return a
1235
ValueError: array must not contain infs or NaNs
Notice I did change the model to check for NaN values in x_e_prev and x_e, and only x_e contains them. I am not sure what causes this bug, but I'd love to see if someone knows what's the cause.
Edit: Also, I get these additional warning messages:
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/sureal/subjective_model.py:711: RuntimeWarning: divide by zero encountered in divide
num = - np.tile(a_c_e, (S, 1)).T / vs2_add_ace2 + np.tile(a_c_e, (S, 1)).T * a_es**2 / vs2_add_ace2**2
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/sureal/subjective_model.py:711: RuntimeWarning: invalid value encountered in divide
num = - np.tile(a_c_e, (S, 1)).T / vs2_add_ace2 + np.tile(a_c_e, (S, 1)).T * a_es**2 / vs2_add_ace2**2
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/sureal/subjective_model.py:717: RuntimeWarning: divide by zero encountered in divide
den = - vs2_minus_ace2 / vs2_add_ace2**2 + a_es**2 * poly_term / vs2_add_ace2**4
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/sureal/subjective_model.py:717: RuntimeWarning: invalid value encountered in divide
den = - vs2_minus_ace2 / vs2_add_ace2**2 + a_es**2 * poly_term / vs2_add_ace2**4
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/sureal/subjective_model.py:725: RuntimeWarning: divide by zero encountered in divide
-vs2_minus_ace2 / vs2_add_ace2**2 + a_es**2 * poly_term / vs2_add_ace2**4
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/sureal/subjective_model.py:725: RuntimeWarning: invalid value encountered in divide
-vs2_minus_ace2 / vs2_add_ace2**2 + a_es**2 * poly_term / vs2_add_ace2**4
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/sureal/subjective_model.py:730: RuntimeWarning: divide by zero encountered in divide
a_c_std = 1.0 /np.sqrt(np.maximum(0., -lpp))
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/sureal/subjective_model.py:779: RuntimeWarning: divide by zero encountered in divide
num = pd.DataFrame(num_num / num_den).sum(axis=1) # sum over s
/home/fh/miniconda2/envs/keras_py27up/lib/python2.7/site-packages/sureal/subjective_model.py:782: RuntimeWarning: divide by zero encountered in divide
den = pd.DataFrame(den_num / den_den).sum(axis=1) # sum over s
Metadata
Metadata
Assignees
Labels
No labels