import os, sys, inspect, json
import numpy as np

currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)

try:
    from ..bal import Bal
    from .util import trainTwo, splits
except Exception: #ImportError
    from bal import Bal
    from util import trainTwo, splits


with open("./hand_som.somdata") as f:
    data = json.load(f)
labeled = [(np.array(i['pos']), np.array(i["touch"])) for i in data]

vanila    = Bal(len(data[0]["pos"]), 180, len(data[0]["touch"]))

splits(vanila, labeled)

