-1

suppose MNIST data set had another feature, such as if digits were written by a right handed person or left handed person. How can this information be used? I want to use tensorflow.

EDIT: I am sorry if my question was vague. I have learned my lesson and will be asking better questions.

Hirotaka Nakagame
  • 161
  • 1
  • 2
  • 9

1 Answers1

1

You're trying to add another dimension of label, not a feature. You need to edit each of your input files to contain these separate classes (0-L through 9-L, 0-R through 9-R), and then scale up the topology to handle the added discrimination.

Scaling the model will take a little experimentation. I suggest that you begin with 20% to 100% more nodes in each hidden layer; run a series of experiments to find your optimum topology.

UPDATE after OP comment

Zeroes also lean left and right, but it's often more subtle. However. the main reason is that you're making a more detailed set of decisions, so you're likely to need more intermediate factors. These are the hidden nodes.

Try the original topology on 20 classes; see how well it works, and start from there. I think you'll need more nodes, but the ultimate authority is your trained model.

Building models is still something of an art, although we're learning more every year. Where the problem is very similar to one with a known solution (i.e. yours), we can often get a good solution by altering the "width" of the current model to compensate for the difference in problems.

In your case, twice as many classes to discriminate suggests a simple increase in the quantity of hidden nodes. However, whether that increase is to double the nodes, increase by a smaller amount, or merely alter the final layer from 10 to 20 classes, is an exercise for the deep learning researcher -- that's you. :-)

Another UPDATE

I see -- it is input, not a classification. My error, not yours.

Yes, you can do that ... but you'd need to change your input format to accommodate the added information. This means adding a bit to each input file to signify the hand, and reflecting that extra bit in your ingestion method. I expect that the model will adapt with the current topology.

Prune
  • 76,765
  • 14
  • 60
  • 81
  • could you explain more about the scaling part? I suppose computers would have hard time distinguishing 0L from 0R thats why you need mode nodes? – Hirotaka Nakagame Feb 15 '18 at 19:34
  • thanks! One more question. To us, it is not important if digits were written by a right handed or left handed so I want to combine 0R and 0L as 0. Is it something tensorflow is capable of performing? – Hirotaka Nakagame Feb 15 '18 at 20:28
  • Perhaps I don't understand your problem, then. If you don't want the model to discriminate handedness, then there's nothing to alter. Just feed it all the input images and the 0-9 labels. – Prune Feb 15 '18 at 22:05
  • I didn't explain enough. This is just hypothetical and doesnt have to be true to MNIST data but just suppose knowing if digits were written by right handed person or not helps computer to recognize images better. Then, you want the computer to know dominant hand of the writer. But you don't have to know the dominant hand. All you want the computer to tell you is digit. so the training data would be (dominant hand, image, true_value) and the output would only be digit(0~9). Does it make sense? – Hirotaka Nakagame Feb 15 '18 at 22:15
  • can you give me some general direction how to change my input? – Hirotaka Nakagame Feb 16 '18 at 01:13
  • What kind of "general direction"? Design the new input format for you? It doesn't really matter much; you just need something convenient *for you* -- then alter the ingestion routine to read the extra information and pass it to the input layer. – Prune Feb 16 '18 at 21:32
  • Im new to CNN or tensorflow. If you could tel me how to format my input. Is left handed or right handed TF value? or does it have to be a matrix? I have no idea how to pass it into x.(Wx + b) – Hirotaka Nakagame Feb 19 '18 at 15:05
  • This is information you get from documentation on the model you're using, not from Stack Overflow. – Prune Feb 20 '18 at 07:11