question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error to train using autofit

See original GitHub issue

It’s my first time creating an issue so I’m sorry if I’m wrong about something 😃

I have problems when using the autofit function, when executing these lines

boosted_model = tb.ThymeBoost(verbose=0)
output = boosted_model.autofit(al_train['value'], seasonal_period=288)
predicted_output = boosted_model.predict(output, len(al_test))
tb_mae = np.mean(np.abs(al_test - predicted_output['predictions']))

I get the following error:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
[<ipython-input-10-c3af4c216539>](https://localhost:8080/#) in <module>()
      1 boosted_model = tb.ThymeBoost(verbose=0)
----> 2 output = boosted_model.autofit(al_train['value'], seasonal_period=288)
      3 predicted_output = boosted_model.predict(output, len(al_test))
      4 tb_mae = np.mean(np.abs(al_test - predicted_output['predictions']))
      5 tb_rmse = (np.mean((al_test - predicted_output['predictions'])**2))**.5

[/usr/local/lib/python3.7/dist-packages/ThymeBoost/ThymeBoost.py](https://localhost:8080/#) in autofit(self, time_series, seasonal_period, optimization_type, optimization_strategy, optimization_steps, lag, optimization_metric, test_set, verbose)
    578             seasonal_sample_weights = []
    579             weight = 1
--> 580             for i in range(len(y)):
    581                 if (i) % max_seasonal_pulse == 0:
    582                     weight += 1

NameError: name 'y' is not defined

In the previous version (0.1.10) if I could execute these lines

environment:

al_train:

time value
2022-05-28 00:00:00 3108860000.0
2022-05-28 00:05:00 3406160000.0
2022-05-28 00:10:00 3535540000.0
2022-05-28 00:15:00 3544810000.0
2022-05-28 00:20:00 3336570000.0
2022-05-28 00:25:00 2994020000.0
2022-05-28 00:30:00 3130380000.0
2022-05-28 00:35:00 2953710000.0

[…]

INFO al_train:

shape:  (840, 1)
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 840 entries, 2022-05-28 00:00:00 to 2022-05-30 21:55:00
Data columns (total 1 columns):
 #   Column  Non-Null Count  Dtype  
---  ------  --------------  -----  
 0   value   840 non-null    float64
dtypes: float64(1)
memory usage: 13.1 KB

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
manuelchacon07commented, Jul 27, 2022

It’s works, thanks for help me and upload the version 😃

0reactions
tblume1992commented, Jul 27, 2022

Awesome, just remember when using autofit that the default params are:

optimization_strategy='cv', optimization_steps=3, lag=2

Which does 3 rounds of forecasts and tests on a rolling 2 period test set. Seeing that your seasonal period is 288, you may want to increase the lag (i.e. how much to test on). The total size of the holdout is optimization_steps * lag so by default 6.

If you passed:

optimization_strategy='holdout', optimization_steps=3, lag=144

Now it simply tests on the last 144 data points once (optimization_steps are ignored when strategy is holdout). May be a better strategy for autofitting with a large dataset.

Hopefully that makes sense!

Read more comments on GitHub >

github_iconTop Results From Across the Web

You cannot use the AutoFit feature for rows or columns that ...
In Excel, you cannot use the AutoFit feature on a column that contains a cell merged with cells in other columns. Likewise, you...
Read more >
Excel 2016 - Autofit & Column Width - How to Change Adjust ...
272K views 3 years ago Excel 2016 Tutorials for Beginners - Learn How To Use Functions and Formulas -Microsoft Office Specialist Exam ...
Read more >
Excel AUTOFIT: Make Rows/Columns Fit the Text Automatically
Learn all about Excel autofit - a feature to fit the text automatically in a column or rows. In this tutorial, I cover...
Read more >
How to Autofit Excel Cells? 3 Best Methods - Simon Sez IT
There are three ways to use autofit in Excel. You can use the mouse, the Excel ribbon menu, or directly use keyboard shortcuts...
Read more >
Autofit using Proc Export - SAS Support Communities
Can someone tell me how to autofit columns in Excel using PROC Export? Here is what I have right now PROC EXPORT DATA...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found