Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import_template erro Expecting value: line 1 column 1 (char 0) #233

Open
wuzxc1230123 opened this issue Feb 17, 2024 · 4 comments
Open

import_template erro Expecting value: line 1 column 1 (char 0) #233

wuzxc1230123 opened this issue Feb 17, 2024 · 4 comments

Comments

@wuzxc1230123
Copy link

wuzxc1230123 commented Feb 17, 2024

import pandas as pd
from autots import AutoTS 

symbol='BTCUSDT'


forecast_length=1

df = pd.read_csv(symbol+"-Reverse-Eval.csv")
df=df[-200:]
print(df.head())

# at = AutoTS(
#     forecast_length=forecast_length,
#     frequency='infer',
#     prediction_interval=0.9,
#     ensemble='all',
#     model_list="fast",  # "superfast", "default", "fast_parallel"
#     transformer_list="fast",  # "superfast",
#     drop_most_recent=1,
#     max_generations=15,
#     subset=100,
#     num_validations=2,
#     validation_method="backwards"
# )

at = AutoTS(
    forecast_length=forecast_length,
    frequency='infer',
    prediction_interval=0.9,
    ensemble='all',
    model_list="fast",  # "superfast", "default", "fast_parallel"
    transformer_list="fast",  # "superfast",
    drop_most_recent=1,
    max_generations=1,
    subset=1,
    num_validations=0,
    validation_method="backwards"
)

model = at.fit(
    df,
    date_col='StartTime',
    value_col='Label',
    id_col='Symbol'
)
# prediction = model.predict()
# print(prediction.forecast)

example_filename = "example_export.csv"  # .csv/.json
model.export_template(example_filename, models='best')


# print(prediction.forecast)


at2 = AutoTS(
    forecast_length=forecast_length,
    frequency='infer',
    prediction_interval=0.9,
    ensemble='all',
    model_list="fast",  # "superfast", "default", "fast_parallel"
    transformer_list="fast",  # "superfast",
    drop_most_recent=1,
    max_generations=1,
    subset=1,
    num_validations=0,
    validation_method="backwards"
)
model2 = at2.import_template(example_filename, method='only') # method='add on'

model2.fit_data(df,    
    date_col='StartTime',
    value_col='Label',
    id_col='Symbol')

prediction2 = model2.predict()
print(prediction2.forecast)

prediction2 = model2.predict() Expecting value: line 1 column 1 (char 0)

@winedarksea
Copy link
Owner

winedarksea commented Feb 17, 2024

You should try reformatting your code here on Github with it inside a block of: ```
right now the markdown you have it turning code comments into headers

https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax

Edit: I've done it for you

@wuzxc1230123
Copy link
Author

你应该尝试在 Github 上重新格式化你的代码,并将其放在以下块中: ``` 现在,你已经将代码注释转换为标题了

https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax

编辑:我已经为你做到了

I’m a little curious. The examples on the official website cannot use already trained models.

@winedarksea
Copy link
Owner

Okay, here's the issue, and yes, it's a bit confusing, so sorry about that:

  • import_template loads the initial template for a model search (.fit) which is a "seed" for a generation search. It allows a gradually evolving template
  • import_best_model imports just the best model and then loads it ready for prediction

so you need to replace

model2 = at2.import_template(example_filename, method='only') # method='add on'

with

model2 = at2.import_best_model(example_filename)

and it should work

winedarksea added a commit that referenced this issue Feb 17, 2024
Adding a little more clarity to help with confusion as in #233
@wuzxc1230123
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants