Kaggle competition: Indoor Location & Navigation
<set_options><EOS> 
import pandas as pd
import numpy as np
<SOS> metric: IndoorLocalization Kaggle data source: indoor-location-&-navigation<define_variables>
import pandas as pd
import numpy as np
TARGETS_SUB = [TARGETS]<merge>
data_path_list = [
".. /input/indoor-gbm-postprocessing-xy-prediction/submission.csv",
".. /input/wifi-features-with-lightgbm-kfold/submission.csv",
".. /input/simple-99-accurate-floor-model/submission.csv"
]
position_weights = np.array([
0.9,
0.1,
0
])
 floor_weights = np.array([
0,
0,
1
])
 position_weights = position_weights / np.sum(position_weights)
 floor_weights = floor_weights / np.sum(floor_weights )
positive_threshold = 20
count_positive_by_feature = train_targets_scored.sum(axis=0)[1:]
low_positive_by_feature = list(count_positive_by_feature[count_positive_by_feature <= positive_threshold].index)
 for feature in low_positive_by_feature:
train_targets_scored_sub = train_targets_scored[train_targets_scored[feature] == 1]
train_features_sub = train_features.merge(train_targets_scored_sub, on='sig_id')
 train_features_sub_list = []
copy_time = int(positive_threshold / len(train_targets_scored_sub)) + 1
for ij in range(copy_time):
train_features_sub_copy = train_features_sub.copy()
train_features_sub_copy['key'] = train_features_sub_copy['sig_id'] + str(ij)
 train_features_sub_list.append(train_features_sub_copy)
 train_features_sub_fake = pd.concat(train_features_sub_list)
 train_features_sub_fake['sig_id'] = train_features_sub_fake['key']
train_features_sub_fake = train_features_sub_fake.drop(['key'], axis=1)
 train_features = pd.concat([train_features, train_features_sub_fake[train_features.columns]])
 train_targets_scored = pd.concat([train_targets_scored, train_features_sub_fake[train_targets_scored.columns]])
 train_features = train_features.reset_index(drop=True)
 train_targets_scored = train_targets_scored.reset_index(drop=True )<feature_engineering>
df_list = [pd.read_csv(d)for d in data_path_list]
<categorify><EOS> 
sub = pd.read_csv(".. /input/indoor-location-navigation/sample_submission.csv")
 sub.floor = df_list[np.argmax(floor_weights)].floor
sub.x = 0
sub.y = 0
for df, w in zip(df_list, position_weights):
sub[["x", "y"]] += df[["x", "y"]] * w
sub.to_csv("submission.csv", index=False )