<jupyter_start><jupyter_text>Multivariate Source Use Case (Single DataFrameCase) In this vignette I will represent a use case for the Source Multivariate Entropy Triangle with some individual Databases.  Importing Libraries We import the package entropytriangle, which will import the modules needed for the evaluation.<jupyter_code>from entropytriangle import * #importing all modules necessary for the plotting<jupyter_output><empty_output><jupyter_text>Dowloading a set of Databases In this case, the csv files for the use case, are stored locally.<jupyter_code>#df = pd.read_csv('Arthritis.csv',delimiter=',',index_col='Unnamed: 0').drop(['ID'],axis = 1)
#df = pd.read_csv('Breast_data.csv',delimiter=',',index_col='Unnamed: 0').drop(['Sample code number'],axis = 1).replace('?',np.nan) # in this DB the missing values are represented as '?' 
#df = pd.read_csv('Glass.csv',delimiter=',')
#df = pd.read_csv('Ionosphere.csv',delimiter=',')
df = pd.read_csv('Iris.csv',delimiter=',',index_col='Id')
#df = pd.read_csv('Wine.csv',delimiter=',').drop(['Wine'],axis = 1)
df.info(verbose=True)
df.head(10)<jupyter_output><empty_output><jupyter_text>Discretizing the Data before entropy calculation We have defined a function for discretizing a whole dataset, the function divides de entries in "NROWS(DF)^(1/3)" equally sized spaces, and turns the original continuous variables into categorical variables.<jupyter_code>df = discretization(df)
df.info()
df.head(10)<jupyter_output><empty_output><jupyter_text>Source Entropies Measures calculation Once we have our data discretized, we will start by calculating the values of the entropies for the posterior plots:<jupyter_code>'''
As the database is previosly discretized we won´t need the values of the bins
'Type variable select the entropy calculation:'
    Total: Total source entropy decomposition (CPx)
    Dual : Dual source entropy decomposition (DPx instead of CPx)
'''

edf = sentropies(df , type = 'total' , base = 2) 
edf<jupyter_output><empty_output><jupyter_text>Source Entropies Entropy Triangle Plotting The last step will be plotting the values calculated previously. The coordinates will be calculated multiplying the normalized values needed by the scale used for plotting the triangle, and will appear behind the triangle plot for comparison:<jupyter_code>entriangle(edf,s_mk=250,scale= 100, pltscale=16 , ticks_size=12, gridl = 20, chart_title = "Source Multivariate split entropies Iris (SMET)")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10313001605136436, 'fraction_numerical': 0.009630818619582664, 'mean_word_length': 6.964856230031949, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '50649', 'license': 'MIT', 'n_tokens_mistral': 785, 'n_tokens_neox': 742, 'n_words': 251, 'path': 'vignettes/SMET - MultivariateSourceUseCase.ipynb', 'repo_name': 'Jaimedlrm/entropytriangle', 'size': '2492'}