FeatureNames
Details
- Possible settings for FeatureNames include:
-
Automatic assign names automatically {"n1","n2",…} name the i
feature "ni"
- Feature names must be strings.
- When FeatureNamesAutomatic, features are named "f1", "f2", etc.
- In the case of a dataset with named features, FeatureNames{"n1","n2",…} can be used to define the ordering of the features.
Examples
Basic Examples (3)
Train a classifier and give a name to each feature:
c = Classify[{{2.3, "male"} -> "a", {4.8, Missing[]} -> "b", {Missing[], "female"} -> "a", {5.2, "female"} -> "b"}, FeatureNames -> {"age", "gender"}]Use the association format to predict a new example:
c[<|"age" -> 3.3, "gender" -> "male"|>]The list format can still be used:
c[{3.3, "male"}]Train a predictor on a training set with named features, and use FeatureNames to set their order:
p = Predict[{<|"age" -> 2.3, "gender" -> "male"|> -> 1, <|"age" -> 4.6|> -> 2.5, <|"gender" -> "female"|> -> 8.4, <|"gender" -> "female", "age" -> 5.2|> -> -2}, FeatureNames -> {"gender", "age"}]Features are ordered as specified:
Information[p, FeatureNames]Classify a new example from a list:
p[{"female", 6.5}]Train a classifier without specifying feature names:
c = Classify[{{1.4, 3.5} -> "A", {2.3, 5.4 } -> "A", {5.3, 1.3} -> "B", {6.8, -.3} -> "B"}]Use Information and FeatureNames to obtain the names that have been automatically given to features:
Information[c, FeatureNames]Use these names to classify a new example described by an association:
c[<|"f1" -> {3.3, 5.1}|>]See Also
History
Text
Wolfram Research (2015), FeatureNames, Wolfram Language function, https://reference.wolfram.com/language/ref/FeatureNames.html.
CMS
Wolfram Language. 2015. "FeatureNames." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FeatureNames.html.
APA
Wolfram Language. (2015). FeatureNames. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FeatureNames.html
BibTeX
@misc{reference.wolfram_2026_featurenames, author="Wolfram Research", title="{FeatureNames}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/FeatureNames.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_featurenames, organization={Wolfram Research}, title={FeatureNames}, year={2015}, url={https://reference.wolfram.com/language/ref/FeatureNames.html}, note=[Accessed: 12-June-2026]}