{"record":{"id":"3dcc1dfd5e3baf65","repo":"microsoft/qlib","slug":"please-implement-the-start-exp-method","errorCode":null,"errorMessage":"Please implement the `start_exp` method.","messagePattern":"Please implement the `start_exp` method\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"qlib/workflow/expm.py","lineNumber":96,"sourceCode":"        Returns\n        -------\n        An active experiment.\n        \"\"\"\n        self._active_exp_uri = uri\n        # The subclass may set the underlying uri back.\n        # So setting `_active_exp_uri` come before `_start_exp`\n        return self._start_exp(\n            experiment_id=experiment_id,\n            experiment_name=experiment_name,\n            recorder_id=recorder_id,\n            recorder_name=recorder_name,\n            resume=resume,\n            **kwargs,\n        )\n\n    def _start_exp(self, *args, **kwargs) -> Experiment:\n        \"\"\"Please refer to the doc of `start_exp`\"\"\"\n        raise NotImplementedError(f\"Please implement the `start_exp` method.\")\n\n    def end_exp(self, recorder_status: Text = Recorder.STATUS_S, **kwargs):\n        \"\"\"\n        End an active experiment.\n\n        Maintaining `_active_exp_uri` is included in end_exp, remaining implementation should be included in _end_exp in subclass\n\n        Parameters\n        ----------\n        experiment_name : str\n            name of the active experiment.\n        recorder_status : str\n            the status of the active recorder of the experiment.\n        \"\"\"\n        self._active_exp_uri = None\n        # The subclass may set the underlying uri back.\n        # So setting `_active_exp_uri` come before `_end_exp`\n        self._end_exp(recorder_status=recorder_status, **kwargs)","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/workflow/expm.py#L78-L114","documentation":"ExpManager is qlib's abstract experiment-manager base class; the public start_exp handles bookkeeping (active URI) then delegates to _start_exp, whose base implementation raises NotImplementedError. Only concrete managers (MLflowExpManager) implement it, so this error means the abstract manager, or a subclass missing _start_exp, was used to start an experiment.","triggerScenarios":"R.start_exp(...) after C['exp_manager']['class'] was set to the base 'ExpManager' or to a custom class that does not override _start_exp; directly instantiating ExpManager and calling start_exp.","commonSituations":"Customizing qlib config to point at a user-written tracking manager that is still a skeleton; typos in the configured class name that happen to resolve to the base class; code written against an internal fork missing the method.","solutions":["Restore the default: C.exp_manager = {'class': 'MLflowExpManager', 'kwargs': {'uri': ...}} in qlib.init.","In your custom manager subclass, implement _start_exp(experiment_id, experiment_name, recorder_id, recorder_name, resume, **kwargs) returning an Experiment.","Verify the configured class actually subclasses ExpManager AND overrides the private hooks, not just the public methods."],"exampleFix":"# before\nqlib.init(exp_manager={'class': 'ExpManager', 'kwargs': {'uri': 'file:./mlruns'}})\nR.start_exp()  # NotImplementedError\n\n# after\nqlib.init()  # defaults to MLflowExpManager\nR.start_exp(record_name='test')","handlingStrategy":"type-guard","validationCode":"from qlib.workflow.expm import ExpManager\nassert type(R.exp_manager) is not ExpManager and R.exp_manager.__class__._start_exp is not ExpManager._start_exp","typeGuard":"def manager_can_start(mgr) -> bool:\n    from qlib.workflow.expm import ExpManager\n    return mgr.__class__._start_exp is not ExpManager._start_exp","tryCatchPattern":null,"preventionTips":["Run R.start_exp only after qlib.init() with the default MLflowExpManager or a complete custom manager.","Unit-test custom managers against every ExpManager hook before wiring them into config."],"tags":["qlib","abstract-method","not-implemented","exp-manager","config"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}