Files
NexQuant/test/utils/env_tpl/read_exp.py
T
Xu Yang e0a24fb46f Several update on the repo (see desc) (#76)
* ignore result csv file

* fix app scripts

* rename taskgenerator to developer and generate to develop

* fix a config bug in coder

* fix a small bug in factor coder evaluators

* remove a single logger in factor coder evaluators

* fix a small bug in model coder main.py

* rename Implementation to Workspace

* move the prepare the inject_code into FBWorkspace to align all the behavior

* fix a small bug in model feedback

* remove debug lines for multi processing and simplify evaluators multi proc

* add a copy function to workspace to freeze the workspace && add config prefix to speed up debugging

* make hypothesisgen a abc class

* use Qlib***Experiment

* fix a small bug

* rename Imp to Ws

* rename sub_implementations to sub_workspace_list

* fix a bug in feedback not presented as content in prompts

* move proposal pys to proposal folder

* reformat the folder

* align factor and model qlib workspace and use template to handle the workspace

* add a filter to evoagent to filter out false evo

* align multi_proc_n into RDAGENT seeting

* handle when runner gets empty experiment

* fix logger merge remaining problems

* fix black and isort automatically
2024-07-17 15:00:13 +08:00

56 lines
1.9 KiB
Python

import qlib
from mlflow.entities import ViewType
from mlflow.tracking import MlflowClient
qlib.init()
from qlib.workflow import R
# here is the documents of the https://qlib.readthedocs.io/en/latest/component/recorder.html
# TODO: list all the recorder and metrics
# Assuming you have already listed the experiments
experiments = R.list_experiments()
# Iterate through each experiment to list its recorders and metrics
experiment_name = None
for experiment in experiments:
print(f"Experiment: {experiment}")
recorders = R.list_recorders(experiment_name=experiment)
# print(recorders)
for recorder_id in recorders:
if recorder_id is not None:
experiment_name = experiment
print(f"Recorder ID: {recorder_id}")
recorder = R.get_recorder(recorder_id=recorder_id, experiment_name=experiment)
metrics = recorder.list_metrics()
print(f"Metrics: {metrics}")
# TODO: get the latest recorder
recorder_list = R.list_recorders(experiment_name="workflow")
end_times = {key: value.info['end_time'] for key, value in recorder_list.items()}
sorted_end_times = dict(sorted(end_times.items(), key=lambda item: item[1], reverse=True))
latest_recorder_id = next(iter(sorted_end_times))
print(f"Latest recorder ID: {latest_recorder_id}")
latest_recorder = R.get_recorder(experiment_name=experiment_name, recorder_id=latest_recorder_id)
print(f"Latest recorder: {latest_recorder}")
pred_df = latest_recorder.load_object("pred.pkl")
print("pred_df", pred_df)
ic_df = latest_recorder.load_object("sig_analysis/ic.pkl")
print("ic_df: ", ic_df)
ric_df = latest_recorder.load_object("sig_analysis/ric.pkl")
print("ric_df: ", ric_df)
print("list_metrics: ", latest_recorder.list_metrics())
print("IC: ", latest_recorder.list_metrics()["IC"])
print("ICIR: ", latest_recorder.list_metrics()["ICIR"])
print("Rank IC: ", latest_recorder.list_metrics()["Rank IC"])
print("Rank ICIR: ", latest_recorder.list_metrics()["Rank ICIR"])