Skip to main content

Geographic Cell Processor

The Geographic Cell Processor avatarizes a latitude and longitude pair as one location. This keeps each avatar point in an area that holds original points.

Description​

This processor handles data where two variables give the position of a record:

  • Home address: home_lat and home_lon
  • Pick-up point of a trip: pickup_lat and pickup_lon
  • Site of a store or of a sensor: latitude and longitude

The processor transforms each pair into an internal representation that:

  1. Replaces the point by the cell of a grid that holds it: the cell is one categorical variable
  2. Avatarizes the cell with the other variables
  3. Draws the avatar point inside its cell, from the original points of that cell
  4. Gives back the same latitude and longitude columns as the input

A latitude and longitude pair as one location: original points, the cell of each point, avatarization, avatar points drawn inside the occupied cells

Use case: When your data contains locations, and the avatar points must stay in distinct zones covered by the original data (i.e. no avatars in a lake, in the sea or outside a border and avatars respecting neighborhoods).

Concrete example​

Consider a dataset of customers on the two shores of Lake Geneva, in Lausanne and in Évian:

customer_id | lat | lon | basket
1 | 46.519 | 6.633 | 120
2 | 46.522 | 6.640 | 80
3 | 46.401 | 6.590 | 95
4 | 46.398 | 6.585 | 60

Problem without processor: The latitude and the longitude are avatarized as two independent numbers. An avatar made from a customer in Lausanne and a customer in Évian can get the point in between: 46.460, 6.612, in the middle of the lake.

After applying Geographic Cell Processor:

Preprocessing step:
- Replaces lat and lon by the cell that holds the point

customer_id | cell | basket
1 | cell_lausanne | 120
2 | cell_lausanne | 80
3 | cell_evian | 95
4 | cell_evian | 60

During avatarization:
- The cell is avatarized like any other categorical variable:
each avatar gets cell_lausanne or cell_evian, never a cell in the lake

Post-processing step:
- Draws a point inside the avatar's cell, from the original points of that cell
- Gives the point the type and the number of decimals of the original columns

avatar_id | lat | lon | basket
1 | 46.521 | 6.636 | 104
2 | 46.399 | 6.588 | 71

Result: Avatars keep valid locations, near the original points, with the same latitude and longitude columns as the input.

How to Use it in Web​

  1. In Configure datasets, set the Datatype of the latitude column to Latitude, and the datatype of the longitude column to Longitude.
  2. In Associated with, pick the longitude of each latitude. Each latitude needs a longitude to form a location.
  3. Optional, in expert mode: in the avatarization parameters, change the Maximum number of cells of each pair in Geographic cells.

How to use it in python​

Please refer to the Python documentation for usage details.


Key Points​

  • Number of cells: max_cells (Maximum number of cells in the web interface) is the most cells that a pair can have, from 1 to 10,000. Default: 100. The grid is the finest one where at least 90% of the records are in a cell of 2 records or more, so a larger value does not always give more cells. More cells keep the locations more precise; fewer cells protect them more.