WOLFRAM

CentralFeature[{x1,x2,}]

gives the central feature of the elements .

CentralFeature[{x1v1,x2v2,}]

gives the vi corresponding to the central feature .

gives the central feature for several different forms of data.

Details and Options

  • CentralFeature is a location measure. It gives a point in the data with the minimum total distance to every other point.
  • CentralFeature finds the element that minimizes the sum of distances for the unweighted case and for the weighted case.
  • The data data has the following forms and interpretations:
  • {data1,data2,}list of data of different formats including numerical, geospatial, textual, visual, dates and times, as well as combinations of these
    {data1,data2,}{v1,v2,}data with indices {v1,v2,}
    {data1,data2,}Automatictake the vi to be successive integers i
    GeoPosition[]array of geodetic positions
    WeightedData[]data with weights
  • The following option can be given:
  • DistanceFunction Automaticthe distance metric to use
  • The setting for DistanceFunction can be any distance or dissimilarity function or a function f defining a distance between two points.
  • By default, the following distance functions are used for different types of elements:
  • EuclideanDistancenumeric data
    ImageDistanceimages
    JaccardDissimilarityBoolean data
    EditDistancetext and nominal sequences
    Abs[DateDifference[#1,#2]]&dates and times
    ColorDistancecolors
    GeoDistancegeospatial data
    Boole[SameQ[#1,#2]]&nominal data
    HammingDistancenominal vector data
    WarpingDistancenumerical sequences
  • All images are first conformed using ConformImages when the option DistanceFunction is Automatic.
  • By default, when data elements are mixed-type vectors, distances are computed independently for each type and combined using Norm.

Examples

open allclose all

Basic Examples  (2)Summary of the most common use cases

Find the central feature in a list of vectors:

Out[1]=1

Find the central feature in a list of vectors with given weights:

Out[1]=1

Scope  (9)Survey of the scope of standard use cases

Same inputs with different output formats:

Out[2]=2
Out[3]=3
Out[4]=4
Out[5]=5

Central feature works with WeightedData:

Out[2]=2
Out[3]=3

Central feature of a large array:

Out[1]=1

Weighted central feature:

Out[2]=2

Find the central feature of data involving quantities:

Out[1]=1
Out[2]=2

Find the central feature of a list of images:

Out[1]=1

List of pictures:

Out[2]=2

List of 3D images:

Out[3]=3

Compute the central feature of strings:

Out[1]=1

Compute the central feature of Boolean vectors:

Out[1]=1

Compute the central feature of a list of date objects:

Out[1]=1

Compute the central feature of geodetic positions:

Out[2]=2
Out[3]=3

Options  (2)Common values & functionality for each option

DistanceFunction  (2)

By default, Euclidean distance is used:

Out[1]=1

The ChessboardDistance only takes into account the dimension with the largest separation:

Out[2]=2

The DistanceFunction can be given as a symbol:

Out[3]=3

Or as a pure function:

Out[4]=4

Applications  (4)Sample problems that can be solved with this function

Obtain a robust estimate of multivariate location when outliers are present:

Out[5]=5

Extreme values have a large influence on the Mean:

Out[3]=3

Sample points from a convex polygon:

Out[2]=2

Estimate the center of the polygon by computing the central feature of random points:

Out[3]=3
Out[4]=4

Find the central feature of California, based on the location of cities:

Out[2]=2

Find the central feature of California, based on the location of cities weighted by population:

Out[4]=4

Draw the cities' locations (gray), unweighted central feature (red) and weighted central feature (black):

Out[6]=6

The top eight largest cities in Ohio:

Out[1]=1

The central feature of the eight cities based on TravelDistance:

Out[2]=2

The sum of distances from the central feature to the other cities, based on TravelDistance:

Out[3]=3

Draw the cities' locations (gray) and the central feature (red):

Out[4]=4

Properties & Relations  (5)Properties of the function, and connections to other functions

CentralFeature is a multivariate location measure:

Out[2]=2
Out[3]=3

Mean is also a location measure:

Out[4]=4

Visualize the data points with central feature and mean:

Out[9]=9

CentralFeature finds a point belonging to the data that minimizes the sum of distances:

Out[2]=2

Compute the central feature directly from the definition:

Out[4]=4

Visualize the sum of distances function together with the data points:

Out[5]=5

CentralFeature is the same as Median with univariate data when the data length is odd:

Out[2]=2

CentralFeature finds an element in the data that minimizes the sum of distances to other data points:

Out[2]=2

SpatialMedian finds a point in the domain that minimizes the sum of distances:

Out[3]=3

The sum of distances with respect to CentralFeature is greater than or equal to the one with respect to SpatialMedian:

Out[5]=5

Create a random graph with edge weights sampled uniformly between 0 and 1:

Out[1]=1

Locate the GraphCenter:

Out[2]=2

Specify the distance between each pair of vertices using GraphDistance:

Locate the center using CentralFeature:

Out[4]=4

Possible Issues  (1)Common pitfalls and unexpected behavior

CentralFeature of a non-weighted, two-element list returns the first element:

Out[2]=2

For weighted two-element lists, it chooses the element with the highest weight, which trivially minimizes :

Out[3]=3
Wolfram Research (2017), CentralFeature, Wolfram Language function, https://reference.wolfram.com/language/ref/CentralFeature.html.
Wolfram Research (2017), CentralFeature, Wolfram Language function, https://reference.wolfram.com/language/ref/CentralFeature.html.

Text

Wolfram Research (2017), CentralFeature, Wolfram Language function, https://reference.wolfram.com/language/ref/CentralFeature.html.

Wolfram Research (2017), CentralFeature, Wolfram Language function, https://reference.wolfram.com/language/ref/CentralFeature.html.

CMS

Wolfram Language. 2017. "CentralFeature." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CentralFeature.html.

Wolfram Language. 2017. "CentralFeature." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/CentralFeature.html.

APA

Wolfram Language. (2017). CentralFeature. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CentralFeature.html

Wolfram Language. (2017). CentralFeature. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/CentralFeature.html

BibTeX

@misc{reference.wolfram_2025_centralfeature, author="Wolfram Research", title="{CentralFeature}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/CentralFeature.html}", note=[Accessed: 29-March-2025 ]}

@misc{reference.wolfram_2025_centralfeature, author="Wolfram Research", title="{CentralFeature}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/CentralFeature.html}", note=[Accessed: 29-March-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_centralfeature, organization={Wolfram Research}, title={CentralFeature}, year={2017}, url={https://reference.wolfram.com/language/ref/CentralFeature.html}, note=[Accessed: 29-March-2025 ]}

@online{reference.wolfram_2025_centralfeature, organization={Wolfram Research}, title={CentralFeature}, year={2017}, url={https://reference.wolfram.com/language/ref/CentralFeature.html}, note=[Accessed: 29-March-2025 ]}