Пример #1
0
'''
Created on 24/03/2012

@author: newlog
'''
from NNConfiguration import NNConfiguration

cnf = NNConfiguration(None, 2, [3, 1], 3, "./src/dataset/data.txt")
print "1.- Without conf file - Parameters: " , cnf.get_NN_parameters(), "\n"

cnf = NNConfiguration("./nonexistentfile", None, None, None, None)
print "2.- With conf file - Parameters: " , cnf.get_NN_parameters(), "\n"

cnf = NNConfiguration("./nonexistentfile",  2, [3, 1], 3, "./src/dataset/data.txt")
print "3.- Incorrect initialization - Parameters: " , cnf.get_NN_parameters(), "\n"

cnf = NNConfiguration(None,  None, [3, 1], 3, "./src/dataset/data.txt", "./src/dataset/weights.txt")
print "4.- Test initialization - Parameters: " , cnf.get_NN_parameters(), "\n"
Пример #2
0
@author: newlog
'''

import sys
from NNConfiguration import NNConfiguration
from NeuralNetwork import NeuralNetwork
import time


def usage():
    print "\n[?] You only have to pass the configuration file."
    print "Coded by Newlog, see you console cowboys\n"


if __name__ == '__main__':
    if len(sys.argv) != 2:
        # The program has been invoked incorrectly
        usage()
        exit()

    # The program has been invoked with a configuration file
    nn_conf = NNConfiguration(sys.argv[1])
    # Now we can build the neural network
    nn = NeuralNetwork(nn_conf)
    # Now we can activate the neural network
    init = time.time()
    nn.activate()
    final = time.time()
    print "[+] Execution time: %s seconds" % str(final - init)
    print "[*] Well done, Neural Cowboy."
Пример #3
0
2st = Number of iterations of the dataset
2nd = A list containing the number of nodes in each layer
3th = The number of inputs of the neural network
4th = The path to the training set
'''

###############################################################
###############################################################
####            SUN SPOT TRAINING AND TEST START          #####
###############################################################
###############################################################
'''
The Neural Network is invoked to be trained with the sunspots
'''

cnf = NNConfiguration(None, 1, [2, 1], 2,
                      "./src/dataset/DEBUG1/DEBUG_1_DATASET.txt")
nn = NeuralNetwork(cnf)
'''
The Neural Network is invoked to test unclassified instances with the sunspots. (Production)
'''
'''
cnf = NNConfiguration(  None, 
                        1, 
                        [21, 1], 
                        11, 
                        "./src/dataset/good_sunspot_test.dat", 
                        "./WEIGHTS_May_12_19_35.txt")
'''
'''
nn = NeuralNetwork(cnf)
'''
'''
Created on 26/06/2012

@author: newlog
'''

from NNConfiguration import NNConfiguration

cnf = NNConfiguration("./src/tests/conf/good_conf.txt", None, None, None, None)
print "1.- With conf file - Parameters: " , cnf.get_NN_parameters(), "\n"

cnf = NNConfiguration("./src/tests/conf/bad_conf_2.txt", None, None, None, None)
print "1.- With conf file - Parameters: " , cnf.get_NN_parameters(), "\n"

cnf = NNConfiguration("./src/tests/conf/bad_conf_1.txt", None, None, None, None)
print "1.- With conf file - Parameters: " , cnf.get_NN_parameters(), "\n"