Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding convolutional version of MNIST example? #5

Open
capn-freako opened this issue Oct 4, 2017 · 4 comments
Open

Adding convolutional version of MNIST example? #5

capn-freako opened this issue Oct 4, 2017 · 4 comments

Comments

@capn-freako
Copy link

Hi Lars,

Thanks for this library!

After studying the code in your MNIST.hs example, I assume that you are not, yet, using convolutional layers in your MNIST digit classification example. Is that correct? If so, I'd like to contribute to this project, by adding that (i.e. - modifying the MNIST.hs example to use convolutional layers).

Did you already have an idea in mind, as to how you'd like to proceed with this?

And, finally, I was hoping you might have time to consider these two questions:

  1. In MNIST.hs, why is the MNISTModel type defined as:

    type MNISTModel = Classifier (Matrix 28 28) 10 Img Digit

    when the learning appears to work on the flattened 784-element vector, instead?
    This choice seems to force mnistModel.f to come inside the learning loop and, therefore, be defined as a Diff, whereas otherwise it might have been defined as a simple function (just flattening the 2D image into a 1D vector, and remaining outside of the learning loop).

  2. Referring to this comment:

    A Classifier f n b c is a Model that classifies items of type b into categories of type c, using a component with input shape f and output shape Vector n.

    Why is the apparent type redundancy required?
    In other words, why not just Classifier f n (or, Classifier b c)?

Thanks!
-db

@capn-freako
Copy link
Author

Hi Lars,

Can you tell me if these changes to your MNIST.hs file indicate that I correctly understand your intent, regarding the use of type annotations to control the structure of the resultant network?

-    c = tanhLayer' . (tanhLayer' :: Layer 784 30) . cArr f
+    c = reLULayer
+      . cArr (Diff toVector)
+      . (convolution (Proxy :: DP.Proxy 7) 3 linearLayer :: Component (Volume 28 28 1) (Volume 8 8 8))
+      . cArr (Diff fromMatrix)

Thanks,
-db

@brunjlar
Copy link
Owner

brunjlar commented Oct 15, 2017 via email

@brunjlar
Copy link
Owner

brunjlar commented Oct 15, 2017 via email

@capn-freako
Copy link
Author

capn-freako commented Oct 15, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants