features

class polygon_classification.features.Features[source]

This class builds features regarding polygon properties.

See also

compute_features()

Details on the implemented features.

build(X)[source]

Build features and return them as an ndarray of floats.

Parameters

X (array-like or sparse matrix, shape = [n_samples, n_features]) – The train/test input samples.

Returns

fX – The computed features to use as input to ML classifiers.

Return type

ndarray

compute_features(poly1, poly2)[source]

This method builds an ndarray of the following features:

  • core: basic geometric attributes, i.e.,
    1. area of each polygon,

    2. percentage of coverage/intersection area per polygon,

    3. perimeter of each polygon,

    4. number of corners of each polygon,

    5. average edges’ length per corner of each polygon,

    6. variance of edges’ length per corner of each polygon,

  • extra: compute additional features on setting extra_features to True, i.e.,
    1. area of of each polygon convex hull,

    2. percentage of coverage/intersection of convex hull area per polygon,

    3. distance of centroids of polygons

Parameters

poly1, poly2 (str) – Input geometric objects, i.e., shapely Polygons.

Returns

It returns a list (vector) of features.

Return type

list

Return Home