Esempio n. 1
0
def main(RUNS = 10, numH = 5):
    """
    Parkinsons
    """

    # try:
    print ">>STARTING...";
    lb_bench = lab_bencmark();
    D = lb_bench.parkinsons();
    D['name'] = 'Parkinsons';
    DCrossVal = kfold.kfold(D = D['train'], numFolds = RUNS);
    netConfig = {'numI': 22,
                 'numO': 1,
                 'numH': numH
    };
    for ri in xrange(RUNS):
        print ">>>> RUN {0} of {1}".format(ri, RUNS);
        print "ON :", D['NAME'];
        coevo = ndmCoevoOptim.ndmCoevoOptim(dataset_name = D['NAME'],
                                            train_set = DCrossVal[ri][0],
                                            valid_set = DCrossVal[ri][1],
                                            test_set = D['test'],
                                            netConfig = netConfig);
        coevo.init_populations();
        coevo.coevolve();
Esempio n. 2
0
def test_glass(RUNS = 10):
    """
    GLASS
    """

    proben = proben1();
    D = proben.glass();
    DCrossVal = kfold.kfold(D = D['train'], numFolds = RUNS);
    netConfig = {'numI': D['test']['INFO']['num_inputs'],
                 'numO': D['test']['INFO']['num_outputs'],
                 'numH': 2
    };
    for ri in xrange(RUNS):
        coevo = ndmCoevoOptim.ndmCoevoOptim(dataset_name =  D['name'],
                                            train_set = DCrossVal[ri][0],
                                            valid_set = DCrossVal[ri][1],
                                            test_set = D['test'],
                                            netConfig = netConfig);

        #disable random inject
        coevo.params['randomNodesInject'] = False;

        coevo.init_populations();
        m = coevo.coevolve();


    del proben;
Esempio n. 3
0
def main(RUNS = 10, numH = 2):
    """
    Cancer
    """

    # try:
    print ">>STARTING...";
    proben = proben1();
    D = proben.breast_cancer();

    DCrossVal = kfold.kfold(D = D['train'], numFolds = RUNS);
    netConfig = {'numI': D['train']['INFO']['num_inputs'],
                 'numO': D['train']['INFO']['num_outputs'],
                 'numH': numH
    };
    for ri in xrange(RUNS):
        print ">>>> RUN {0} of {1}".format(ri, RUNS);
        print "ON :", D['name'];
        coevo = ndmCoevoOptim.ndmCoevoOptim(dataset_name = D['name'],
                                            train_set = DCrossVal[ri][0],
                                            valid_set = DCrossVal[ri][1],
                                            test_set = D['test'],
                                            netConfig = netConfig);
        coevo.init_populations();
        coevo.coevolve();
Esempio n. 4
0
def main(RUNS=10, numH=2):
    """
    Lung Cancer
    """
    FOLDS = 2
    # try:
    print ">>STARTING..."
    for i in xrange(RUNS):

        lb_bench = lab_bencmark()
        D = lb_bench.lung_cancer()
        D["name"] = "Lung_cancer"
        DCrossVal = kfold.kfold(D=D["train"], numFolds=FOLDS)
        netConfig = {"numI": 56, "numO": 1, "numH": numH}
        for ri in xrange(FOLDS):
            print ">>>> RUN {0} of {1}".format(ri, RUNS)
            print "ON :", D["NAME"]
            coevo = ndmCoevoOptim.ndmCoevoOptim(
                dataset_name=D["NAME"],
                train_set=DCrossVal[ri][0],
                valid_set=DCrossVal[ri][1],
                test_set=D["test"],
                netConfig=netConfig,
            )
            coevo.init_populations()
            coevo.coevolve()
Esempio n. 5
0
def test_iris(RUNS = 10):
    """
    test for the iris dataset
    """

    lab_data = lab_bencmark();

    print ">>>IRIS";

    D = lab_data.iris();
    DCrossVal = kfold.kfold(D = D['train'], numFolds = RUNS);
    netConfig = {'numI': 4,
                 'numO': 1,
                 'numH': 2
    };
    for ri in xrange(RUNS):
        coevo = ndmCoevoOptim.ndmCoevoOptim(dataset_name = 'IRIS',
                                            train_set = DCrossVal[ri][0],
                                            valid_set = DCrossVal[ri][1],
                                            test_set = D['test'],
                                            netConfig = netConfig);
        #disable random inject
        coevo.params['randomNodesInject'] = False;
        coevo.init_populations();
        coevo.coevolve();

    del lab_data;
