Beispiel #1
0
def LoadBandCross(shift = False, view=[]):
    ds = scipy.io.loadmat("Notebook Data/datasets/bandcross.mat")
    cds = PyJRNN.utility.CSMTLDataset()
    cds.isConceptData = False
    inputs = numpy.ascontiguousarray(ds["inputs"])
    outNames = None
    if shift:
        inputs = inputs - 0.5
    if len(view) == 0:
        outNames = ['outBox1', 'outBox2', 'outBox3', 'outBox12', 'outBox13', 'outBox123']
    else:
        outNames = view
        
    for outName in outNames:
        outputs = numpy.ascontiguousarray(ds[outName])
        if shift:
            outputs = outputs - 0.5
        cds.AddMatDoublesToTask(ObsUtility.matDoubleFromArray(inputs), ObsUtility.matDoubleFromArray(numpy.ascontiguousarray(ds[outName])), outName)
    
    inView = PyJRNN.types.strings()
    for name in outNames:
        inView.append(name)
    
    cds.View = inView
    
    cds.DistData(200,200,200)
    
    return cds
Beispiel #2
0
 def CreateTabbedConsDS(dsname, numIns, numOuts, numTrain, numVal, numTest):
     global datapath
     dspath = os.path.join(datapath, dsname)
     ins, outs = LoadTabbedDataFiles(numIns, numOuts, dspath)
     trainDSLength = numTrain + numVal
     print trainDSLength
 
     ds1 = PyJRNN.utility.Dataset()
     ds2 = PyJRNN.utility.Dataset()
     ds3 = PyJRNN.utility.Dataset()
     tr1 = PyJRNN.utility.Dataset()
 
     ds1.LoadFromMatDoubles(ObsUtility.matDoubleFromArray(ins[0:trainDSLength]), ObsUtility.matDoubleFromArray(outs[0:trainDSLength]))
     ds2.LoadFromMatDoubles(ObsUtility.matDoubleFromArray(ins[trainDSLength:2*trainDSLength]), ObsUtility.matDoubleFromArray(outs[trainDSLength:2*trainDSLength]))
     ds3.LoadFromMatDoubles(ObsUtility.matDoubleFromArray(ins[trainDSLength*2:trainDSLength*3]), ObsUtility.matDoubleFromArray(outs[trainDSLength*2:trainDSLength*3]))
     tr1.LoadFromMatDoubles(ObsUtility.matDoubleFromArray(ins[trainDSLength*3:]), ObsUtility.matDoubleFromArray(outs[trainDSLength*3:]))
 
     del ins, outs
     ds1.DistData(numTrain, numVal, 0)
     ds2.DistData(numTrain, numVal, 0)
     ds3.DistData(numTrain, numVal, 0)
     tr1.DistData(0,0,numTest)
 
     return (ds1, ds2, ds3, tr1)
Beispiel #3
0
cds = PyJRNN.utility.CSMTLDataset()
cds.isConceptData = False

# <codecell>

inputs = numpy.ascontiguousarray(ds["inputs"])

# <codecell>

outNames = ['outBox1', 'outBox2', 'outBox3', 'outBox12', 'outBox13', 'outBox123']

# <codecell>

for outName in outNames:
    cds.AddMatDoublesToTask(ObsUtility.matDoubleFromArray(inputs), ObsUtility.matDoubleFromArray(numpy.ascontiguousarray(ds[outName])), outName)

# <codecell>

cds.GetTaskNames()

# <codecell>

for name in cds.GetTaskNames():
    print name

# <codecell>

def TestKBCC(cds, firsttask, secondtask, thirdtask):
    tmpsview = PyJRNN.types.strings()
    tmpsview.append(firsttask)