image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

"""
In this notebook I will see what I can do - EDA-wise without the additional data.
I do that because it is not available for us in the test,
might be we an regenaerate them - but for now, the basic data is what I want to focus on.
"""
test = pd.read_csv('../input/test.csv')
train = pd.read_csv('../input/train.csv')
structures = pd.read_csv('../input/structures.csv')

train.columns

Fig, axarr= plt.subplots(2, 2, figsize=(12,8)) # define a grid with 2 rows, 1 columns - two             
                                                                    #plots all in all insinde axarr

Plt1 = train["atom_index_0"].plot.hist(ax = axarr[0][0])

Plt2 = train["atom_index_1"].plot.hist(ax = axarr[0][1])

Plt3 = train["type"].value_counts().plot.hist(ax = axarr[1][0])

Plt3 = train["scalar_coupling_constant"].plot.hist(ax = axarr[1][1], bins =50)

"""
now for the structures
"""
structures.columns

Fig, axarr= plt.subplots(2, 2, figsize=(12,8)) # define a grid with 2 rows, 1 columns - two             
                                                                    #plots all in all insinde axarr

Plt1 = structures["molecule_name"].value_counts().plot.hist(ax = axarr[0][0], bins=50)

Plt2 = structures["atom_index"].plot.hist(ax = axarr[0][1])

Plt3 = structures["atom"].value_counts().plot.hist(ax = axarr[1][1])

"""
looking for outliers.
soo..
we are dealing with:
molecule_name', 'atom_index', 'atom', 'x', 'y', 'z'  - Structres.
'id', 'molecule_name', 'atom_index_0', 'atom_index_1', 'type','scalar_coupling_constant'
"""
sample_data = train.sample(500)
all_data = pd.merge(sample_data, structures, how='left', on='molecule_name')

"""
there is a huge peack around the 0 of this constant.
but I do not think these are na values or outliers.
lets now check if the train and test appeare to be from the same distrebution or not.
"""
structures_train = structures.loc[structures['molecule_name'].isin(train['molecule_name'])]
structures_test = structures.loc[structures['molecule_name'].isin(test['molecule_name'])]

"""
so !!
lets see what can I check..
# train: id, molecule_name, atom_index_0, atom_index_1, type, scalar_coupling_constant
# test : id, molecule_name, atom_index_0, atom_index_1, type
# structures_train: 'molecule_name', 'atom_index', 'atom', 'x', 'y', 'z'
# structures_test: 'molecule_name', 'atom_index', 'atom', 'x', 'y', 'z'
"""
'\n1. type - is there roughly the same type distrebution in both ?\n2. atom - are there roughly the same atom distrebution in both ?\n3. x ?\n4. y ?\n5. z ?\n'
Fig, axarr = plt.subplots(1, 2, figsize=(12, 8))
Plt1 = train['type'].value_counts().plot.hist(ax=axarr[0])
Plt2 = test['type'].value_counts().plot.hist(ax=axarr[1])