Skip to content

How to run the program

Juan Lao Tebar edited this page Jan 19, 2017 · 3 revisions

This page describes how to execute the generator of results of this project.

In order to execute the generator, open a system shell and go to the src directory of this project. To see a full list of available options, execute the generator with the -h option:

$ cd src
$ python -m bblr.Main -h
usage: bblr-hopfield-boltzmann analyzer [-h] [--seed SEED]
                                        [--just-analyze-patterns]
                                        [--just-analyze-inputs]
                                        [--out RESULTS_FILE]
                                        pattern_data_set_properties_file
                                        model_properties_file
                                        input_data_set_properties_file

Automatic script to obtain the final results of the project bblr-hopfield-
boltzmann.

positional arguments:
  pattern_data_set_properties_file
                        Path to a file containing the combinations of pattern
                        data set properties you want to test. See
                        https://github.com/juanlao7/bblr-hopfield-
                        boltzmann/wiki/Pattern-data-set-properties-file-format
  model_properties_file
                        Path to a file containing the combinations of model
                        properties you want to test. See
                        https://github.com/juanlao7/bblr-hopfield-
                        boltzmann/wiki/Pattern-data-set-properties-file-format
  input_data_set_properties_file
                        Path to a file containing the combinations of input
                        data set properties you want to test. See
                        https://github.com/juanlao7/bblr-hopfield-
                        boltzmann/wiki/Input-data-set-properties-file-format

optional arguments:
  -h, --help            show this help message and exit
  --seed SEED           This random seed is added to the seed defined in the                                                                                                                                                                   
                        configuration files to obtain different results.                                                                                                                                                                       
  --just-analyze-patterns                                                                                                                                                                                                                      
                        Just create the random pattern data sets and analyze                                                                                                                                                                   
                        them. Do not do anything else.                                                                                                                                                                                         
  --just-analyze-inputs                                                                                                                                                                                                                        
                        Just create the random pattern data sets, the random                                                                                                                                                                   
                        input data sets and analyze them. Do not do anything                                                                                                                                                                   
                        else.                                                                                                                                                                                                                  
  --out RESULTS_FILE    Store the results as a JSON file.

Analyzing the configured pattern data sets

Before getting results, you would like to check if your pattern data sets are being generated correctly. This is interesting, since this generator approximates the configured distance between patterns, and the generated pattern data set may not have the desired values.

To analyze the pattern data sets, use the --just-analyze-patterns option:

$ cd src
$ python -m bblr.Main --just-analyze-patterns ../config/pattern/final.json ../config/model/final.json ../config/input/final.json
PATTERN: {u'dataSetSize': 30, u'distance': {u'stdev': 2, u'mean': 15}, u'patternSize': 25, u'seed': 0}
        Pattern data set size : 30
        Pattern dimension : 25
        Distance between patterns mean : 12.9149425287
        Distance between patterns standard deviation : 2.30932784845

PATTERN: {u'dataSetSize': 30, u'distance': {u'stdev': 2, u'mean': 15}, u'patternSize': 25, u'seed': 0, u'extraBits': {u'values': u'random', u'number': 25}}
        Pattern data set size : 30
        Pattern dimension : 50
        Distance between patterns mean : 25.4643678161
        Distance between patterns standard deviation : 3.42411921761

Analyzing the configured input data sets

Before getting results, you would like to check if your input data sets are being generated correctly.

To analyze the input data sets, use the --just-analyze-inputs option:

$ cd src
$ python -m bblr.Main --just-analyze-inputs ../config/pattern/final.json ../config/model/final.json ../config/input/final.json
PATTERN: {u'dataSetSize': 30, u'distance': {u'stdev': 2, u'mean': 15}, u'patternSize': 25, u'seed': 0}
        Pattern data set size : 30
        Pattern dimension : 25
        Distance between patterns mean : 12.9149425287
        Distance between patterns standard deviation : 2.30932784845

                INPUT: {u'inputsPerPattern': 3, u'seed': 0, u'minDistance': {u'stdev': 2, u'mean': 3}}
                        Input data set size : 90.0
                        Input vector dimension : 25
                        Minimum distance of inputs to patterns mean : 3.9
                        Minimum distance of inputs to patterns standard deviation : 1.88591268798

                INPUT: {u'inputsPerPattern': 3, u'seed': 0, u'minDistance': {u'stdev': 2, u'mean': 3}}
                        Input data set size : 90.0
                        Input vector dimension : 25
                        Minimum distance of inputs to patterns mean : 3.9
                        Minimum distance of inputs to patterns standard deviation : 1.88591268798

PATTERN: {u'dataSetSize': 30, u'distance': {u'stdev': 2, u'mean': 15}, u'patternSize': 25, u'seed': 0, u'extraBits': {u'values': u'random', u'number': 25}}
        Pattern data set size : 30
        Pattern dimension : 50
        Distance between patterns mean : 25.4643678161
        Distance between patterns standard deviation : 3.42411921761

                INPUT: {u'inputsPerPattern': 3, u'seed': 0, u'minDistance': {u'stdev': 2, u'mean': 3}}
                        Input data set size : 90.0
                        Input vector dimension : 25
                        Minimum distance of inputs to patterns mean : 3.9
                        Minimum distance of inputs to patterns standard deviation : 1.88591268798

                INPUT: {u'inputsPerPattern': 3, u'seed': 0, u'minDistance': {u'stdev': 2, u'mean': 3}}
                        Input data set size : 90.0
                        Input vector dimension : 25
                        Minimum distance of inputs to patterns mean : 3.9
                        Minimum distance of inputs to patterns standard deviation : 1.88591268798

As you can see, pattern data sets are also analyzed, since input data sets depend strongly on pattern data sets and this information is relevant too.

Generating results

To generate an output JSON file with the computed results after testing all the configured combinations, execute the generator like this:

$ cd src
$ python -m bblr.Main --out ../output.json ../config/pattern/final.json ../config/model/final.json ../config/input/final.json
PATTERN: {u'dataSetSize': 30, u'distance': {u'stdev': 2, u'mean': 15}, u'patternSize': 25, u'seed': 0}
        Pattern data set size : 30
        Pattern dimension : 25
        Distance between patterns mean : 12.9149425287
        Distance between patterns standard deviation : 2.30932784845

        MODEL: {u'model': u'hopfield', u'trainingRule': u'hebbian'}
                INPUT: {u'inputsPerPattern': 3, u'seed': 0, u'minDistance': {u'stdev': 2, u'mean': 3}}
                        Input data set size : 90.0
                        Input vector dimension : 25
                        Minimum distance of inputs to patterns mean : 3.9
                        Minimum distance of inputs to patterns standard deviation : 1.88591268798

                        RESULT:
                        CPU time mean : 0.277777777778
                        CPU time standard deviation : 0.447903208239
                        Iterations mean : 2.0
                        Iterations standard deviation : 0.0
                        Successful equilibriums : 0
                        Unsuccessful equilibriums : 90
                        Spurious equilibriums : 0

[...]