Calculating next row in binary matrix
11:04 19 Feb 2026

if I have the binary matrix something like this (this is only 10 rows of binary matrix, I have a dataset of a million rows, so you can see what the binary matrix looks like):


[[0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0],
 [1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
 [1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1],
 [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0],
 [0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1],
 [1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1],
 [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0],
 [1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1],
 [1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1],
 [0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1]]

All I know that every row contains exactly N numbers of ones (in this case 8) and exactly M numbers of zeros (in this case 12). Each row has exactly 20 binary numbers (ones and zeros). What is the best machine learning algorithm to calculate next row?
For my (human) eye everything looks random and I cannot find any consistent patterns. For example, if one appears at index (position) 0 it will always appear in the next row (this is not a case) and other similar patterns. So far I used several machine learning algorithms and their combinations (ensemble methods), but I cannot pass the 30% accuracy. Goal is to have at least 90% accuracy.
Goal: my true goal is to calculate one index (position) which will appear as one (i don't need to calculate the whole next row), only one index (position) which will appear as one in the next row. What algorithms/calculations/methods should i use?

machine-learning