def runHash(name, fileName, buckets, floats, i): hashtable = HashTable(logN(buckets), dimensions[i]) f = open(fileName, 'r') for line in f: tokens = line.split(',') if tokens[0] != 'feature1': arr = [float(tokens[i]) for i in range(dimensions[i])] hashtable.__setitem__(arr) f.close() # hashtable.makeDict(name) print( str(fileName) + ' with Normal: ' + str(hashtable.conflicts()[0]) + ' and ' + str(hashtable.conflicts()[1]) + ' w/ avg. bucket height of ' + str(hashtable.conflicts()[2]))
def runHash(name, fileName, buckets, floats, i): hashtable = HashTable(logN(buckets), dimensions[i]) f = open(fileName, 'r') for line in f: tokens = line.split() arr = [] if i >= 0 and i <= 7: arr = [float(tokens[i]) for i in range(len(tokens))] elif i >= 8 and i <= 9: arr = [int(tokens[i]) for i in range(len(tokens) - 1)] hashtable.__setitem__(arr) f.close() # hashtable.makeDict(name) print(str(name) + ' with Normal: ' + str(hashtable.conflicts()[0]) + ' and ' + str(hashtable.conflicts()[1]))