<jupyter_start><jupyter_text>Bank Notes PreProcessing<jupyter_code># Import libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns


%matplotlib inline
%config InlineBackend.figure_format='retina'



# source : https://archive.ics.uci.edu/ml/datasets/banknote+authentication
# Variables 
#1. variance of Wavelet Transformed image (continuous)
#2. skewness of Wavelet Transformed image (continuous)
#3. kurtosis of Wavelet Transformed image (continuous)
#4. entropy of image (continuous)
#5. class (integer)

data0 = pd.read_csv("banknotes.txt",
                    names=["vari","skew","kurtosis","entropy","class"],)

data0.describe()
data0.head(11)
# Set palette
crimson_green = sns.diverging_palette(1, 190, sep=80, n=2)
#sns.palplot(crimson_green)
ax = sns.countplot(x="class", data=data0, palette=crimson_green)
plt.savefig('countplot', dpi=300)
pic= sns.pairplot(data=data0, hue="class", palette=crimson_green)
a, b = stats.linregress(data0["skew"],data0["kurtosis"])[:2]
plt.plot(data0["skew"],data0["kurtosis"],'g+')
plt.plot(np.arange(-2.5,2.5,0.05) ,b+a*np.arange(-2.5,2.5,0.05),'r')
plt.title('Simple linear regression')
plt.xlabel('Skewness')
plt.ylabel('Kurtosis')
plt.show()

d0 = data0[data0["class"]==0]
d1 = data0[data0["class"]==1]

plt.plot(d0["skew"],d0["entropy"],'+',label="Class 0")
plt.plot(d1["skew"],d1["entropy"],'r+',label="Class 1")
plt.xlabel("Skewness")
plt.ylabel("Entropy")
plt.grid()
plt.legend()
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18499012508229098, 'fraction_numerical': 0.03620803159973667, 'mean_word_length': 6.875647668393782, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '159188', 'license': 'MIT', 'n_tokens_mistral': 639, 'n_tokens_neox': 599, 'n_words': 105, 'path': '.ipynb_checkpoints/bankNotes-checkpoint.ipynb', 'repo_name': 'ypraw/bigOPYID', 'size': '1519'}