One hot encoding of target variable containing classes 1 to 9 not including zero While predicting a solution for a sudoku puzzle using CNN, the target variable should predict values from 1 to 9 for all the 81(9*9) values in the puzzle. Hence the target value shape is (81,9).
Using keras.to_categorical to convert target variable from (81,1) to (81,9) shows error.
to_categorical takes argument y which must contain integers from 0 to num_classes whereas 0 is not included in the target variable considered here. It works fine when num_classes is taken as 10 but results in (81*10) shaped variable. Is there any other way to get the target variable as (81,9) without altering the target variable values?
I don't know it this is an optimal approach. The natural way to solve a SUDOKU with computer science is Linear Programming. I am curious if a CNN will solve the problem.
Can you add +1 or -1 in the post processing / pre processing of the predictions? It will be the easier way to solve it.