def solution(): count = 1 min = 100000 for i in range(0, 100): for j in range(i + 1, 100): hd = hamming(df.iloc[i, 1], df.iloc[j, 1]) print(count, "(", df.iloc[i, 0], df.iloc[j, 0], ")hamming_distance: ", hd) if min > hd: min = hd count += 1 return min
def sol(): df = pd.read_csv('sample.csv', names=['word', 'bin']) min = 1000000000 count = 1 for i in range(0, len(df)): for j in range(i + 1, len(df)): hd = hamming(df.iloc[i, 1], df.iloc[j, 1]) if min > hd: min = hd count += 1 return min
def main(): df = pd.read_csv('sample.csv', names=['word', bin]) print() min = -1 count = 1 length = df.shape[0] #length = 10 #print(df.size) for i in range(length - 1): for j in range(i + 1, length): #print(i,j) hd = hamming(df.iloc[i, 1], df.iloc[j, 1]) print(count, "(", df.iloc[i, 0], df.iloc[j, 0], ")hamming_distance:", hd) if min == -1 or min > hd: min = hd count += 1 print("min hamming distance", min)
import random import numpy as np import pandas as pd from hamming_parctice import hamming df = pd.read_csv('sample.csv', names=['word', 'bin']) m_d = hamming(df.iloc[0, 1], df.iloc[1, 1]) count = 1 for i in range(0, len(df)): for j in range(0, len(df)): if i < j: dist = hamming(df.iloc[i, 1], df.iloc[j, 1]) print(count, "(", df.iloc[i, 0], df.iloc[j, 0], ") hamming_distance :", dist) if m_d > dist: m_d = dist count = count + 1 print("min hamming distance", m_d)
import random import numpy as np import pandas as pd from hamming_parctice import hamming df = pd.read_csv('sample.csv', names = ['word', 'bin']) min = hamming(df.iloc[1,1], df.iloc[2,1]) count = 1; for i in range(0,len(df)): for j in range(0,len(df)): if i < j: hd = hamming(df.iloc[i,1],df.iloc[j,1]) print(count,"(",df.iloc[i,0],df.iloc[j,0],")hamming_distance: ",hd) count = count + 1; if min > hd: min = hd print("min hamming distance", min)
import random import numpy as np import pandas as pd from hamming_parctice import hamming df = pd.read_csv('sample.csv', names=['word', 'bin']) leng = df.shape count = 1 for i in range(0, leng[0]): for j in range(i + 1, leng[0]): hd = hamming(df.iloc[i, 1], df.iloc[j, 1]) print(count, "(", df.iloc[i, 0], df.iloc[j, 0], ")hamming_distance:", hd) if count == 1: min_ = hd if hd < min_: min_ = hd count = count + 1 print("min hamming distance", min_)
import random import numpy as np import pandas as pd from hamming_parctice import hamming from itertools import combinations df = pd.read_csv('sample.csv', names=['word', 'bin']) words = [df.iloc[i, 0] for i in range(0, len(df))] bins = [df.iloc[i, 1] for i in range(0, len(df))] count = 0 minimum_hd = 32 for alpha, beta in combinations(zip(words, bins), 2): hd = hamming(alpha[1], beta[1]) print(count, "(", alpha[0], beta[0], ")", "hamming_distance: ", hd) if minimum_hd > hd: minimum_hd = hd count += 1 print("min hamming distance", minimum_hd)