def prob_mac_given_loc(self, mac, val, loc, positive):
    '\n        Determine the P(mac=val | loc) (positive)\n        Determine the P(mac=val | ~loc) (not positive)\n        '
    name = '{}{}{}{}'.format(mac, val, loc, positive)
    cached = cache.get(name)
    if (cached != None):
        return cached
    P = 0.005
    nameData = '{}{}{}'.format(mac, loc, positive)
    cached = cache.get(nameData)
    if (cached != None):
        if (val in cached):
            P = cached[val]
        return P
    db = sqlite3.connect(self.db_name)
    c = db.cursor()
    if positive:
        c.execute('SELECT val,count FROM data WHERE loc = ? AND mac = ?', (loc, mac))
    else:
        c.execute('SELECT val,count FROM data WHERE loc != ? AND mac = ?', (loc, mac))
    val_to_count = {}
    for row in c.fetchall():
        val_to_count[row[0]] = row[1]
    db.close()
    new_val_to_count = copy.deepcopy(val_to_count)
    width = 3
    for v in val_to_count:
        for x in range(((- 1) * (width ** 3)), ((width ** 3) + 1)):
            addend = int(round((100 * norm.pdf(0, loc=x, scale=width))))
            if (addend <= 0):
                continue
            if ((v + x) not in new_val_to_count):
                new_val_to_count[(v + x)] = 0
            new_val_to_count[(v + x)] = (new_val_to_count[(v + x)] + addend)
    total = 0
    for v in new_val_to_count:
        total += new_val_to_count[v]
    for v in new_val_to_count:
        new_val_to_count[v] = (new_val_to_count[v] / total)
    P = 0.005
    if (val in new_val_to_count):
        P = new_val_to_count[val]
    cache[name] = P
    cache[nameData] = new_val_to_count
    return P
Determine the P(mac=val | loc) (positive)
Determine the P(mac=val | ~loc) (not positive)
def prob_mac_given_loc(self, mac, val, loc, positive):
    '\n        Determine the P(mac=val | loc) (positive)\n        Determine the P(mac=val | ~loc) (not positive)\n        '
    name = '{}{}{}{}'.format(mac, val, loc, positive)
    cached = cache.get(name)
    if (cached != None):
        return cached
    P = 0.005
    nameData = '{}{}{}'.format(mac, loc, positive)
    cached = cache.get(nameData)
    if (cached != None):
        if (val in cached):
            P = cached[val]
        return P
    db = sqlite3.connect(self.db_name)
    c = db.cursor()
    if positive:
        c.execute('SELECT val,count FROM data WHERE loc = ? AND mac = ?', (loc, mac))
    else:
        c.execute('SELECT val,count FROM data WHERE loc != ? AND mac = ?', (loc, mac))
    val_to_count = {}
    for row in c.fetchall():
        val_to_count[row[0]] = row[1]
    db.close()
    new_val_to_count = copy.deepcopy(val_to_count)
    width = 3
    for v in val_to_count:
        for x in range(((- 1) * (width ** 3)), ((width ** 3) + 1)):
            addend = int(round((100 * norm.pdf(0, loc=x, scale=width))))
            if (addend <= 0):
                continue
            if ((v + x) not in new_val_to_count):
                new_val_to_count[(v + x)] = 0
            new_val_to_count[(v + x)] = (new_val_to_count[(v + x)] + addend)
    total = 0
    for v in new_val_to_count:
        total += new_val_to_count[v]
    for v in new_val_to_count:
        new_val_to_count[v] = (new_val_to_count[v] / total)
    P = 0.005
    if (val in new_val_to_count):
        P = new_val_to_count[val]
    cache[name] = P
    cache[nameData] = new_val_to_count
    return P