= np.random.randint(0,9, (4,4))
in_arr = ArcGrid(in_arr); in_grid in_grid
Grid(shape=(4, 4))
ArcGrid (data:numpy.ndarray)
A single ARC grid
Type | Details | |
---|---|---|
data | ndarray | 2d array of integers (0–9) |
Each ARC task is made up of pairs of input and output “grids”, which are 2-d arrays/matrices of integers
This class stores a single ARC grid as a numpy array. We can then easily visualise the grid using the plot()
method
The plot
method also supports returning the base64-encoded string of the image directly
Base64 string: 'b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x01H'...'
ArcGrids support equality checks, making it easy to test predicted grids
ArcPair (input_grid:__main__.ArcGrid|numpy.ndarray, output_grid:__main__.ArcGrid|numpy.ndarray)
A pair of ARC grids, typically [input, output]. Can also be used for [output, prediction]
Type | Details | |
---|---|---|
input_grid | main.ArcGrid | numpy.ndarray | Input grid |
output_grid | main.ArcGrid | numpy.ndarray | Output grid |
The output grids in ARC tasks are often a different size to the input grids. When plotting pairs of grids, we can specify whether we want the grids to be on the same scale (i.e. one cell is equal size in both plots) or whether to rescale each grid to fill its half of the plot.
ArcTask (task_id:str, split:str='train', data_dir:str|pathlib.Path|None=None)
An ARC task
Type | Default | Details | |
---|---|---|---|
task_id | str | 8-digit task id | |
split | str | train | ARC public dataset split (‘train’ or ‘eval’) |
data_dir | str | pathlib.Path | None | None | Path to ARC data directory (defaults to '/path/to/arcsolver/arc_data/data' ) |
t = [f.split('.')[0] for f in os.listdir('../arcsolver/arc_data/data/training')][1]
task = ArcTask(t); task
ArcTask(id='c8cbb738', train_examples=3, test_examples=1)
An ArcTask
stores the training and test examples, each as a list of ArcPair
objects.
[ArcPair(input_shape=(12, 11), output_shape=(5, 5)),
ArcPair(input_shape=(10, 8), output_shape=(3, 3)),
ArcPair(input_shape=(12, 14), output_shape=(5, 5))]
Again, we can choose whether to rescale the plots
get_task_files (split:str)
Get list of files from either training or evaluation data.
Type | Details | |
---|---|---|
split | str | ‘train’ or ‘eval’ |
Returns | list |