Skip to content

model is not fitted yet!  #1484

@LiuHao-THU

Description

@LiuHao-THU

🐛 Bug Description

When I Run Prediction, I met This problem【model is not fitted yet! 】

I run this code in jupyter lab, When I run this code for the second time, The code runs correctly.

To Reproduce

Steps to reproduce the behavior:

Here is the code.

from qlib.workflow.record_temp import SignalRecord, PortAnaRecord, SigAnaRecord

rid = '61cc4cd94ae24137ac196d7e82c8e666'

# backtest and analysis
with R.start(experiment_name='PatchTsT', recorder_id=rid, resume=True): #
    # get model
    model = R.load_object("trained_model")
    # signal-based analysis
    rec = R.get_recorder()
    sar = SigAnaRecord(rec)
    sar.generate()

    # prediction
    sr = SignalRecord(model, dataset, rec)
    sr.generate()
    ba_rid = rec.id 
    
    #  portfolio-based analysis: backtest
    par = PortAnaRecord(rec, port_analysis_config, "day")
    par.generate()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions