Kaggle competition: OSIC Pulmonary Fibrosis Progression
<SOS> metric: LaplaceLogLikelihood Kaggle data source: osic-pulmonary-fibrosis-progression<predict_on_test>
cufflinks.go_offline()
cufflinks.set_config_file(world_readable=True, theme='pearl')
 Dense, Dropout, Activation, Flatten, Input, GlobalAveragePooling2D, Add, Conv2D, AveragePooling2D,
LeakyReLU, Concatenate 
)
 %matplotlib inline
sns.set(style='darkgrid', palette='Set2')
 warnings.filterwarnings('ignore')
 plt.style.use('fivethirtyeight')
 plt.show()
print(f"Numpy version : Numpy {np.__version__}")
 print(f"Pandas version : Pandas {pd.__version__}")
 print(f"Matplotlib version : Matplotlib {matplotlib.__version__}")
 print(f"Seaborn version : Seaborn {sns.__version__}")
 print(f"Tensorflow version : Tensorflow {tf.__version__}" )
prediction_RF = best_est_RF1.predict_proba(df_test)
 prediction_RF = prediction_RF[:,1]<feature_engineering>
!pip install.. /input/kerasapplications/keras-team-keras-applications-3b180cb -f./ --no-index
!pip install.. /input/efficientnet/efficientnet-1.1.0/ -f./ --no-index
df_s["Probability"]=prediction_RF
df_s.head()<save_to_csv>
import efficientnet.tfkeras as efn
df_s.to_csv("submission_RF_S.csv",index=False )<set_options>
def seed_everything(seed=100):
random.seed(seed)
 os.environ['PYTHONHASHSEED'] = str(seed)
 np.random.seed(seed)
 tf.random.set_seed(seed)
 seed_everything(101 )
warnings.filterwarnings('ignore' )<load_from_csv>
base_dir = ".. /input/osic-pulmonary-fibrosis-progression/"
sampleEntry = pd.read_csv('.. /input/credit/sampleEntry.csv')
 train = pd.read_csv('.. /input/credit/cs-training.csv')
 test = pd.read_csv('.. /input/credit/cs-test.csv' )<count_missing_values>
train_df = pd.read_csv('.. /input/osic-pulmonary-fibrosis-progression/train.csv', encoding = 'latin-1')
 test_df = pd.read_csv('.. /input/osic-pulmonary-fibrosis-progression/test.csv', encoding = 'latin-1')
 submission_df = pd.read_csv('.. /input/osic-pulmonary-fibrosis-progression/sample_submission.csv', encoding = 'latin-1')
 print(colored('Training data set shape.......... : ','yellow'),train_df.shape)
 print(colored('Test data set shape...............: ','red'),test_df.shape)
 print(colored('Submission data set shape.........: ','blue'),submission_df.shape )
