Kaggle competition: Предсказание положения космических объектов
<SOS> metric: smape Kaggle data source: sputnik<feature_engineering>
warnings.filterwarnings('ignore')
 %matplotlib inline
train_df = titanic_data.loc[0:890]
train_df['Survived'] = train_results
test_df = titanic_data.loc[891:1308]<prepare_x_and_y>
sputnik_data = pd.read_csv(".. /input/sputnik/train.csv",sep=",")
 sputnik_data
X=train_df.drop(['Survived'],axis=1)
 X.head()
y=train_df.Survived
y.head() 
<split>
sputnik_train = sputnik_data.dropna(inplace=False)
 sputnik_train['error'] = np.linalg.norm(sputnik_train[['x', 'y', 'z']].values - sputnik_train[['x_sim', 'y_sim', 'z_sim']].values, axis=1)
 sputnik_train.drop('x',axis=1,inplace=True)
 sputnik_train.drop('y',axis=1,inplace=True)
 sputnik_train.drop('z',axis=1,inplace=True)
 sputnik_train.drop('x_sim',axis=1,inplace=True)
 sputnik_train.drop('y_sim',axis=1,inplace=True)
 sputnik_train.drop('z_sim',axis=1,inplace=True)
 sputnik_train['epoch'] = pd.to_datetime(sputnik_train.epoch,format='%Y-%m-%d %H:%M:%S')
 sputnik_train.index = sputnik_train.epoch
sputnik_train.drop('epoch', axis = 1, inplace = True )
<train_model>
submission = validation_forecast(0 )
xgbr=XGBClassifier(n_estimators=2800,
min_child_weight=0.1,
learning_rate=0.002,
max_depth=2,
subsample=0.47,
colsample_bytree=0.35,
gamma=0.4,
reg_lambda=0.4,
random_state=42,
n_jobs=-1,)
 xgbr.fit(X,y)
 predicts=xgbr.predict(test_df)
<save_to_csv>
for i in tqdm(range(1,600)) :
submission = pd.concat([submission,validation_forecast(i)] )
submission = pd.DataFrame({
"PassengerId": test_data["PassengerId"],
"Survived": predicts
})
 submission.Survived = submission.Survived.round().astype("int")
 submission.to_csv('titanic.csv', index=False)
 print("Submitted Successfully")
<set_options>
frame = submission.to_frame()
%matplotlib inline
warnings.filterwarnings('ignore')
<load_from_csv>
frame.columns = ['error']
<categorify><EOS> 
frame.to_csv('submit.csv' )