Esempio n. 6
0
def main(RUNS = 10, numH = 2):
    """
    Card
    """

    try:
        print ">>STARTING...";
        proben = proben1();
        D = proben.australian_cc();

        DCrossVal = kfold.kfold(D = D['train'], numFolds = RUNS);
        netConfig = {'numI': D['train']['INFO']['num_inputs'],
                 'numO': D['train']['INFO']['num_outputs'],
                 'numH': numH
         };
        for ri in xrange(RUNS):
            print ">>>> RUN {0} of {1}".format(ri, RUNS);
            print "ON :", D['name'];
            coevo = ndmCoevoOptim.ndmCoevoOptim(dataset_name = D['name'],
                                            train_set = DCrossVal[ri][0],
                                            valid_set = DCrossVal[ri][1],
                                            test_set = D['test'],
                                            netConfig = netConfig);
            coevo.init_populations();
            coevo.coevolve();

        #send notification
        #notify.noticeEMail(D['name']+' DONE');
    except:
        """ """
        print "ERROR";
Esempio n. 7
0
def test_sonar(RUNS = 10):
    """
    SONAR
    """

    lab_data = lab_bencmark();

    D = lab_data.sonar();
    coevo = ndmCoevoOptim.ndmCoevoOptim(dataset_name = 'SONAR', train_set = D['train'], test_set = D['test']);

    for ri in xrange(RUNS):
        coevo.init_populations();
        #disable random inject
        coevo.params['randomNodesInject'] = False;
        m = coevo.coevolve();

    del lab_data;
Esempio n. 8
0
def test_xor(RUNS = 5,N = 10):
    """
    test for XOR dataset
    """

    lab_data = lab_bencmark();

    #dataset divided into train and test as ratio of 70:30
    D = lab_data.xor(N);
    netConfig = {'numI': D['test']['INFO']['num_inputs'],
                 'numO': D['test']['INFO']['num_outputs'],
                 'numH': 2
    };
    coevo = ndmCoevoOptim.ndmCoevoOptim(dataset_name = 'XOR', train_set = D['train'],
                                            valid_set = D['test'],
                                            test_set = D['test']);
    for ri in xrange(RUNS):
        #disable random inject
        coevo.params['randomNodesInject'] = False;
        coevo.init_populations();
        # coevo.params['numI'] =
        m = coevo.coevolve();
Esempio n. 9
0
def main(RUNS=10, numH=2):
    """
    Horse
    """

    # try:
    print ">>STARTING..."
    proben = proben1()
    D = proben.horse()

    DCrossVal = kfold.kfold(D=D["train"], numFolds=RUNS)
    netConfig = {"numI": D["train"]["INFO"]["num_inputs"], "numO": D["train"]["INFO"]["num_outputs"], "numH": numH}
    for ri in xrange(RUNS):
        print ">>>> RUN {0} of {1}".format(ri, RUNS)
        print "ON :", D["name"]
        coevo = ndmCoevoOptim.ndmCoevoOptim(
            dataset_name=D["name"],
            train_set=DCrossVal[ri][0],
            valid_set=DCrossVal[ri][1],
            test_set=D["test"],
            netConfig=netConfig,
        )
        coevo.init_populations()
        coevo.coevolve()
Esempio n. 10
0
sys.path.insert(0, "../visualisation");

import ndmCoevoOptim;
import ndmCoevoBase;
import ndmModel;
import numpy as np;
import datasets;
from benchmark import proben1_bechmark as proben1;
from benchmark import lab_bencmark;
import kfold;
import profile;
import visualisation.visualiseOutputs2D as vis2d;
from PyQt4 import QtCore, QtGui
from visualiseNDMNet import *;

coevo = ndmCoevoOptim.ndmCoevoOptim();
errors_train =[];
errors_test = [];

benchmark = proben1();
lab_bencmark = lab_bencmark();
K  = 10;

# D = kfold.kfold(D = benchmark.mushroom()['train'],numFolds = K);
D2 = kfold.kfold(D = lab_bencmark.iris()['train'],numFolds = K);
for i in xrange(1):

    print ">>>", i;

    coevo.init_populations();
    # coevo.train_set = D2[i][0];