{"record":{"id":"5a84a53a04d22709","repo":"Unity-Technologies/ml-agents","slug":"threshold-for-next-lesson-cannot-be-greater-than-1","errorCode":null,"errorMessage":"Threshold for next lesson cannot be greater than 1 when the measure is progress.","messagePattern":"Threshold for next lesson cannot be greater than 1 when the measure is progress\\.","errorType":"validation","errorClass":"TrainerConfigError","httpStatus":null,"severity":"error","filePath":"ml-agents/mlagents/trainers/settings.py","lineNumber":481,"sourceCode":"        PROGRESS: str = \"progress\"\n        REWARD: str = \"reward\"\n\n    behavior: str\n    measure: MeasureType = attr.ib(default=MeasureType.REWARD)\n    min_lesson_length: int = 0\n    signal_smoothing: bool = True\n    threshold: float = attr.ib(default=0.0)\n    require_reset: bool = False\n\n    @threshold.validator\n    def _check_threshold_value(self, attribute, value):\n        \"\"\"\n        Verify that the threshold has a value between 0 and 1 when the measure is\n        PROGRESS\n        \"\"\"\n        if self.measure == self.MeasureType.PROGRESS:\n            if self.threshold > 1.0:\n                raise TrainerConfigError(\n                    \"Threshold for next lesson cannot be greater than 1 when the measure is progress.\"\n                )\n            if self.threshold < 0.0:\n                raise TrainerConfigError(\n                    \"Threshold for next lesson cannot be negative when the measure is progress.\"\n                )\n\n    def need_increment(\n        self, progress: float, reward_buffer: List[float], smoothing: float\n    ) -> Tuple[bool, float]:\n        \"\"\"\n        Given measures, this method returns a boolean indicating if the lesson\n        needs to change now, and a float corresponding to the new smoothed value.\n        \"\"\"\n        # Is the min number of episodes reached\n        if len(reward_buffer) < self.min_lesson_length:\n            return False, smoothing\n        if self.measure == CompletionCriteriaSettings.MeasureType.PROGRESS:","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/Unity-Technologies/ml-agents/blob/3ecb446f75d1e7400eb404c562dc005d3164cffc/ml-agents/mlagents/trainers/settings.py#L463-L499","documentation":"LessonSettings validates that when the lesson `measure` is PROGRESS, the `threshold` for advancing to the next lesson must lie between 0 and 1, because progress is measured as a normalized value in [0, 1]. A threshold above 1.0 is unreachable and raises this error.","triggerScenarios":"Configuring a curriculum lesson with `measure: progress` and `threshold: 5` (or any value > 1.0) in the trainer YAML.","commonSituations":"Users confuse progress (0-1 normalized) with reward or value measures, which can use arbitrary thresholds, and copy a large threshold from a reward-based curriculum.","solutions":["Set threshold to a fraction between 0 and 1 (e.g. 0.7) when measure is progress.","Switch measure to `reward` or `value` if a large absolute threshold is intended.","Re-normalize thresholds when converting a reward-based curriculum to progress-based."],"exampleFix":"# before\nmeasure: progress\nthreshold: 5.0\n\n# after\nmeasure: progress\nthreshold: 0.7","handlingStrategy":"validation","validationCode":"for lesson in cfg.get('behavioral_cloning', {}).get('lessons', []):\n    if lesson.get('measure') == 'progress' and not (0.0 <= lesson['threshold'] <= 1.0):\n        raise ValueError('progress thresholds must be within [0, 1]')","typeGuard":"def is_valid_progress_threshold(lesson) -> bool:\n    return lesson.get('measure') != 'progress' or 0.0 <= lesson.get('threshold', 0) <= 1.0","tryCatchPattern":"try:\n    config = TrainerSettings.structure(raw)\nexcept TrainerConfigError as e:\n    if 'Threshold for next lesson' in str(e):\n        print('Use a 0-1 threshold for progress measure')\n    raise","preventionTips":["Remember progress thresholds are fractions, rewards are absolute","Review curriculum thresholds after switching measure types","Add schema validation restricting progress thresholds to [0,1]"],"tags":["config","curriculum","validation","lessons"],"backgroundTag":"invalid-hyperparameter-value","analyzedSha":"3ecb446f75d1e7400eb404c562dc005d3164cffc","analyzedAt":"2026-09-02T16:33:12.832Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}