datasciencecampus / pygrams

Extracts key terminology (n-grams) from any large collection of documents (>1000) and forecasts emergence
https://datasciencecampus.github.io/pygrams
Other
62 stars 23 forks source link

Bug in SSM with Windows OS #364

Closed IanGrimstead closed 4 years ago

IanGrimstead commented 4 years ago

pygrams.py crashed out when StateSpaceModel internally generates NaN.

ssm.py: dfk_llm_vard func eventually gets inf in matrix P, which produces NaN in D and then Dinv. So from then on NaN spreads across the maths...

IanGrimstead commented 4 years ago

This test fails under Windows:

import unittest

from scripts.algorithms.ssm import StateSpaceModel




class SSMTests(unittest.TestCase):


    def test_StateSpaceModel_(self):

        quarterly_values = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
             4, 3]

        _, _1, smooth_series_s, _intercept = StateSpaceModel(quarterly_values).run_smoothing()