print(train.isnull().sum() )<count_missing_values>
print(colored('Missing values in Train Set !!', 'yellow'))
print(train_df.isnull().sum())
 print("
")
 print(colored('Missing values in Test Set !!', 'red'))
print(test_df.isnull().sum() )
print(test.isnull().sum() )<count_unique_values>
train_df.groupby(['Sex','SmokingStatus'])['FVC'].agg(['mean','std','count'] ).sort_values(by=['Sex','count'],ascending=False )
train.nunique()<data_type_conversions>
print(colored("Total Patients in Train set...: ", 'yellow'),train_df['Patient'].count())
 print(colored("Total Patients in Test set.... : ", 'red'),test_df['Patient'].count())
 print("
")
 print(colored("Unique Patients in Train set...: ", 'yellow'),train_df['Patient'].nunique())
 print(colored("Unique Patients in Test set.... : ", 'red'),test_df['Patient'].nunique() )
train['MonthlyIncome'].fillna(train['MonthlyIncome'].mean() ,inplace=True )<set_options>
print(colored("Few most repeated Patients in Train set: ", 'yellow'))
print(train_df['Patient'].value_counts().head())
 print("
")
 print(colored("Few most repeated Patients in Test set: ", 'red'))
print(test_df['Patient'].value_counts().head() )
train['NumberOfDependents'].fillna(train['NumberOfDependents'].mode() [0], inplace=True )<data_type_conversions>
train_df_unique = train_df[['Patient', 'Age', 'Sex', 'SmokingStatus']].drop_duplicates().reset_index()
print(colored("Shape of unique patient data set : ",'yellow'),train_df_unique.shape)
 train_df_unique.head()
test['MonthlyIncome'].fillna(test['MonthlyIncome'].mean() ,inplace=True )<correct_missing_values>
patient_feq = train_df.groupby(['Patient'])['Patient'].count()
patient_feq = pd.DataFrame({'Patient':patient_feq.index, 'Frequency':patient_feq.values})
 train_df_unique = pd.merge(train_df_unique,patient_feq,how='inner',on='Patient' )
test['NumberOfDependents'].fillna(test['NumberOfDependents'].mode() [0], inplace=True )<count_missing_values>
train_df_unique.sort_values(by='Frequency', ascending=False ).head()
print(train.isnull().sum() )<count_missing_values>
train_dir = '.. /input/osic-pulmonary-fibrosis-progression/train/'
patient_ids = os.listdir(train_dir)
 patient_ids = sorted(patient_ids)
 CtScan = pd.DataFrame(columns=['Patient','CtScanCount'])
 for patient_id in patient_ids:
cnt = len(os.listdir(train_dir + patient_id))
CtScan.loc[len(CtScan)] = [patient_id,cnt]
patient_df = pd.merge(train_df_unique,CtScan,how='inner',on='Patient')
 patient_df = patient_df.reset_index(drop=True)
 patient_df.head()
print(test.isnull().sum() )<prepare_x_and_y>
test_dir = '.. /input/osic-pulmonary-fibrosis-progression/test/'
test_patient_ids = os.listdir(test_dir)
 test_patient_ids = sorted(test_patient_ids)
 TestCtScan = pd.DataFrame(columns=['Patient','CtScanCount'])
 for patient_id in test_patient_ids:
cnt = len(os.listdir(test_dir + patient_id))
TestCtScan.loc[len(TestCtScan)] = [patient_id,cnt]
test_patient_df = pd.merge(test_df,TestCtScan,how='inner',on='Patient' ).reset_index()
test_patient_df.head()
X = train.drop('SeriousDlqin2yrs',1)
 y = train['SeriousDlqin2yrs']<import_modules>
print(colored("Gender wise distribution of patients :","blue"))
print(patient_df['Sex'].value_counts() )
from sklearn.model_selection import train_test_split<import_modules>
print(colored('Total Smoking counts', 'red'))
print(patient_df['SmokingStatus'].value_counts())
 print("
")
 print(colored("Male Smoking counts",'blue'))
print(patient_df[patient_df['Sex']=='Male']['SmokingStatus'].value_counts())
 print("
")
 print(colored("Female Smoking counts",'green'))
print(patient_df[patient_df['Sex']=='Female']['SmokingStatus'].value_counts() )
from sklearn.model_selection import train_test_split<split>
train_df[train_df['FVC'] > 5000].sort_values(by='FVC', ascending=False )
X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.20, random_state=568)
 print(X_train.shape)
 print(X_val.shape)
 print(y_train.shape)
 print(y_val.shape )<import_modules>
file_len = folder_len = 0
files = []
for dirpath, dirnames, filenames in os.walk(train_dir):
file_len += len(filenames)
 folder_len += len(dirnames)
 files.append(len(filenames))
print("Training folder contains", f'{file_len:,}', "CT scans for all patients.")
 print('Training folder have only',f'{folder_len:,}', "unique patients.")
 print("
")
 print('Each patient have', f'{round(np.mean(files)) :,}', 'average number of CT scans.')
 print('Maximum images per patient', f'{round(np.max(files)) :,}')
 print('Minimum images per patient', f'{round(np.min(files)) :,}' )
from xgboost import XGBClassifier<import_modules>
def load_scan(path):
slices = [pydicom.read_file(path + '/' + s)for s in os.listdir(path)]
slices.sort(key = lambda x: float(x.ImagePositionPatient[2]))
try:
slice_thickness = np.abs(slices[0].ImagePositionPatient[2] - slices[1].ImagePositionPatient[2])
 except:
slice_thickness = np.abs(slices[0].SliceLocation - slices[1].SliceLocation)
 for s in slices:
s.SliceThickness = slice_thickness
return slices
from sklearn.model_selection import GridSearchCV, RandomizedSearchCV<choose_model_class>
def get_pixels_hu(slices):
image = np.stack([s.pixel_array for s in slices])
 image = image.astype(np.int16)
 image[image == -2000] = 0
for slice_number in range(len(slices)) :
intercept = slices[slice_number].RescaleIntercept
slope = slices[slice_number].RescaleSlope
if slope != 1:
image[slice_number] = slope * image[slice_number].astype(np.float64)
 image[slice_number] = image[slice_number].astype(np.int16)
 image[slice_number] += np.int16(intercept)
 return np.array(image, dtype=np.int16 )
xgb = XGBClassifier(n_jobs=-1)
 param_grid = {
'n_estimators' :[100,150,200,250,300],
"learning_rate" : [0.001,0.01,0.0001,0.05, 0.10 ],
"gamma" : [ 0.0, 0.1, 0.2 , 0.3 ],
"colsample_bytree" : [0.5,0.7],
'max_depth': [3,4,6,8]
}<choose_model_class>
first_patient_scan = load_scan(train_dir + patient_ids[0] )
xgb_randomgrid = RandomizedSearchCV(xgb, param_distributions=param_grid, cv=5 )<train_model>
def set_lungwin(img, hu=[-1200., 600.]):
lungwin = np.array(hu)
 newimg =(img-lungwin[0])/(lungwin[1]-lungwin[0])
 newimg[newimg < 0] = 0
newimg[newimg > 1] = 1
newimg =(newimg * 255 ).astype('uint8')
 return newimg
%%time
xgb_randomgrid.fit(X_train,y_train )<find_best_params>
first_patient_scan_array = set_lungwin(get_pixels_hu(first_patient_scan))
best_est = xgb_randomgrid.best_estimator_<predict_on_test>
imageio.mimsave("/tmp/gif.gif", first_patient_scan_array, duration=0.00001)
 Image(filename="/tmp/gif.gif", format='png' )
y_pred = best_est.predict_proba(X_train)
 y_pred = y_pred[:,1]<predict_on_test>
def segment_lung_mask(image):
segmented = np.zeros(image.shape)
 for n in range(image.shape[0]):
binary_image = np.array(image[n] > -320, dtype=np.int8)+1
labels = measure.label(binary_image)
 background_label_1 = labels[0,0]
background_label_2 = labels[0,-1]
background_label_3 = labels[-1,0]
background_label_4 = labels[-1,-1]
binary_image[background_label_1 == labels] = 2
binary_image[background_label_2 == labels] = 2
binary_image[background_label_3 == labels] = 2
binary_image[background_label_4 == labels] = 2
selem = disk(4)
 binary_image = closing(binary_image, selem)
 binary_image -= 1
binary_image = 1-binary_image
segmented[n] = binary_image.copy() * image[n]
return segmented
X_test = test.drop('SeriousDlqin2yrs',1)
 y_test=best_est.predict_proba(X_test)
 y_test= y_test[:,1]<feature_engineering>
segmented_lungs = segment_lung_mask(first_patient_pixels )
sampleEntry["Probability"]=y_test
sampleEntry.head()<save_to_csv>
train_df.reset_index(inplace = True , drop = True)
 patient_df.reset_index(inplace = True , drop = True)
 test_df.reset_index(inplace = True , drop = True )
sampleEntry.to_csv("submission.csv",index=False )<import_modules>
from imblearn.over_sampling import SMOTE<train_model>
Dropout_model = 0.38559
FVC_weight = 0.2
Confidence_weight = 0.15
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.compat.v1.Session(config=config )
smote = SMOTE(random_state=0)
 os_data_X,os_data_y=smote.fit_sample(X_train,y_train )<define_search_space>
def get_efficientnet(model, shape):
models_dict = {
'b0': efn.EfficientNetB0(input_shape=shape,weights=None,include_top=False),
'b1': efn.EfficientNetB1(input_shape=shape,weights=None,include_top=False),
'b2': efn.EfficientNetB2(input_shape=shape,weights=None,include_top=False),
'b3': efn.EfficientNetB3(input_shape=shape,weights=None,include_top=False),
'b4': efn.EfficientNetB4(input_shape=shape,weights=None,include_top=False),
'b5': efn.EfficientNetB5(input_shape=shape,weights=None,include_top=False),
'b6': efn.EfficientNetB6(input_shape=shape,weights=None,include_top=False),
'b7': efn.EfficientNetB7(input_shape=shape,weights=None,include_top=False)
 }
return models_dict[model]
rfc = RandomForestClassifier(n_jobs=-1, max_features='sqrt')
 param_grid = {
"n_estimators" : [9, 18, 27, 36, 100, 150],
"max_depth" : [2,3,5,7,9],
"min_samples_leaf" : [2, 4]}<choose_model_class>
def build_model(shape=(512, 512, 1), model_class=None):
inp = Input(shape=shape)
 base = get_efficientnet(model_class, shape)
 x = base(inp)
 x = GlobalAveragePooling2D()(x)
 inp2 = Input(shape=(5,))
x2 = tf.keras.layers.GaussianNoise(0.2 )(inp2)
 x = Concatenate()([x, x2])
 x = Dropout(Dropout_model )(x)
 x = Dense(1 )(x)
 model = Model([inp, inp2] , x)
 return model
rfc_randomgrid = RandomizedSearchCV(rfc, param_distributions=param_grid, cv=5 )<train_model>
model_classes = ['b5']
models = [build_model(shape=(512, 512, 1), model_class=m)for m in model_classes]
print('Number of models: ' + str(len(models)) )
rfc_randomgrid.fit(os_data_X,os_data_y )<find_best_params>
BATCH_SIZE=128
best_est1 = rfc_randomgrid.best_estimator_<predict_on_test>
submission_df['Patient'] = submission_df['Patient_Week'].apply(lambda x:x.split('_')[0])
 submission_df['Weeks'] = submission_df['Patient_Week'].apply(lambda x: int(x.split('_')[-1]))
submission_df = submission_df[['Patient','Weeks','Confidence','Patient_Week']]
submission_df = submission_df.merge(test_df.drop('Weeks', axis=1), on="Patient")
 submission_df.head()
y_pred1 = best_est1.predict_proba(X_train)
 y_pred1 = y_pred1[:,1]<predict_on_test>
train_df['WHERE'] = 'train'
test_df['WHERE'] = 'val'
submission_df['WHERE'] = 'test'
data = train_df.append([test_df, submission_df])
 print(colored('Train data set shape.......: ','yellow'), train_df.shape)
 print(colored('Test data set shape........ : ','green'), test_df.shape)
 print(colored('Submission data set shape.. : ','blue'), submission_df.shape)
 print(colored('Comibined data set shape...: ','red'), data.shape)
 print("
")
 print(colored('Unique Patient in Train data set shape.......: ','yellow'), train_df.Patient.nunique())
 print(colored('Unique Patient in Test data set shape........ : ','green'), test_df.Patient.nunique())
 print(colored('Unique Patient in Submission data set shape.. : ','blue'), submission_df.Patient.nunique())
 print(colored('Unique Patient in Comibined data set shape...: ','red'), data.Patient.nunique() )
y_test1=best_est1.predict_proba(X_test)
 y_test1= y_test1[:,1]<feature_engineering>
data['min_week'] = data['Weeks']
data.loc[data.WHERE=='test','min_week'] = np.nan
data['min_week'] = data.groupby('Patient')['min_week'].transform('min' )
sampleEntry["Probability"]=y_test1
sampleEntry.head()<save_to_csv>
base = data.loc[data.Weeks == data.min_week]
base = base[['Patient','FVC']].copy()
base.columns = ['Patient','min_FVC']
base['nb'] = 1
base['nb'] = base.groupby('Patient')['nb'].transform('cumsum')
 base = base[base.nb==1]
base.drop('nb', axis=1, inplace=True )
sampleEntry.to_csv("submission1.csv",index=False )<import_modules>
data = data.merge(base, on='Patient', how='left')
 data['base_week'] = data['Weeks'] - data['min_week']
del base
from sklearn.neighbors import KNeighborsClassifier<import_modules>
COLS = ['Sex','SmokingStatus']
features = []
for col in COLS:
for mod in data[col].unique() :
features.append(mod)
 data[mod] =(data[col] == mod ).astype(int )
from sklearn.neighbors import KNeighborsClassifier<import_modules>
data['age'] =(data['Age'] - data['Age'].min())/(data['Age'].max() - data['Age'].min())
 data['BASE'] =(data['min_FVC'] - data['min_FVC'].min())/(data['min_FVC'].max() - data['min_FVC'].min())
 data['week'] =(data['base_week'] - data['base_week'].min())/(data['base_week'].max() - data['base_week'].min())
 data['percent'] =(data['Percent'] - data['Percent'].min())/(data['Percent'].max() - data['Percent'].min())
 data['FVC_Percent'] = data['FVC'] / data['Percent']
features += ['age','percent','week','BASE']
print(features )
from sklearn.neighbors import KNeighborsClassifier<choose_model_class>
train_df = data.loc[data.WHERE=='train']
test_df = data.loc[data.WHERE=='val']
submission_df = data.loc[data.WHERE=='test']
del data
knn = KNeighborsClassifier(n_neighbors=3 )<train_model>
C1, C2 = tf.constant(70, dtype='float32'), tf.constant(1000, dtype="float32")
 def score(y_true, y_pred):
tf.dtypes.cast(y_true, tf.float32)
 tf.dtypes.cast(y_pred, tf.float32)
 sigma = y_pred[:, 2] - y_pred[:, 0]
fvc_pred = y_pred[:, 1]
sigma_clip = tf.maximum(sigma, C1)
 delta = tf.abs(y_true[:, 0] - fvc_pred)
 delta = tf.minimum(delta, C2)
 sq2 = tf.sqrt(tf.dtypes.cast(2, dtype=tf.float32))
metric =(delta / sigma_clip)*sq2 + tf.math.log(sigma_clip* sq2)
 return K.mean(metric )
knn.fit(X_train,y_train )<predict_on_test>
def qloss(y_true, y_pred):
qs = [0.2, 0.50, 0.8]
q = tf.constant(np.array([qs]), dtype=tf.float32)
 e = y_true - y_pred
v = tf.maximum(q*e,(q-1)*e)
 return K.mean(v )
y_pred2 = knn.predict_proba(X_train)
 y_pred2 = y_pred2[:,1]<choose_model_class>
def mloss(_lambda):
def loss(y_true, y_pred):
return _lambda * qloss(y_true, y_pred)+(1 - _lambda)*score(y_true, y_pred)
 return loss
md_KNN = KNeighborsClassifier()
neighbors = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
param_grid = dict(n_neighbors=neighbors )<choose_model_class>
def make_model(no_feature):
z = L.Input(( no_feature,), name="Patient")
 x = L.Dense(100, activation="relu", name="d1" )(z)
 x = L.Dense(100, activation="relu", name="d2" )(x)
 p1 = L.Dense(3, activation="linear", name="p1" )(x)
 p2 = L.Dense(3, activation="relu", name="p2" )(x)
 preds = L.Lambda(lambda x: x[0] + tf.cumsum(x[1], axis=1), name="preds" )([p1, p2])
 model = M.Model(z, preds, name="CNN")
 model.compile(loss=mloss(0.65), optimizer=tf.keras.optimizers.Adam(lr=0.1, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0.01, amsgrad=False), metrics=[score])
 return model
KNN_GridSearch = GridSearchCV(md_KNN,param_grid=param_grid,cv=10 )<train_model>
print(colored('Features for model building : ','yellow'),features)
 y = train_df['FVC'].values
X = train_df[features].values
ze = submission_df[features].values
print(colored('Training data set shape for model building : ','yellow'),X.shape)
 print(colored('Shape of submission.csv: ','yellow'),ze.shape)
 nh = X.shape[1]
print(colored('Number of features : ','yellow'),nh)
 pe = np.zeros(( ze.shape[0], 3))
pred = np.zeros(( X.shape[0], 3))
KNN_GridSearch.fit(X_train,y_train )<find_best_params>
NFOLD = 5
kf = KFold(n_splits=NFOLD)
 cnt = 0
EPOCHS = 855
for tr_idx, val_idx in kf.split(X):
cnt += 1
print("
")
 print(colored('Fold...........: ','red'),cnt)
 net = make_model(nh)
 net.fit(X[tr_idx], y[tr_idx], batch_size=BATCH_SIZE, epochs=EPOCHS, validation_data=(X[val_idx], y[val_idx]), verbose=0)
 print(colored('Train.......... : ','yellow'),"train", net.evaluate(X[tr_idx], y[tr_idx], verbose=0, batch_size=BATCH_SIZE))
print(colored('Validation............ : ','yellow'),"val", net.evaluate(X[val_idx], y[val_idx], verbose=0, batch_size=BATCH_SIZE))
print(colored('Predict Validation.. : ','yellow'))
pred[val_idx] = net.predict(X[val_idx], batch_size=BATCH_SIZE, verbose=0)
 print(colored('Predict Test...: ','yellow'))
pe += net.predict(ze, batch_size=BATCH_SIZE, verbose=0)/ NFOLD
best_est2=KNN_GridSearch.best_estimator_<predict_on_test>
sigma_opt = mean_absolute_error(y, pred[:, 1])
 unc = pred[:,2] - pred[:, 0]
sigma_mean = np.mean(unc)
 print(sigma_opt, sigma_mean)
 print(unc.min() , unc.mean() , unc.max() ,(unc>=0 ).mean() )
y_pred3 = best_est2.predict_proba(X_train)
 y_pred3 = y_pred3[:,1]<predict_on_test>
submission_df['FVC1'] = 1.*pe[:, 1]
submission_df['Confidence1'] = pe[:, 2] - pe[:, 0]
subm = submission_df[['Patient_Week','FVC','Confidence','FVC1','Confidence1']].copy()
subm.loc[~subm.FVC1.isnull() ].head(10 )
y_test2=best_est2.predict_proba(X_test)
 y_test2= y_test2[:,1]<feature_engineering>
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']
sampleEntry["Probability"]=y_test2
sampleEntry.head()<save_to_csv>
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
sampleEntry.to_csv("submission2.csv",index=False )<load_from_csv>
subm[["Patient_Week","FVC","Confidence"]].to_csv("submission_regression.csv", index=False )
PATH = 'competitive-data-science-predict-future-sales'
items = pd.read_csv('.. /input/' + PATH + '/items.csv')
 shops = pd.read_csv('.. /input/' + PATH + '/shops.csv')
 cats = pd.read_csv('.. /input/' + PATH + '/item_categories.csv')
 train = pd.read_csv('.. /input/' + PATH + '/sales_train.csv')
 test = pd.read_csv('.. /input/' + PATH + '/test.csv' ).set_index('ID')
 print('------------- train info ------------'); print(train.info() , '
')
 print('------------- test info ------------'); print(test.info() , '
')
 print('------------- items info ------------'); print(items.info() , '
')
 print('------------- shops info ------------'); print(shops.info() , '
')
 print('------------- categories info ------------'); print(cats.info() , '
' )<count_missing_values>
reg_sub = subm[["Patient_Week","FVC","Confidence"]].copy()
print(train.isna().sum() , '
')
 print(test.isna().sum() )<feature_engineering>
df1 = img_sub.sort_values(by=['Patient_Week'], ascending=True ).reset_index(drop=True)
 df2 = reg_sub.sort_values(by=['Patient_Week'], ascending=True ).reset_index(drop=True )
train = train[train.item_price > 0].reset_index(drop=True)
 train[train.item_cnt_day <= 0].item_cnt_day.unique()
train.loc[train.item_cnt_day < 1, 'item_cnt_day'] = 0<feature_engineering>
df = df1[['Patient_Week']].copy()
df['FVC'] = FVC_weight*df1['FVC'] +(1-FVC_weight)*df2['FVC']
df['Confidence'] = Confidence_weight*df1['Confidence'] +(1-Confidence_weight)*df2['Confidence']
df.head()
<feature_engineering><EOS> 
df.to_csv('submission.csv', index=False )