<jupyter_start><jupyter_text>BINARY ATTRIBUTE<jupyter_code>dfs=df[['schoolsup','famsup','paid','activities','nursery','higher','internet','romantic']]
dfs.head()
dfs=dfs.replace('no',0)
dfs=dfs.replace('yes',1)

dfs.head()
n=np.array(dfs[['schoolsup','famsup']])
n=n.reshape(-1,2)
n.shape
from scipy.spatial import distance
dist_matrix=distance.cdist(n,n)
print(dist_matrix)
sbs.heatmap(dist_matrix)
plt.show()<jupyter_output><empty_output><jupyter_text>NOMINAL ATTRIBUTE<jupyter_code>nominal=df[['Mjob','Fjob','reason','guardian']]
nominal=nominal.replace('at_home','home')
nominal=(nominal.astype('category'))
from sklearn.preprocessing import LabelEncoder
lb=LabelEncoder()
nominal['guardian']=lb.fit_transform(nominal['guardian'])
nominal['Mjob']=lb.fit_transform(nominal['Mjob'])
nominal['Fjob']=lb.fit_transform(nominal['Fjob'])
nominal['reason']=lb.fit_transform(nominal['reason'])
nominal.head()
nom1=np.array(nominal)
nom1.reshape(-1,2)
nom2=np.array(nominal)
nom2.reshape(-1,2)
from scipy.spatial import distance
dist_matrix=distance.cdist(nom1,nom2)
print(dist_matrix)
sbs.heatmap(dist_matrix)
dist_matrix.shape<jupyter_output><empty_output><jupyter_text>Numeric Attribute<jupyter_code>numeric=df[['age','Medu','Fedu','traveltime','studytime','failures']]
numeric.head()
num1=np.array(numeric[['age','failures']])
num1.reshape(-1,2)
num1.shape
num2=np.array(numeric[['Fedu','Medu']])
num2.reshape(-1,2)
num2.shape
from scipy.spatial import distance
dist_matrix=distance.cdist(num1,num2)
print(dist_matrix)

dist_matrix.shape
sbs.heatmap(dist_matrix)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18930817610062894, 'fraction_numerical': 0.016352201257861635, 'mean_word_length': 14.446601941747574, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '184590', 'license': 'Apache-2.0', 'n_tokens_mistral': 655, 'n_tokens_neox': 643, 'n_words': 58, 'path': '18cse201_Assg-5.ipynb', 'repo_name': 'ShreesantShubhamMeher07/DMDW-LAB', 'size': '1590'}