Baseline System

Dataset

  • 4680 instances in total
  • 80 continous attributes per instance
  • 15 features (312 instances per feature)

Major Run time parameters

  • Max learning iterations: 30,000
  • Rule Population Size (N): 1,000
  • Covering probability (p_spec): 0.5

In [1]:
%matplotlib inline
import json
import os

import matplotlib
import numpy as np
import matplotlib.pyplot as plt


def load_runtime_params(file_path):
    """Load the JSON runtime parameters
    
    :params str file_path: Local file path to the target dataset
    """
    
    # Load the file
    with open(os.path.join('data', file_path)) as json_file:
        rp_json = json.load(json_file)
        
    json_file.close()
    
    # Parse the file and return a dictionary of lists
    epoch_list = [i['epoch'] for i in rp_json['data']]
    iter_list = [i['iteration'] for i in rp_json['data']]
    acc_list = [i['acc_estimate'] for i in rp_json['data']]
    ave_gen_list = [i['ave_gen'] for i in rp_json['data']]
    micro_list = [i['micro_pop'] for i in rp_json['data']]
    macro_list = [i['macro_pop'] for i in rp_json['data']]
    
    data = {
        'epoch': epoch_list,
        'iteration': iter_list,
        'acc_estimate': acc_list,
        'ave_gen': ave_gen_list,
        'micro_pop': micro_list,
        'macro_pop': macro_list
    }
    
    
    return data

In [2]:
# Running for 500,000 iterations
# 1 segement
rp_json_1 = load_runtime_params('rp_data_4680_1-500000.json')

plt.plot(
    rp_json_1['iteration'],
    rp_json_1['acc_estimate'],
    label='1 segment'
)

plt.xlabel('Iteration')
plt.ylabel('Accuracy')
plt.legend()


Out[2]:
<matplotlib.legend.Legend at 0x44c8b70>

In [3]:
# Running for 500,000 iterations
# 8 segements
rp_json_1 = load_runtime_params('rp_data_4680_8-500000.json')

plt.plot(
    rp_json_1['iteration'],
    rp_json_1['acc_estimate'],
    'g',
    label='8 segments'
)

plt.xlabel('Iteration')
plt.ylabel('Accuracy')
plt.legend()


Out[3]:
<matplotlib.legend.Legend at 0x6ff9f10>

In [4]:
# Running for 500,000 iterations
# 1 segement
rp_json_1 = load_runtime_params('rp_data_4680_1-500000.json')

plt.plot(
    rp_json_1['iteration'],
    rp_json_1['acc_estimate'],
    label='1 segment'
)

# 8 segements
rp_json_2 = load_runtime_params('rp_data_4680_8-500000.json')

plt.plot(
    rp_json_2['iteration'],
    rp_json_2['acc_estimate'],
    'g',
    label='8 segments'
)

plt.xlabel('Iteration')
plt.ylabel('Accuracy')
plt.legend()


Out[4]:
<matplotlib.legend.Legend at 0x7069c10>

In [5]:
# Running for 50,000 iterations
rp_json_1 = load_runtime_params('rp_data_4680_1-50000.json')
rp_json_2 = load_runtime_params('rp_data_4680_4-50000.json')
rp_json_3 = load_runtime_params('rp_data_4680_8-500000.json')

plt.plot(
    rp_json_1['iteration'],
    rp_json_1['acc_estimate'],
    label='1 segment'
)
    
plt.plot(    
    rp_json_2['iteration'],
    rp_json_2['acc_estimate'],
    label='4 segments'
)

plt.plot(    
    rp_json_3['iteration'][:10],
    rp_json_3['acc_estimate'][:10],
    label='8 segments'
)


plt.xlabel('Iteration')
plt.ylabel('Accuracy')
plt.legend()


Out[5]:
<matplotlib.legend.Legend at 0x70d6830>

In [6]:
# Increasing the population size
rp_json_1 = load_runtime_params('rp_data_4680_1-50000.json')
rp_json_2 = load_runtime_params('rp_data_4680_1-30000-N-3000.json')
rp_json_3 = load_runtime_params('rp_data_4680_1-100000-N-5000.json')

plt.plot(
    rp_json_1['iteration'],
    rp_json_1['acc_estimate'],
    label='N = 1000'
)
    
plt.plot(    
    rp_json_2['iteration'],
    rp_json_2['acc_estimate'],
    label='N = 3000'
)

plt.plot(    
    rp_json_3['iteration'][:10],
    rp_json_3['acc_estimate'][:10],
    label='N = 5000'
)


plt.xlabel('Iteration')
plt.ylabel('Accuracy')
plt.legend()


Out[6]:
<matplotlib.legend.Legend at 0x700e150>

In [ ]: