3
$\begingroup$

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?

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ Thanks for the suggestion. I was just trying to see the accuracy using a CNN model. $\endgroup$ – Sathish Kumar SG Jan 2 at 5:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.