({{, (RefLink[FeatureSpacePlot, paclet:ref/FeatureSpacePlot])[{(Subscript[example, 1]),(Subscript[example, 2]),…}] 
plots features extracted from the (Subscript[example, i]) as a scatter plot.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[FeatureSpacePlot, paclet:ref/FeatureSpacePlot]) can be used on many types of data, including numerical, textual, sounds and images, and combinations of these.

Each (Subscript[example, i]) can be a single data element, a list of data elements, an association of data elements, or a (RefLink[Dataset, paclet:ref/Dataset]) object.

The following wrappers w can be used for the (Subscript[example, i]):

Wrappers w can be applied at multiple levels:

(RefLink[Callout, paclet:ref/Callout]), (RefLink[Labeled, paclet:ref/Labeled]), and (RefLink[Placed, paclet:ref/Placed]) can use the following positions pos:

(RefLink[FeatureSpacePlot, paclet:ref/FeatureSpacePlot]) has the same options as (RefLink[Graphics, paclet:ref/Graphics]), with the following additions and changes:

(RefLink[LabelingFunction, paclet:ref/LabelingFunction])->f specifies that each point should have a label given by f[value,index,lbls], where value is the value associated with the point, index is its position in the data and lbls is the list of relevant labels.

Possible settings for (RefLink[Method, paclet:ref/Method]) include:

OpenersPrimaryExamplesSection(Spacer1)Examples  (51)

OpenersExampleSection0(Spacer1)Basic Examples  (6)

Plot the features of the shapes of alphabets:

imgs=Rasterize/@Alphabet[]

FeatureSpacePlot[imgs]

Plot the features extracted from images:

FeatureSpacePlot[{,, ,,,}]

Change the size of images used as labels:

FeatureSpacePlot[{,, ,,,},LabelingSize->60]

Use (RefLink[Callout, paclet:ref/Callout]) to place labels:

FeatureSpacePlot[{,, ,,,},LabelingFunction->Callout]

Plot features extracted from audio recordings:

list=ExampleData/@ExampleData["Audio"];
FeatureSpacePlot[list,LabelingFunction->Callout]

Extract features from a simple dataset:

FeatureSpacePlot[{{1.4,"A"},{1.5,"A"},{2.3,"B"},{5.4,"B"}}]

OpenersExampleSection1(Spacer1)Scope  (20)

OpenersExampleSubsection0(Spacer1)Data  (4)

Simple examples such as images and text are shown directly in the plot:

FeatureSpacePlot[EntityValue["Country","FlagImage"]]

Extract features on a mixed-type dataset:

FeatureSpacePlot[{{"the cat is grey",},{"my cat is fast",},{"this dog is scary",},{"the big dog",}},LabelingFunction->Tooltip]

Extract features from a dataset that contains missing values:

FeatureSpacePlot[{{1.4,Missing[],"A"},{1.5,50.2,"A"},{Missing[],42.3,"B"},{5.4,61.7,"B"}},LabelingFunction->(Placed[#,Center]&)]

Extract features from a dataset formatted as a list of associations:

FeatureSpacePlot[{<|"age"->32,"height"->160, "gender"-> "female"|>,
<|"height"->183,"age"->41,"gender"-> "female"|>,
<|"height"->123,"age"->30,"gender"-> "female"|>,
<|"height"->175,"age"->21,"gender"-> "male"|>,
<|"height"->150,"age"->11,"gender"-> "male"|>,
<|"age"->52,"height"->164,"gender"-> "female"|>},LabelingFunction->Tooltip]

OpenersExampleSubsection1(Spacer1)Wrappers  (9)

Use wrappers on individual examples:

FeatureSpacePlot[{{15,,"debit"},{68,,"paneling"},Style[{38,,"uremia"},Red],{98,,"broccoli"},{74,,"bonehead"}}]

Use wrappers on the entire collection of examples:

FeatureSpacePlot[Style[{{15,,"debit"},{68,,"paneling"},{38,,"uremia"},{98,,"broccoli"},{74,,"bonehead"}},Blue]]

Wrappers can be nested:

FeatureSpacePlot[Style[{{15,,"debit"},{68,,"paneling"},Style[{38,,"uremia"},Red],{98,,"broccoli"},{74,,"bonehead"}},Blue]]

Use the value of each point as a tooltip:

FeatureSpacePlot[Tooltip[{{15,,"debit"},{68,,"paneling"},Style[{38,,"uremia"},Red],{98,,"broccoli"},{74,,"bonehead"}}]]

Label points with automatically positioned text:

FeatureSpacePlot[Table[Labeled[{RandomInteger[100],RandomColor[],RandomWord[]},i],{i,15}]]

Use callouts to label points:

FeatureSpacePlot[Table[Callout[{RandomInteger[100],RandomColor[],RandomWord[]},i],{i,15}]]

Add tooltips to each point:

FeatureSpacePlot[Table[Tooltip[country[{"Population","Area","FlagImage"}],country],{country,EntityList[LinguisticAssistant]}]]

Use (RefLink[PopupWindow, paclet:ref/PopupWindow]) to provide additional drilldown information:

FeatureSpacePlot[Table[PopupWindow[country[{"Population","Area","FlagImage"}],country["FlagImage"]],{country,EntityList[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"])]}]]

(RefLink[Button, paclet:ref/Button]) can be used to trigger any action:

data=EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),{"FlagImage","Name","Population","Area"},"PropertyAssociation"];

FeatureSpacePlot[Map[Tooltip[Button[{#Population,#Area},Speak[#Name]],#FlagImage]&,data]]

OpenersExampleSubsection2(Spacer1)Labeling  (3)

Simple examples such as images and text are shown directly in the plot:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"]]

Use the examples as tooltips:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->Tooltip]

Use the keys in data as tooltips:

data=EntityValue[LinguisticAssistant,{"Name","Population","Area","FlagImage"},"Association"];

FeatureSpacePlot[data,LabelingFunction->Tooltip]

OpenersExampleSubsection3(Spacer1)Presentation  (4)

Use a gray background for the plot:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],Background->Gray]

Represent the examples as stars in the plot:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->Tooltip,PlotMarkers->"★"]

Use large purple points:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->Tooltip,PlotStyle->Directive[PointSize[Large],Purple]]

Use a plot theme with a frame and grid lines:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->Tooltip,PlotTheme->"Detailed"]

Combine the detailed theme with a theme that uses open shapes for the points:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->Tooltip,PlotTheme->{"Detailed","OpenMarkers"}]

OpenersExampleSection2(Spacer1)Options  (24)

OpenersExampleSubsection4(Spacer1)Background  (2)

By default, plots do not have a background:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"]]

Use a light gray background:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],Background->LightGray]

OpenersExampleSubsection5(Spacer1)FeatureExtractor  (1)

By default, features are automatically chosen based on input type:

images={,,,,,,};

FeatureSpacePlot[images,LabelingFunction->Callout]

Use a different setting:

FeatureSpacePlot[images,LabelingFunction->Callout,FeatureExtractor->({Mean[Mean[#]],Mean[StandardDeviation[#]]}&)]

Use a random position as the feature:

FeatureSpacePlot[images,LabelingFunction->Callout,FeatureExtractor->(RandomReal[1,2]&)]

OpenersExampleSubsection6(Spacer1)LabelingFunction  (3)

Simple examples such as images and text are shown directly in the plot:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"]]

Show the examples as points:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->None]

Show the examples as points with the original data in tooltips:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->Tooltip]

OpenersExampleSubsection7(Spacer1)LabelingSize  (4)

Size of labels are determined automatically:

data=EntityValue[LinguisticAssistant,"FlagImage"];

Table[FeatureSpacePlot[Take[data,n]],{n,{30,60,150,All}}]

Specify the size of labels:

Table[FeatureSpacePlot[{,, ,,,},LabelingSize->s],{s,{20,40}}]

Specify the size of callout:

FeatureSpacePlot[{,,,,,,},LabelingFunction->Callout,LabelingSize->50]

Limit the display size for text:

SeedRandom[3];FeatureSpacePlot[RandomWord[20],LabelingSize->40,LabelingFunction->Callout]

OpenersExampleSubsection8(Spacer1)Method  (2)

(RefLink[FeatureSpacePlot, paclet:ref/FeatureSpacePlot]) uses (RefLink[Method, paclet:ref/Method])->"TSNE" by default:

FeatureSpacePlot[{,,,,,,},Method->"TSNE",LabelingSize->50]

Use different methods:

Table[FeatureSpacePlot[{,,,,,,},Method->m,PlotLabel->m,ImageSize->225],{m,{"LatentSemanticAnalysis","LowRankMatrixFactorization"}}]

OpenersExampleSubsection9(Spacer1)PerformanceGoal  (1)

Generate a plot using flags for countries in Europe:

flags=EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"];

AbsoluteTiming[FeatureSpacePlot[flags]]

Use a faster method to position the flags:

AbsoluteTiming[FeatureSpacePlot[flags,PerformanceGoal->"Speed"]]

OpenersExampleSubsection10(Spacer1)PlotLabel  (1)

Add an overall label to the plot:

FeatureSpacePlot[EntityValue["Country","FlagImage"],PlotLabel->"World Flags"]

OpenersExampleSubsection11(Spacer1)PlotMarkers  (1)

Change the appearance of the plot markers:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->Tooltip,PlotMarkers->"⊙"]

OpenersExampleSubsection12(Spacer1)PlotRangePadding  (2)

Increase the padding around the contents of the plot:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],PlotRangePadding->Scaled[0.1],Background->LightGray]

Do not add any padding to the plot:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],PlotRangePadding->None,Background->LightGray]

OpenersExampleSubsection13(Spacer1)PlotStyle  (2)

Use red points to represent the examples:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->Tooltip,PlotStyle->Red]

