{"record":{"id":"4c0c7d9cb95de89b","repo":"microsoft/qlib","slug":"report-factor-should-be-one-of-annualized-return","errorCode":null,"errorMessage":"report_factor should be one of annualized_return, information_ratio, max_drawdown, mean, std, model_pearsonr and model_score","messagePattern":"report_factor should be one of annualized_return, information_ratio, max_drawdown, mean, std, model_pearsonr and model_score","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"qlib/contrib/tuner/config.py","lineNumber":84,"sourceCode":"            \"excess_return_without_cost\",\n            \"excess_return_with_cost\",\n            \"model\",\n        ]:\n            raise ValueError(\n                \"report_type should be one of pred_long, pred_long_short, pred_short, excess_return_without_cost, excess_return_with_cost and model\"\n            )\n\n        self.report_factor = config.get(\"report_factor\", \"information_ratio\")\n        if self.report_factor not in [\n            \"annualized_return\",\n            \"information_ratio\",\n            \"max_drawdown\",\n            \"mean\",\n            \"std\",\n            \"model_score\",\n            \"model_pearsonr\",\n        ]:\n            raise ValueError(\n                \"report_factor should be one of annualized_return, information_ratio, max_drawdown, mean, std, model_pearsonr and model_score\"\n            )\n\n        self.optim_type = config.get(\"optim_type\", \"max\")\n        if self.optim_type not in [\"min\", \"max\", \"correlation\"]:\n            raise ValueError(\"optim_type should be min, max or correlation\")\n","sourceCodeStart":66,"sourceCodeEnd":91,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/contrib/tuner/config.py#L66-L91","documentation":"OptimizationConfig (qlib/contrib/tuner/config.py) validates the report_factor field: only annualized_return, information_ratio, max_drawdown, mean, std, model_score, and model_pearsonr are allowed. This factor is the metric the tuner optimizes over the chosen report, so an unknown metric cannot be ranked and the config is rejected immediately.","triggerScenarios":"A tuner YAML with optimization_criteria: report_factor: sharpe (or any value outside the whitelist, including case variants like 'Information_Ratio') raises ValueError when TunerConfigManager loads it.","commonSituations":"Wanting a custom metric (Sharpe ratio, win rate) that the tuner never supported; typo or case mismatch; configs written for a different qlib version with a different whitelist.","solutions":["Use one of the supported factors: annualized_return, information_ratio, max_drawdown, mean, std, model_score, model_pearsonr","Check exact lowercase spelling in optimization_criteria.report_factor","If you truly need a custom metric, subclass OptimizationConfig or post-process the tuner's report instead of adding the value to YAML"],"exampleFix":"# before (tuner_config.yaml)\noptimization_criteria:\n  report_factor: sharpe_ratio\n\n# after\noptimization_criteria:\n  report_factor: information_ratio","handlingStrategy":"validation","validationCode":"VALID_FACTORS = {'annualized_return', 'information_ratio', 'max_drawdown', 'mean', 'std', 'model_score', 'model_pearsonr'}\nassert cfg['optimization_criteria']['report_factor'] in VALID_FACTORS","typeGuard":"def is_valid_report_factor(f: str) -> bool:\n    return f in {'annualized_return', 'information_ratio', 'max_drawdown', 'mean', 'std', 'model_score', 'model_pearsonr'}","tryCatchPattern":null,"preventionTips":["Pick optimization metrics only from the shipped whitelist; compute custom metrics post-hoc from reports","Watch for case mismatches like Information_Ratio"],"tags":["qlib","tuner","configuration","validation"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}