March 29, 2006 - 23:18
Projects:
In my final project, I want to take several cryptosystems/encryption algorithms and see if it's possible for a neural network to recognize the pattern. If all goes to plan, my dataset will consist of a ciphertext and it's plaintext equivalent; this is what I'd like to train my network with. I'll test simple substitution/transposition ciphers and maybe even ones that rely on the factoring of large primes (ie RSA); however, I highly doubt the network will be able to 'crack' the latter. If time permits, I may also explore the idea of training two networks on one another in an attempt to create an encryption/decryption system. Anyway, I'm running into a problem when I try to set the inputs and outputs for the neural network.
Here's the block of code that's giving me problems:
-------------------------------------------------------
n.setInputs("HELLO","NEURAL NETWORKS","HOPELESS","NEW JERSEY","QUARTER","PYTHON","A QUICK BROWN FOX JUMPED OVER THE LAZY DOGS")
n.setOutputs("WTAAD","CTJGPA CTILDGZH","WDETATHH","CTL YTGHTN","FJPGITG","ENIWDC","P FJXRZ QGDLC UDM YJBETS DKTG IWT APON SDVH")
-------------------------------------------------------
The error:
[ssingh@arneb FinalProject]$ python CipherNN.py
Traceback (most recent call last):
File "CipherNN.py", line 10, in ?
n.setInputs("HELLO","NEURAL NETWORKS","HOPELESS","NEW JERSEY","QUARTER","PYTHON","A QUICK BROWN FOX JUMPED OVER THE LAZY DOGS")
TypeError: setInputs() takes exactly 2 arguments (8 given)
-------------------------------------------------------
Line 10 refers to the n.setInputs(...) line. Is it necessary for the input to contain 2 arguements? What other argument could I use in addition to the ciphertext? It SHOULD be possible to train the network on characters, right? Is there something that needs to be modified in the conx.py file?? Someone help!
Comments
So: setInputs() takes an
Submitted by JoshCarp on March 30, 2006 - 00:42 Permalink
def verifyArguments(self, arg): """ Verifies that arguments to setInputs and setTargets are appropriately formatted. """ for l in arg: if not type(l) == list and \ not type(l) == type(Numeric.array([0.0])) and \ not type(l) == tuple: return 0 for i in l: if not type(i) == float and not type(i) == int: return 0 return 1
Hm...I can't really think
Submitted by SunnySingh on March 30, 2006 - 00:52 Permalink
Neural networks
Submitted by Doug Blank on March 30, 2006 - 22:25 Permalink
Of course, in the end, you have to use numbers as inputs and targets for a neural network. So, you can do something like:
That would work for a network that has 4 units in the input layer and 1 unit in the output layer. Notice that each of these is a list of lists.
If you want to use an advanced feature, you can use patterns, but this is really only a time saving device. You can replace a LIST of numbers with a symbol. For example, for the above example, you could:
but you don't need to do that. Hope that helps.
"Is there any way I can make this work?" ... haha ...
Submitted by jrohwer on April 2, 2006 - 15:49 Permalink