Type error when implementing fitting models from orbit.models.dlt
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- python
- Domain
- machine-learning
Research direction
Start with the documented ETSFull example and inspect orbit/utils/stan.py around compile_stan_model and the package's Stan resource path. Confirm whether the installed package exposes the expected stan resource on Windows with Python 3.9; done means the example fits without the reported NoneType path error.
Written by the indexing model from the issue text.
Description
I attempted to reproduce the results of ETSFull model on load_iclaims() data using code example provided in orbit documentation, however, I ran into TypeError issue.
I did the install of orbit-ml package on Windows 10, and below is the code that I used:
%matplotlib inline
import orbit
from orbit.utils.dataset import load_iclaims
from orbit.models.dlt import ETSFull
from orbit.diagnostics.plot import plot_predicted_data
df = load_iclaims()
date_col = 'week'
response_col = 'claims'
df = load_iclaims()
date_col = 'week'
response_col = 'claims'
dlt = ETSFull(
response_col=response_col,
date_col=date_col,
seasonality=52,
seed=8888,
)
dlt.fit(train_df)
Here is the output of the above code:
TypeError Traceback (most recent call last)
in
----> 1 dlt.fit(train_df)
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\orbit\models\template.py in fit(self, df)
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\orbit\estimators\stan_estimator.py in fit(self, model_name, model_param_names, data_input, fitter, init_values)
105 # passing callable from the model as seen in initfun1()
106 # https://pystan2.readthedocs.io/en/latest/api.html
--> 107 # if None, use default as defined in class variable
108 init_values = init_values or self.stan_init
109 # with suppress_stdout_stderr():
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\orbit\utils\stan.py in get_compiled_stan_model(stan_model_name)
42 """
43
---> 44 compile_stan_model(stan_model_name)
45
46 model_file = pkg_resources.resource_filename(
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\orbit\utils\stan.py in compile_stan_model(stan_model_name)
10 Compile stan model and save as pkl
11 """
---> 12 source_model = pkg_resources.resource_filename(
13 'orbit',
14 'stan/{}.stan'.format(stan_model_name)
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pkg_resources_init_.py in resource_filename(self, package_or_requirement, resource_name)
1133 def resource_filename(self, package_or_requirement, resource_name):
1134 """Return a true filesystem path for specified resource"""
-> 1135 return get_provider(package_or_requirement).get_resource_filename(
1136 self, resource_name
1137 )
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pkg_resources_init_.py in get_provider(moduleOrReq)
352 module = sys.modules[moduleOrReq]
353 loader = getattr(module, 'loader', None)
--> 354 return _find_adapter(_provider_factories, loader)(module)
355
356
~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pkg_resources_init_.py in init(self, module)
1382 def init(self, module):
1383 self.loader = getattr(module, 'loader', None)
-> 1384 self.module_path = os.path.dirname(getattr(module, 'file', ''))
1385
1386 def get_resource_filename(self, manager, resource_name):
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\ntpath.py in dirname(p)
221 def dirname(p):
222 """Returns the directory component of a pathname"""
--> 223 return split(p)[0]
224
225 # Is a path a symbolic link?
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\ntpath.py in split(p)
183 Return tuple (head, tail) where tail is everything after the final slash.
184 Either part may be empty."""
--> 185 p = os.fspath(p)
186 seps = _get_bothseps(p)
187 d, p = splitdrive(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
- Dominant language
- Python
- Stars
- 2.1k
- Forks
- 147
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uber/orbit
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
enhancement refactor
Difficulty 3/5 1-2 days Newbie friendliness 42/100
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100