facebookresearch / Kats

Kats, a kit to analyze time series data, a lightweight, easy-to-use, generalizable, and extendable framework to perform time series analysis, from understanding the key statistics and characteristics, detecting change points and anomalies, to forecasting future trends.
MIT License
4.85k stars 530 forks source link

from kats.models.metalearner.get_metadata import GetMetaData Error #293

Open nebiyebulan opened 1 year ago

nebiyebulan commented 1 year ago

When I use the getmetadata module of kats, I get this error. I want to build the model, but I can't.

build_model

` def build_model(ts,end_day):

    df = ts.to_dataframe().set_index('time').loc[:end_day]
    df = df.tail(20000)
    newts = TimeSeriesData(df.reset_index())
    MD = GetMetaData(data=newts[:], error_method='smape')
    metadata=MD.get_meta_data()
    #dfp_rank = pd.DataFrame.from_dict(metadata['hpt_res'], orient="index", columns=["parameter", "metric"])

    best_params = metadata['hpt_res'][metadata['best_model']][0]
    best_model = MD.all_models[metadata['best_model']]
    params = MD.all_params[metadata_['best_model']](**best_params)
    print(best_model)
    print(params)`