Make the points large and red:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->Tooltip,PlotStyle->Directive[PointSize[Large],Red]]

OpenersExampleSubsection14(Spacer1)PlotTheme  (2)

By default, plots are shown with minimal extra detail:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->Tooltip]

Use a theme with a dark background and more styled points:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->Tooltip,PlotTheme->"Marketing"]

Show labels:

FeatureSpacePlot[EntityValue[(EntityClass["Europe", EntityClass["Country","Europe"], "EntityClass[\"Country\", \"Europe\"]", "countries"]),"FlagImage"],LabelingFunction->Callout,PlotTheme->"Marketing",ImageSize->225]

OpenersExampleSubsection15(Spacer1)RandomSeeding  (3)

(RefLink[FeatureSpacePlot, paclet:ref/FeatureSpacePlot]) gives reproducible results:

Table[FeatureSpacePlot[EntityValue["Country","FlagImage"]],3]

Use an automatic seed to get different results:

Table[FeatureSpacePlot[EntityValue["Country","FlagImage"],RandomSeeding->Automatic],3]

Use specific seeds for reproducible but varying results:

Table[FeatureSpacePlot[EntityValue["Country","FlagImage"],RandomSeeding->i],{i,3}]

OpenersExampleSection3(Spacer1)Applications  (1)

