from concept_formation.dummy import DummyTree
from concept_formation.datasets import load_rb_s_07
from concept_formation.datasets import load_rb_s_07_human_predictions
from concept_formation.preprocessor import ObjectVariablizer

seed(5)

num_runs = 30
num_examples = 29
towers = load_rb_s_07()

variablizer = ObjectVariablizer()
towers = [variablizer.transform(t) for t in towers]

naive_data = incremental_evaluation(DummyTree(), towers,
                                    run_length=num_examples,
                                    runs=num_runs, attr="success")
cobweb_data = incremental_evaluation(TrestleTree(), towers,
                                     run_length=num_examples,
                                     runs=num_runs, attr="success")

human_data = []
key = None
human_predictions = load_rb_s_07_human_predictions()
for line in human_predictions:
    line = line.rstrip().split(",")
    if key is None:
        key = {v: i for i, v in enumerate(line)}
        continue
    x = int(line[key['order']])-1
    y = (1 - abs(int(line[key['correctness']]) -
Beispiel #2
0
import matplotlib.pyplot as plt
import numpy as np

from concept_formation.examples.examples_utils import avg_lines
from concept_formation.evaluation import incremental_evaluation
from concept_formation.cobweb import CobwebTree
from concept_formation.dummy import DummyTree
from concept_formation.datasets import load_mushroom

num_runs = 30
num_examples = 30
mushrooms = load_mushroom()

naive_data = incremental_evaluation(DummyTree(),
                                    mushrooms,
                                    run_length=num_examples,
                                    runs=num_runs,
                                    attr="classification")
cobweb_data = incremental_evaluation(CobwebTree(),
                                     mushrooms,
                                     run_length=num_examples,
                                     runs=num_runs,
                                     attr="classification")

cobweb_x, cobweb_y = [], []
naive_x, naive_y = [], []

for opp in range(len(cobweb_data[0])):
    for run in range(len(cobweb_data)):
        cobweb_x.append(opp)
        cobweb_y.append(cobweb_data[run][opp])
Beispiel #3
0
from concept_formation.preprocessor import ObjectVariablizer

num_runs = 10
num_examples = 25
animals = load_quadruped(num_examples)

variablizer = ObjectVariablizer()
animals = [variablizer.transform(t) for t in animals]

for animal in animals:
    animal['type'] = animal['_type']
    del animal['_type']

naive_data = incremental_evaluation(DummyTree(),
                                    animals,
                                    run_length=num_examples,
                                    runs=num_runs,
                                    attr="type")
trestle_data = incremental_evaluation(TrestleTree(),
                                      animals,
                                      run_length=num_examples,
                                      runs=num_runs,
                                      attr="type")

trestle_x, trestle_y = [], []
naive_x, naive_y = [], []
human_x, human_y = [], []

for opp in range(len(trestle_data[0])):
    for run in range(len(trestle_data)):
        trestle_x.append(opp)
import matplotlib.pyplot as plt
import numpy as np

from concept_formation.examples.examples_utils import avg_lines
from concept_formation.evaluation import incremental_evaluation
from concept_formation.cobweb3 import Cobweb3Tree
from concept_formation.dummy import DummyTree
from concept_formation.datasets import load_iris

num_runs = 30
num_examples = 20
irises = load_iris()

naive_data = incremental_evaluation(DummyTree(),
                                    irises,
                                    run_length=num_examples,
                                    runs=num_runs,
                                    attr="class")
cobweb_data = incremental_evaluation(Cobweb3Tree(),
                                     irises,
                                     run_length=num_examples,
                                     runs=num_runs,
                                     attr="class")
cobweb_x, cobweb_y = [], []
naive_x, naive_y = [], []

for opp in range(len(cobweb_data[0])):
    for run in range(len(cobweb_data)):
        cobweb_x.append(opp)
        cobweb_y.append(cobweb_data[run][opp])
import numpy as np
from random import seed

from concept_formation.examples.examples_utils import avg_lines
from concept_formation.evaluation import incremental_evaluation
from concept_formation.cobweb3 import Cobweb3Tree
from concept_formation.dummy import DummyTree
from concept_formation.datasets import load_iris

seed(0)
num_runs = 30
num_examples = 20
irises = load_iris()

naive_data = incremental_evaluation(DummyTree(), irises,
                                    run_length=num_examples,
                                    runs=num_runs, attr="class")
cobweb_data = incremental_evaluation(Cobweb3Tree(), irises,
                                     run_length=num_examples,
                                     runs=num_runs, attr="class")
cobweb_x, cobweb_y = [], []
naive_x, naive_y = [], []

for opp in range(len(cobweb_data[0])):
    for run in range(len(cobweb_data)):
        cobweb_x.append(opp)
        cobweb_y.append(cobweb_data[run][opp])

for opp in range(len(naive_data[0])):
    for run in range(len(naive_data)):
        naive_x.append(opp)
seed(0)

num_runs = 5
num_examples = 15
animals = load_quadruped(num_examples)

variablizer = ObjectVariablizer()
animals = [variablizer.transform(t) for t in animals]

for animal in animals:
    animal['type'] = animal['_type']
    del animal['_type']

naive_data = incremental_evaluation(DummyTree(), animals,
                                    run_length=num_examples,
                                    runs=num_runs, attr="type")
trestle_data = incremental_evaluation(TrestleTree(), animals,
                                      run_length=num_examples,
                                      runs=num_runs, attr="type")

trestle_x, trestle_y = [], []
naive_x, naive_y = [], []
human_x, human_y = [], []

for opp in range(len(trestle_data[0])):
    for run in range(len(trestle_data)):
        trestle_x.append(opp)
        trestle_y.append(trestle_data[run][opp])

for opp in range(len(naive_data[0])):