def plotFunctionApproximatorTrainingFromDirectory(directory,ax,ax2=None):
    """Load data related to function approximator training from a directory and plot it."""
    if ax2 != None:
        plotLocallyWeightedLinesFromDirectory(directory,ax2)
    else:
        plotLocallyWeightedLinesFromDirectory(directory,ax)
        
    plotDataFromDirectory(directory,ax)
def plotFunctionApproximatorTrainingFromDirectory(directory,ax):
    """Load data related to function approximator training from a directory and plot it."""
    plotDataFromDirectory(directory,ax)
    
    data_read_successfully = True
    cur_directory_number=0
    while (data_read_successfully):
      cur_dir = directory+'/perturbation'+str(cur_directory_number)+'/'
      data_read_successfully = plotLocallyWeightedLinesFromDirectory(cur_dir,ax)
      cur_directory_number+=1
def plotFunctionApproximatorTrainingFromDirectory(directory,ax):
    """zzz."""
    plotDataFromDirectory(directory,ax)
    
    data_read_successfully = True
    cur_directory_number=0
    while (data_read_successfully):
      cur_dir = directory+'/perturbation'+str(cur_directory_number)+'/'
      data_read_successfully = plotLocallyWeightedLinesFromDirectory(cur_dir,ax)
      cur_directory_number+=1
예제 #4
0
def plotFunctionApproximatorTrainingFromDirectory(directory, ax):
    """zzz."""
    plotDataFromDirectory(directory, ax)

    data_read_successfully = True
    cur_directory_number = 0
    while data_read_successfully:
        cur_dir = directory + "/perturbation" + str(cur_directory_number) + "/"
        data_read_successfully = plotLocallyWeightedLinesFromDirectory(cur_dir, ax)
        cur_directory_number += 1
예제 #5
0
from plotLocallyWeightedLines import plotLocallyWeightedLinesFromDirectory

if __name__=='__main__':
    executable = "../../../bin_test/testBasisFunctionsLWR"
    
    if (not os.path.isfile(executable)):
        print ""
        print "ERROR: Executable '"+executable+"' does not exist."
        print "Please call 'make install' in the build directory first."
        print ""
        sys.exit(-1);
    
    # Call the executable with the directory to which results should be written
    directory = "/tmp/testBasisFunctionsLWR"
    subprocess.call([executable, directory])
    
    # Plot the results in each directory
    fig = plt.figure()
    subplot_number = 1;
    for sym_label in ["symmetric","Asymmetric"]:
        ax = fig.add_subplot(1,2,subplot_number)
        subplot_number += 1;
        directory_fa = directory +"/1D_" + sym_label
        plotDataFromDirectory(directory_fa,ax)
        plotLocallyWeightedLinesFromDirectory(directory_fa,ax)
        #ax.legend(['targets','predictions'])
        ax.set_title(sym_label)
    plt.show()
    

        sys.exit(-1);
    
    # Call the executable with the directory to which results should be written
    directory = "/tmp/demoTrainFunctionApproximators"
    subprocess.call([executable, directory])
    
    # Plot the results in each directory
    function_approximator_names = ["LWR","LWPR","GMR","IRFRLS"]
    fig = plt.figure()
    subplot_number = 1;
    for name in function_approximator_names:
    
    
        ax = fig.add_subplot(1,len(function_approximator_names),subplot_number)
        subplot_number += 1;
    
        directory_fa = directory +"/"+ name
        try:
            plotDataFromDirectory(directory_fa,ax)
            if (name=="LWR" or name=="LWPR"):
                plotLocallyWeightedLinesFromDirectory(directory_fa,ax)
            ax.set_ylim(-1.0,1.5)
        except IOError:
            print "WARNING: Could not find data for function approximator "+name
        ax.set_title(name)
    
    ax.legend(['targets','predictions'])
    plt.show()
    

예제 #7
0
    executable = "../../../bin_test/testLeastSquares"

    if (not os.path.isfile(executable)):
        print("")
        print("ERROR: Executable '" + executable + "' does not exist.")
        print("Please call 'make install' in the build directory first.")
        print("")
        sys.exit(-1)

    fig_number = 1
    directory = "/tmp/testLeastSquares/"

    # Call the executable with the directory to which results should be written
    command = executable + " " + directory
    print(command)
    subprocess.call(command, shell=True)

    for dim in [1, 2]:
        fig = plt.figure(fig_number, figsize=(15, 5))
        fig_number = fig_number + 1
        if (dim == 1):
            ax = fig.add_subplot(1, 1, 1)
        else:
            ax = fig.add_subplot(1, 1, 1, projection='3d')

        cur_directory = directory + "/" + str(dim) + "D"
        plotDataFromDirectory(cur_directory, ax)

    plt.show()
def plotFunctionApproximatorTrainingFromDirectory(directory, ax):
    """zzz."""
    plotLocallyWeightedLinesFromDirectory(directory, ax)
    plotDataFromDirectory(directory, ax)
    else:
      ax.set_xlabel('input_1');
      ax.set_ylabel('input_2');
      ax.set_zlabel('output');

    return True;
    
    

if __name__=='__main__':
    """Pass a directory argument, read inputs, targets and predictions from that directory, and plot."""

    if (len(sys.argv)==2):
        directory = str(sys.argv[1])
    else:
        print '\nUsage: '+sys.argv[0]+' <directory>    (data is read from directory)\n';
        sys.exit()
    
  
    fig = plt.figure() 
    if (getDataDimFromDirectory(directory)==1):
      ax = fig.gca()
    else:
      ax = Axes3D(fig)
      
    plotDataFromDirectory(directory,ax)
    plotLocallyWeightedLinesFromDirectory(directory,ax)
    plt.show()


예제 #10
0
    if (n_dims == 1):
        ax.set_xlabel('input')
        ax.set_ylabel('output')
    else:
        ax.set_xlabel('input_1')
        ax.set_ylabel('input_2')
        ax.set_zlabel('output')

    return True


if __name__ == '__main__':
    """Pass a directory argument, read inputs, targets and predictions from that directory, and plot."""

    if (len(sys.argv) == 2):
        directory = str(sys.argv[1])
    else:
        print '\nUsage: ' + sys.argv[
            0] + ' <directory>    (data is read from directory)\n'
        sys.exit()

    fig = plt.figure()
    if (getDataDimFromDirectory(directory) == 1):
        ax = fig.gca()
    else:
        ax = Axes3D(fig)

    plotDataFromDirectory(directory, ax)
    plotLocallyWeightedLinesFromDirectory(directory, ax)
    plt.show()
def plotFunctionApproximatorTrainingFromDirectory(directory,ax):
    """zzz."""
    plotLocallyWeightedLinesFromDirectory(directory,ax)
    plotDataFromDirectory(directory,ax)