<jupyter_start><jupyter_text>label encoding<jupyter_code>cls_list = [ float(i) for i in range(1,51)]
label_encoding = pd.DataFrame(cls_list).T
label_encoding.index +=1
label_encoding.columns+=1
label_encoding
label_encoding.to_csv('label_encoding.csv',index=False)<jupyter_output><empty_output><jupyter_text>one hot encodinghttps://stackoverflow.com/questions/52323575/generate-one-hot-encodings-from-dict-values<jupyter_code>cls_list = [ i for i in range(1,51)]
# Sort and extract the indices.
idx = sorted(cls_list)
# Initialise a matrix of zeros.
aa = np.zeros((len(idx), max(idx)+1))
# Assign 1 to appropriate indices.
aa[np.arange(len(aa)), idx] = 1
one_hot_encoding = pd.DataFrame(aa)
one_hot_encoding = one_hot_encoding.drop(0, 1)
one_hot_encoding.index +=1
one_hot_encoding
one_hot_encoding.to_csv('one_hot_encoding.csv',index=False)<jupyter_output><empty_output><jupyter_text>bit encodinghttps://stackoverflow.com/questions/49836933/encode-integer-pandas-dataframe-column-to-padded-16-bit-binary<jupyter_code>df = pd.DataFrame(dict(A=range(50)))
a = df.A.values
n = int(np.log2(a.max() + 1))
b = (a[:, None] >> np.arange(n)[::-1]) & 1
c = b.astype(np.float32)
bit_encoding = pd.DataFrame(c).T
bit_encoding.index +=1
bit_encoding.columns +=1
bit_encoding
bit_encoding.to_csv('bit_encoding.csv',index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15029761904761904, 'fraction_numerical': 0.03125, 'mean_word_length': 7.67741935483871, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '200321', 'license': 'MIT', 'n_tokens_mistral': 539, 'n_tokens_neox': 514, 'n_words': 75, 'path': 'zero-shot-images/data/AWA2/awa_create_custom_attribute.ipynb', 'repo_name': 'e96031413/tfvaegan', 'size': '1344'}