Classify a spoken digit command dataset:

data=RandomSample[ResourceData[ResourceObject["Spoken Digit Commands"],"TrainingData"]];
RandomSample[data,2]

All recording labels:

classes=Union[data[[All,"Output"]]]

Define a network structure:

net=NetChain[{GatedRecurrentLayer[32],GatedRecurrentLayer[64],SequenceLastLayer[],LinearLayer[64],Ramp,LinearLayer[],SoftmaxLayer[]},"Input"->NetEncoder[{"AudioMFCC","Normalization"->"RMS"}],"Output"->NetDecoder[{"Class",classes}]]

Train the network:

trainedNet=NetTrain[net,data,ValidationSet->Scaled[.05]]

Chop the last two levels of the network:

choppedNet=NetTake[trainedNet,{1,5}]

Plot audio features using the output of the chopped net as feature extractor:

FeatureSpacePlot[RandomSample[data[[All,"Input"]],100],FeatureExtractor->choppedNet]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FeatureSpacePlot3D, paclet:ref/FeatureSpacePlot3D])  ▪  (RefLink[FeatureExtract, paclet:ref/FeatureExtract])  ▪  (RefLink[DimensionReduce, paclet:ref/DimensionReduce])  ▪  (RefLink[ListPlot, paclet:ref/ListPlot])  ▪  (RefLink[FeatureExtractor, paclet:ref/FeatureExtractor])  ▪  (RefLink[FeatureExtraction, paclet:ref/FeatureExtraction])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Machine Learning, paclet:guide/MachineLearning])}, {▪(RefLinkPlain[Image Computation for Microscopy, paclet:guide/ImageComputationForMicroscopy])}, {▪(RefLinkPlain[Audio Processing, paclet:guide/AudioProcessing])}})}})