Skip to main content
This gem runs in .
Use the Tile gem to assign records to tiles based on your data and the tiling method you choose. You can distribute records by equal sum, equal record count, standard deviation bands, unique values, or manually defined cutoffs. The gem appends tile information to your data so you can analyze ranges, sequence within each tile, and grouped distributions. Depending on the method, you can also group records first or control how rows are ordered before tiles are assigned.

Prerequisites

Add prophecy_basics package version 1.0.11 or higher to your project.

Overview

The Tile gem supports these tiling methods:
  • Equal Sum
  • Equal Records
  • Smart Tile
  • Unique Value
  • Manual
The output appends two fields to the data:
  • Tile number, which stores the tile assigned to the record
  • Tile sequence number, which stores the record’s position within the tile

Parameters

Equal Sum

Use Equal Sum to assign tiles so each tile has approximately the same total from the selected sum field based on the row order.

Parameters

Order rows within each group

Use Order By Columns to select the columns used to order rows. Use Sort strategy to choose one of the following options:
  • ascending nulls first
  • ascending nulls last
  • descending nulls first
  • descending nulls last

Example

Let’s say you have the following dataset and set Number of Tiles to 2.
If you select Equal Sum and use Sales as the sum column, the gem assigns records so each tile has a similar total based on the row order.

Result

In this example, both tiles total 30.

Equal Records

Use Equal Records to divide input records into the specified number of tiles so each tile contains the same number of records as closely as possible.

Parameters

Example

Let’s say you have the following dataset and set Number of Tiles to 2.
If you select Equal Records, the gem divides the four records into two tiles with two records in each tile.

Result

Smart Tile

Use Smart Tile to create tiles based on the standard deviation of values in a numeric field. The assigned tile indicates whether the value falls within the average range, above the average, or below the average.

Parameters

Example

Let’s say you use Price as the tile numeric column and enable Output name column.
In this example, the records fall into the -1 band and the output includes the descriptive label Below Average.

Unique Value

Use Unique Value to assign a unique tile to each unique value in one or more selected fields. If you select multiple fields, the tile is based on the combination of values.

Parameters

Example

Let’s say you have the following dataset and select Category as the unique column.
If you select Unique Value, each unique category receives its own tile.

Result

Manual

Use Manual to define tile cutoffs yourself.

Parameters

Example

Let’s say you have the following dataset, select Score as the tile numeric column, and enter the cutoffs 50,80.
If you select Manual, the gem assigns tiles based on the cutoffs you provide.

Result