<commit_before>## \file demoTrainFunctionApproximators.py
## \author <NAME>
## \brief  Visualizes results of demoTrainFunctionApproximators.cpp
## 
## \ingroup Demos
## \ingroup FunctionApproximators

import matplotlib.pyplot as plt
import os, sys, subprocess

# Include scripts for plotting
lib_path = os.path.abspath('../plotting')
sys.path.append(lib_path)
from plotData import plotDataFromDirectory
from plotData import getDataDimFromDirectory
from plotLocallyWeightedLines import plotLocallyWeightedLinesFromDirectory
from plotBasisFunctions import plotBasisFunctionsFromDirectory

if __name__=='__main__':
    executable = "../../../bin/demoTrainFunctionApproximators"
    
    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/demoTrainFunctionApproximators"
    subprocess.call([executable, directory])
    
    # Plot the results in each directory
    function_approximator_names = ["WLS","LWR","LWPR","IRFRLS","GMR","RBFN","GPR"]
    
    # How well are these function approximators coded ;-)
    devel = {}
    devel["WLS"] = "stable"
    devel["LWR"] = "stable"
    devel["LWPR"] = "stable"
    devel["IRFRLS"] = "testing"
    devel["GMR"] = "testing"
    devel["RBFN"] = "unstable"
    devel["GPR"] = "unstable"
    
    fig_number = 1;
    for name in function_approximator_names:
        fig = plt.figure(fig_number)

        directory_fa = directory +"/"+ name
        if (getDataDimFromDirectory(directory_fa)==1):
            ax = fig.add_subplot(111)
        else:
            ax = fig.add_subplot(111, projection='3d')

        fig_number += 1;
    
        try:
            plotDataFromDirectory(directory_fa,ax)
            if (name=="WLS" or name=="LWR" or name=="LWPR" or name=="GPR"):
                plotLocallyWeightedLinesFromDirectory(directory_fa,ax)
            elif (name=="RBFN"):
                plot_normalized=False
                plotBasisFunctionsFromDirectory(directory_fa,ax,plot_normalized)
            ax.set_ylim(-1.0,1.5)
        except IOError:
            print "WARNING: Could not find data for function approximator "+name
        ax.set_title(name+" ("+devel[name]+")")
    
    ax.legend(['f(x)','+std','-std','residuals'])
    
    print "stable/testing/unstable in the titles refers to the development status of the algorithm"
    print "   * stable    - tested and should work"
    print "   * testing   - seems ok, but still needs testing"
    print "   * unstable  - seems ok, but still needs testing, and is still being modified regularly"
    plt.show()
    
    #fig.savefig("lwr.svg")
<commit_msg>No more stable/testing/unstable output<commit_after>## \file demoTrainFunctionApproximators.py
## \author <NAME>
## \brief  Visualizes results of demoTrainFunctionApproximators.cpp
## 
## \ingroup Demos
## \ingroup FunctionApproximators

import matplotlib.pyplot as plt
import os, sys, subprocess

# Include scripts for plotting
lib_path = os.path.abspath('../plotting')
sys.path.append(lib_path)
from plotData import plotDataFromDirectory
from plotData import getDataDimFromDirectory
from plotLocallyWeightedLines import plotLocallyWeightedLinesFromDirectory
from plotBasisFunctions import plotBasisFunctionsFromDirectory

if __name__=='__main__':
    executable = "../../../bin/demoTrainFunctionApproximators"
    
    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/demoTrainFunctionApproximators"
    subprocess.call([executable, directory])
    
    # Plot the results in each directory
    function_approximator_names = ["WLS","LWR","LWPR","IRFRLS","GMR","RBFN","GPR"]
        
    fig_number = 1;
    for name in function_approximator_names:
        fig = plt.figure(fig_number)

        directory_fa = directory +"/"+ name
        if (getDataDimFromDirectory(directory_fa)==1):
            ax = fig.add_subplot(111)
        else:
            ax = fig.add_subplot(111, projection='3d')

        fig_number += 1;
    
        try:
            plotDataFromDirectory(directory_fa,ax)
            if (name=="WLS" or name=="LWR" or name=="LWPR" or name=="GPR"):
                plotLocallyWeightedLinesFromDirectory(directory_fa,ax)
            elif (name=="RBFN"):
                plot_normalized=False
                plotBasisFunctionsFromDirectory(directory_fa,ax,plot_normalized)
            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(['f(x)','+std','-std','residuals'])
    
    plt.show()
    
    #fig.savefig("lwr.svg")

{'fraction_non_alphanumeric': 0.11372549019607843, 'fraction_numerical': 0.0058823529411764705, 'mean_word_length': 3.026045777426993, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6960808', 'n_tokens_mistral': 1564, 'n_tokens_neox': 1515, 'n_words': 365}