Пример #1
0
model_paths = [f.path for f in os.scandir(valPath) if f.is_dir()]

inDims = range(1, 2)
outDims = range(1, 2)

for (inDimension, outDimension) in zip(inDims, outDims):
    name = 'MIMO ' + str(inDimension) + 'x' + str(outDimension)
    path = valPath + name + '/Checkpoints/'

    start_time = time.time()
    numTrials = int(NUMTRIALS / (inDimension * outDimension))
    sig = Signal(inDimension, outDimension, numTrials, numPlots=plots)

    # In this case, since we are only loading the model, not trying to train it,
    # we can use function simulate and preprocess
    sig.system_validation([1, 10], [1, 10], [1, 10])
    print("--- %s seconds ---" % (time.time() - start_time))

    # Initialize the models that are saved using the parameters declared above
    predictor = Model()
    predictor.load_model(sig, path)
    #start_time = time.time()

    kps = np.zeros(1000)
    taus = np.zeros(1000)
    thetas = np.zeros(1000)

    # Function to make predictions based off the simulation
    a, b = yData.shape
    inlet = yData - uData
    inlet = inlet.reshape((a, b, 1))
Пример #2
0
inDims = range(1, 2)
outDims = range(1, 2)

for (inDimension, outDimension) in zip(inDims, outDims):
    name = 'MIMO ' + str(inDimension) + 'x' + str(outDimension)
    path = valPath + name + '/Checkpoints/'

    start_time = time.time()
    numTrials = int(NUMTRIALS / (inDimension * outDimension))
    sig = Signal(inDimension, outDimension, numTrials, numPlots=plots)

    # In this case, since we are only loading the model, not trying to train it,
    # we can use function simulate and preprocess
    xData, yData = sig.system_validation(KpRange=[1, 10],
                                         tauRange=[1, 10],
                                         thetaRange=[1, 10])
    print("--- %s seconds ---" % (time.time() - start_time))

    # Initialize the models that are saved using the parameters declared above
    predictor = Model()
    predictor.load_model(sig, path)

    # Function to make predictions based off the simulation

    #kp_yhat = self.modelDict['kp'](sig.xData['kp'])
    #tau_yhat = self.modelDict['tau'](sig.xData['tau'])
    #theta_yhat = self.modelDict['theta'](sig.xData['theta'])

    print("--- %s seconds ---" % (time.time() - start_time))
Пример #3
0
inDims = range(1, 2)
outDims = range(1, 2)

for (inDimension, outDimension) in zip(inDims, outDims):
    name = 'MIMO ' + str(inDimension) + 'x' + str(outDimension)
    path = valPath + name + '/Checkpoints/'

    start_time = time.time()
    numTrials = int(NUMTRIALS / (inDimension * outDimension))
    sig = Signal(inDimension, outDimension, numTrials, numPlots=plots)

    # In this case, since we are only loading the model, not trying to train it,
    # we can use function simulate and preprocess
    sig.system_validation(KpRange=[1, 10],
                          tauRange=[1, 10],
                          thetaRange=[1, 10])
    print("--- %s seconds ---" % (time.time() - start_time))

    # Initialize the models that are saved using the parameters declared above
    predictor = Model()
    predictor.load_model(sig, path)
    start_time = time.time()

    kps = np.zeros(1000)
    taus = np.zeros(1000)
    thetas = np.zeros(1000)

    # Function to make predictions based off the simulation
    for i, (u, y) in enumerate(zip(uData, yData)):
        in1 = (u * y).reshape(1, 100, 1)