CategoricalValue[cat]
给出与分类对象 cat 相关联的底层表达式.
CategoricalValue[scale]
给出与给定分类 scale 的类别关联的表达式.
CategoricalValue[obj,prop]
给出类别或分类量表的指定属性 prop.
CategoricalValue
CategoricalValue[cat]
给出与分类对象 cat 相关联的底层表达式.
CategoricalValue[scale]
给出与给定分类 scale 的类别关联的表达式.
CategoricalValue[obj,prop]
给出类别或分类量表的指定属性 prop.
更多信息
- CategoricalValue 通常用于从名义或序数类别及其量表中获取属性,特别是提取其底层表达式.
- CategoricalValue 的第一个参数可以是一个 Nominal 或 Ordinal 对象,无论它们是表示单个类别还是一个分类量表. CategoricalValue 逐项作用于列表输入的各个元素.
- CategoricalValue[scale]
给出与给定分类 scale 的类别关联的表达式. - prop 可取的值包括:
-
"Expression" 类别的底层表达式y "Category" 单个 Nominal 或 Ordinal 类别 "Index" 类别在量表中的索引 "Label" 用于类别排版显示的标签 "Scale" 分类量表 "Score" 用于对 Ordinal 类别进行排序的数值分数
范例
打开所有单元 关闭所有单元基本范例 (3)
将一个 Nominal 类别转换为其底层表达式:
CategoricalValue[Nominal[Association["CategoryList" -> {"Heads", "Tails"}, "LabelList" -> {"Heads", "Tails"},
"ScoreList" -> {1, 2}], 2]]将一个 Nominal 类别列表转换为其底层表达式:
RandomChoice[Nominal[{"Heads", "Tails"}], 6]CategoricalValue[%]获取一个 Ordinal 类别列表的 "Score" 值:
RandomChoice[Ordinal[{"None", "Light", "Moderate", "High", "Maximum"}], 3]CategoricalValue[%, "Score"]范围 (9)
类别的属性 (4)
Nominal[{"male", "female"}, "male"]CategoricalValue[%, "Scale"]Normal[%]CategoricalValue[Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 7], "Scale"]获取 Ordinal 类别的 "Label" 值:
CategoricalValue[Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 7], "Label"]获取 Nominal 类别的 "Index" 值:
CategoricalValue[Nominal[Association["CategoryList" -> {"accrue", "choosy", "spuriously"},
"LabelList" -> {"accrue", "choosy", "spuriously"}, "ScoreList" -> {1, 2, 3}], 2], "Index"]CategoricalValue[{Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 3], Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 1], Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 2], Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 5]}, "Expression"]CategoricalValue[{Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 3], Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 1], Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 2], Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}], 5]}, "Score"]分类量表的属性 (5)
Nominal[{"Heads", "Tails"}]CategoricalValue[%, "Category"]Normal[%]CategoricalValue[Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}]], "Category"]获取 Ordinal 类别的 "Label" 值:
CategoricalValue[Ordinal[Association["CategoryList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "LabelList" -> {"None", "VeryLight", "Light", "Moderate", "High",
"VeryHard", "Maximum"}, "ScoreList" -> {1, 2, 3, 4, 5, 6, 7}]], "Label"]获取 Nominal 量表的 "Index" 值:
CategoricalValue[Nominal[Association["CategoryList" -> {"accrue", "choosy", "spuriously"},
"LabelList" -> {"accrue", "choosy", "spuriously"}, "ScoreList" -> {1, 2, 3}]], "Index"]CategoricalValue[Ordinal[Association["CategoryList" -> {"NS", "S3", "S2", "S1"},
"LabelList" -> {"Not Suitable", "Marginally Suitable", "Moderately Suitable", "Highly Suitable"},
"ScoreList" -> {0, 0.5, 0.75, 1}]], "Expression"]CategoricalValue[Ordinal[Association["CategoryList" -> {"NS", "S3", "S2", "S1"},
"LabelList" -> {"Not Suitable", "Marginally Suitable", "Moderately Suitable", "Highly Suitable"},
"ScoreList" -> {0, 0.5, 0.75, 1}]], "Label"]CategoricalValue[Ordinal[Association["CategoryList" -> {"NS", "S3", "S2", "S1"},
"LabelList" -> {"Not Suitable", "Marginally Suitable", "Moderately Suitable", "Highly Suitable"},
"ScoreList" -> {0, 0.5, 0.75, 1}]], "Score"]CategoricalValue[Ordinal[Association["CategoryList" -> {"NS", "S3", "S2", "S1"},
"LabelList" -> {"Not Suitable", "Marginally Suitable", "Moderately Suitable", "Highly Suitable"},
"ScoreList" -> {0, 0.5, 0.75, 1}]], "Scale"]文本
Wolfram Research (2026),CategoricalValue,Wolfram 语言函数,https://reference.wolfram.com/language/ref/CategoricalValue.html.
CMS
Wolfram 语言. 2026. "CategoricalValue." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/ref/CategoricalValue.html.
APA
Wolfram 语言. (2026). CategoricalValue. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/CategoricalValue.html 年
BibTeX
@misc{reference.wolfram_2026_categoricalvalue, author="Wolfram Research", title="{CategoricalValue}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/CategoricalValue.html}", note=[Accessed: 14-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_categoricalvalue, organization={Wolfram Research}, title={CategoricalValue}, year={2026}, url={https://reference.wolfram.com/language/ref/CategoricalValue.html}, note=[Accessed: 14-August-2026]}