application_vnd.jupyter.stderr_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

TEST_SIZE = 0.33
FIGSIZE = (10, 6)
SAVE_PICKLE = True
FREE_MEMORY = True
RANDOM_STATE = 123
N_SPLITS = 3
VERBOSE = False

DATA_PATH = '../input'
def csv_path(dataset='train', data_path=DATA_PATH):
    """
    """
    return '{}/{}.csv'.format(data_path, dataset)
def read_data(dataset='train', data_path=DATA_PATH):
    """
    """
    index_col = None
    index_type = ['train', 'test']
    if dataset in index_type:
        index_col = 'id'
    data_path = csv_path(dataset, data_path=data_path)
    return pd.read_csv(data_path, index_col=index_col)

train = read_data('train')
test = read_data('test')

molecule_train = pd.DataFrame({'molecule_name': train['molecule_name'].unique()})
molecule_test = pd.DataFrame({'molecule_name': test['molecule_name'].unique()})
structures = read_data('structures')
atom_list_df = structures.groupby('molecule_name')['atom'].apply(list)
atom_list_df = atom_list_df.to_frame()
if FREE_MEMORY:
    del train
    del test

molecule_train = pd.merge(molecule_train, atom_list_df, how='left', on='molecule_name')
molecule_test = pd.merge(molecule_test, atom_list_df, how='left', on='molecule_name')

potential_energy = read_data('potential_energy')
molecule_train = pd.merge(molecule_train, potential_energy)
if FREE_MEMORY:
    del potential_energy

plt.figure(figsize=FIGSIZE)
molecule_train['potential_energy'].plot(kind='kde')
plt.show()