Skip to content

Type error while generating cynet log files #3

@ctbaum

Description

@ctbaum

While closely following the cynet_crime_example.pdf script 6 fails with the following stacktrace

[Parallel(n_jobs=4)]: Using backend ThreadingBackend with 4 concurrent workers.
Traceback (most recent call last):
  File "/home/ubuntu/Home/Job/Python/Granger/Examples/ChicagoCrime/payload/script6.py", line 17, in <module>
    cn.run_pipeline(
  File "/home/ubuntu/miniconda3/envs/granger/lib/python3.10/site-packages/cynet/cynet.py", line 2024, in run_pipeline
    Parallel(n_jobs = cores, verbose = 1, backend = 'threading')\
  File "/home/ubuntu/miniconda3/envs/granger/lib/python3.10/site-packages/joblib/parallel.py", line 1098, in __call__
    self.retrieve()
  File "/home/ubuntu/miniconda3/envs/granger/lib/python3.10/site-packages/joblib/parallel.py", line 975, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "/home/ubuntu/miniconda3/envs/granger/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
  File "/home/ubuntu/miniconda3/envs/granger/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/ubuntu/miniconda3/envs/granger/lib/python3.10/site-packages/joblib/_parallel_backends.py", line 620, in __call__
    return self.func(*args, **kwargs)
  File "/home/ubuntu/miniconda3/envs/granger/lib/python3.10/site-packages/joblib/parallel.py", line 288, in __call__
    return [func(*args, **kwargs)
  File "/home/ubuntu/miniconda3/envs/granger/lib/python3.10/site-packages/joblib/parallel.py", line 288, in <listcomp>
    return [func(*args, **kwargs)
  File "/home/ubuntu/miniconda3/envs/granger/lib/python3.10/site-packages/cynet/cynet.py", line 1884, in parallel_process
    M.select(var='delay',inplace=True,low=Horizon)
  File "/home/ubuntu/miniconda3/envs/granger/lib/python3.10/site-packages/cynet/cynet.py", line 922, in select
    this_dict={key:this_dict[key] for key in list(this_dict.keys()) if key >= low }
  File "/home/ubuntu/miniconda3/envs/granger/lib/python3.10/site-packages/cynet/cynet.py", line 922, in <dictcomp>
    this_dict={key:this_dict[key] for key in list(this_dict.keys()) if key >= low }
TypeError: '>=' not supported between instances of 'int' and 'list'

The offending line in source code appears within

	def select(self,var="gamma",n=None,
			   reverse=False, store=None,
			   high=None,low=None,equal=None,inplace=False):
		"""
...

		Selects the N top models as ranked by var specified value
		(in reverse order if reverse is True)

		Inputs -
			var (string): model parameter to rank by
			n (int): number of models to return
			reverse (boolean): return in ascending order (True)
				or descending (False) order
			store (string): name of file to store selection json
			high (float): higher cutoff
			low (float): lower cutoff
			inplace (bool): update models if true

		Output -
			(dictionary): top n models as ranked by var
						 in ascending/descending order
		"""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions