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

# List of files with submissions
files = [
    'result_tmp/submit_catboost_hyperopt.csv',
    'result_tmp/submit_xgb_hyperopt.csv',
    'result_tmp/submit_lightgbm_hyperopt.csv',
    'result_tmp/submit_KRR.csv'
]

# Load submissions
p_buf = []
for file in files:
    df = pd.read_csv(file)
    df = df.sort_values('id')
    ids = df['id'].values
    p = df[['formation_energy_ev_natom', 'bandgap_energy_ev']].values
    p_buf.append(p)

# Generate predictions and save to file
preds = np.mean(p_buf, axis=0)
subm = pd.DataFrame()
subm['id'] = ids
subm['formation_energy_ev_natom'] = preds[:, 0]
subm['bandgap_energy_ev'] = preds[:, 1]
subm.to_csv('ensemble_submission.csv', index=False)

50d573f1a88290904f2e053c5ece8056bbc5b9b5
<mask token>

<mask token>
for file in files:
    df = pd.read_csv(file)
    df = df.sort_values('id')
    ids = df['id'].values
    p = df[['formation_energy_ev_natom', 'bandgap_energy_ev']].values
    p_buf.append(p)
<mask token>
subm.to_csv('ensemble_submission.csv', index=False)

<mask token>
files = ['result_tmp/submit_catboost_hyperopt.csv',
    'result_tmp/submit_xgb_hyperopt.csv',
    'result_tmp/submit_lightgbm_hyperopt.csv', 'result_tmp/submit_KRR.csv']
p_buf = []
for file in files:
    df = pd.read_csv(file)
    df = df.sort_values('id')
    ids = df['id'].values
    p = df[['formation_energy_ev_natom', 'bandgap_energy_ev']].values
    p_buf.append(p)
preds = np.mean(p_buf, axis=0)
subm = pd.DataFrame()
subm['id'] = ids
subm['formation_energy_ev_natom'] = preds[:, 0]
subm['bandgap_energy_ev'] = preds[:, 1]
subm.to_csv('ensemble_submission.csv', index=False)

import numpy as np
import pandas as pd
files = ['result_tmp/submit_catboost_hyperopt.csv',
    'result_tmp/submit_xgb_hyperopt.csv',
    'result_tmp/submit_lightgbm_hyperopt.csv', 'result_tmp/submit_KRR.csv']
p_buf = []
for file in files:
    df = pd.read_csv(file)
    df = df.sort_values('id')
    ids = df['id'].values
    p = df[['formation_energy_ev_natom', 'bandgap_energy_ev']].values
    p_buf.append(p)
preds = np.mean(p_buf, axis=0)
subm = pd.DataFrame()
subm['id'] = ids
subm['formation_energy_ev_natom'] = preds[:, 0]
subm['bandgap_energy_ev'] = preds[:, 1]
subm.to_csv('ensemble_submission.csv', index=False)

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

# List of files with submissions
files = [
    'result_tmp/submit_catboost_hyperopt.csv',
    'result_tmp/submit_xgb_hyperopt.csv',
    'result_tmp/submit_lightgbm_hyperopt.csv',
    'result_tmp/submit_KRR.csv'
]

# Load submissions
p_buf = []
for file in files:
    df = pd.read_csv(file)
    df = df.sort_values('id')
    ids = df['id'].values
    p = df[['formation_energy_ev_natom', 'bandgap_energy_ev']].values
    p_buf.append(p)

# Generate predictions and save to file
preds = np.mean(p_buf, axis=0)
subm = pd.DataFrame()
subm['id'] = ids
subm['formation_energy_ev_natom'] = preds[:, 0]
subm['bandgap_energy_ev'] = preds[:, 1]
subm.to_csv('ensemble_submission.csv', index=False)
