Kaggle competition: ASHRAE - Great Energy Predictor III
<SOS> metric: RMSLE Kaggle data source: ashrae-great-energy-predictor-iii<compute_test_metric>
register_matplotlib_converters()
sub = None
for dirname, _, filenames in os.walk('/kaggle/input/subs20191106/'):
for filename in filenames:
filename = os.path.join(dirname, filename)
 print(filename)
 if sub is None:
sub = pd.read_csv(filename)
 else:
sub.meter_reading += pd.read_csv(filename, usecols=['meter_reading'] ).meter_reading
sub.meter_reading = sub.meter_reading.clip(lower=0)/ len(filenames)
 sub.describe()
sigma_opt = mean_absolute_error(y, pred[:, 1])
 unc = pred[:,2] - pred[:, 0]
sigma_mean = np.mean(unc)
 print(sigma_opt, sigma_mean )<prepare_output>
path = '.. /input/clean-weather-data-eda'
building = pd.read_csv(f'{path}/building_metadata.csv.gz', dtype={'building_id':np.uint16, 'site_id':np.uint8} )
sub['FVC1'] = 1.*pe[:, 1]
sub['Confidence1'] = pe[:, 2] - pe[:, 0]
subm = sub[['Patient_Week','FVC','Confidence','FVC1','Confidence1']].copy()
subm.loc[~subm.FVC1.isnull() ].head(10 )<feature_engineering>
train = pd.read_csv(f'{path}/train.csv.gz', dtype={'building_id':np.uint16, 'meter':np.uint8}, parse_dates=['timestamp'])
 train = train.merge(building, on='building_id', how='left')
 train.head()
subm.loc[~subm.FVC1.isnull() ,'FVC'] = subm.loc[~subm.FVC1.isnull() ,'FVC1']
if sigma_mean<70:
subm['Confidence'] = sigma_opt
else:
subm.loc[~subm.FVC1.isnull() ,'Confidence'] = subm.loc[~subm.FVC1.isnull() ,'Confidence1']<load_from_csv>
test = pd.read_csv(f'{path}/test.csv.gz', dtype={'building_id':np.uint16, 'meter':np.uint8}, parse_dates=['timestamp'])
 test['meter_reading'] = sub.meter_reading
test = test.merge(building, on='building_id', how='left')
 test.head()
otest = pd.read_csv('.. /input/osic-pulmonary-fibrosis-progression/test.csv')
 for i in range(len(otest)) :
subm.loc[subm['Patient_Week']==otest.Patient[i]+'_'+str(otest.Weeks[i]), 'FVC'] = otest.FVC[i]
subm.loc[subm['Patient_Week']==otest.Patient[i]+'_'+str(otest.Weeks[i]), 'Confidence'] = 0.1<save_to_csv>
weather_trn = pd.read_csv(f'{path}/weather_train.csv.gz', parse_dates=['timestamp'],
dtype={'site_id':np.uint8, 'air_temperature':np.float16},
usecols=['site_id', 'timestamp', 'air_temperature'])
 weather_tst = pd.read_csv(f'{path}/weather_test.csv.gz', parse_dates=['timestamp'],
dtype={'site_id':np.uint8, 'air_temperature':np.float16},
usecols=['site_id', 'timestamp', 'air_temperature'])
 train = train.merge(weather_trn, on=['site_id', 'timestamp'], how='left')
 test = test.merge(weather_tst, on=['site_id', 'timestamp'], how='left' )
<prepare_output><EOS> 
sub.to_csv(f'submission.csv', index=False, float_format='%g' )