[null,null,["最后更新时间 (UTC):2025-07-27。"],[[["\u003cp\u003eDecision trees utilize conditions, categorized as axis-aligned (single feature) or oblique (multiple features), to make decisions.\u003c/p\u003e\n"],["\u003cp\u003eConditions can be binary (two outcomes) or non-binary (more than two outcomes), with binary decision trees being more common due to reduced overfitting.\u003c/p\u003e\n"],["\u003cp\u003eThreshold conditions, comparing a feature to a threshold, are the most frequently used type of condition in decision trees.\u003c/p\u003e\n"],["\u003cp\u003eYDF primarily uses axis-aligned conditions, but oblique splits can be enabled for more complex patterns using the \u003ccode\u003esplit_axis="SPARSE_OBLIQUE"\u003c/code\u003e parameter.\u003c/p\u003e\n"],["\u003cp\u003eWhile oblique splits offer greater power, they come at the cost of increased training and inference expenses compared to axis-aligned conditions.\u003c/p\u003e\n"]]],[],null,["# Types of conditions\n\nThis unit focuses on different types of **conditions** used to build decision\ntrees.\n\nAxis-aligned vs. oblique conditions\n-----------------------------------\n\nAn **axis-aligned** **condition** involves only a single feature. An **oblique\ncondition** involves multiple features. For example, the following is an\naxis-aligned condition: \n\n```scdoc\nnum_legs ≥ 2\n```\n\nWhile the following is an oblique condition: \n\n```scdoc\nnum_legs ≥ num_fingers\n```\n\nOften, decision trees are trained with only axis-aligned conditions. However,\noblique splits are more powerful because they can express more complex\npatterns. Oblique splits sometime produce better results at the expense\nof higher training and inference costs. \nYDF Code\nIn YDF, decision trees are trained with axis-aligned condition by default. You can enable decision oblique trees with the `split_axis=\"SPARSE_OBLIQUE\"` parameter.\n\n**Figure 4. Examples of an axis-aligned condition and an oblique condition.**\n\nGraphing the preceding two conditions yields the following feature space\nseparation:\n\n**Figure 5. Feature space separation for the conditions in Figure 4.**\n\nBinary vs. non-binary conditions\n--------------------------------\n\nConditions with two possible outcomes (for example, true or false) are called\n**binary conditions** . Decision trees containing only binary conditions are\ncalled **binary decision trees**.\n\n**Non-binary conditions** have more than two possible outcomes. Therefore,\nnon-binary conditions have more discriminative power than binary conditions.\nDecisions containing one or more non-binary conditions are called **non-binary decision\ntrees**.\n\n**Figure 6: Binary versus non-binary decision trees.**\n\nConditions with too much\npower are also more likely to overfit. For this reason, decision forests\ngenerally use binary decision trees, so this course will focus on them.\n| **Note:** A non-binary condition can be emulated with multiple binary conditions; therefore, binary trees are not inherently less powerful than non-binary trees.\n\nThe most common type of condition is the **threshold condition** expressed as: \n\n```text\nfeature ≥ threshold\n```\n\nFor example: \n\n```scdoc\nnum_legs ≥ 2\n```\n\nOther types of conditions exist. Following are other commonly used types of\nbinary conditions:\n\n**Table 2. Common types of binary conditions.**\n\n|---------------------|------------------------------------------------------------------------------|------------------------------------------------------------------|\n| **Name** | **Condition** | **Example** |\n| threshold condition | $\\\\mathrm{feature}_i \\\\geq \\\\mathrm{threshold}$ | $\\\\mathrm{num\\\\_legs} \\\\geq 2$ |\n| equality condition | $\\\\mathrm{feature}_i = \\\\mathrm{value}$ | $\\\\mathrm{species} = \\`\\`cat\"$ |\n| in-set condition | $\\\\mathrm{feature}_i \\\\in \\\\mathrm{collection}$ | $\\\\mathrm{species} \\\\in \\\\{\\`\\`cat\", \\`\\`dog\", \\`\\`bird\"\\\\}$ |\n| oblique condition | $\\\\sum_{i} \\\\mathrm{weight}_i \\\\mathrm{feature}_i \\\\geq \\\\mathrm{threshold}$ | $5 \\\\ \\\\mathrm{num\\\\_legs} + 2 \\\\ \\\\mathrm{num\\\\_eyes} \\\\geq 10$ |\n| feature is missing | $\\\\mathrm{feature}_i \\\\mathrm{is} \\\\mathrm{Missing}$ | $\\\\mathrm{num\\\\_legs} \\\\mathrm{is} \\\\mathrm{Missing}$ |"]]