Kaggle competition: Zillow Prize: Zillow’s Home Value Prediction (Zestimate)
<SOS> metric: ZillowMAE Kaggle data source: zillow-prize:-zillow’s-home-value-prediction-(zestimate)<save_to_csv>
ACTUALLY_DO_SOMETHING = True
CORRECT_FOR_BUG = True
submission_df.to_csv('submission.csv' )<load_from_csv>
from tqdm import tqdm
train_df = pd.read_csv('/kaggle/input/titanic/train.csv')
 test_df = pd.read_csv('/kaggle/input/titanic/test.csv')
 print(train_df.shape)
 print(test_df.shape )<drop_column>
import gzip
train_df['Dependent'] = train_df.Parch + train_df.SibSp
test_df['Dependent'] = test_df.Parch + test_df.SibSp
train_df = train_df.replace(['female','male'],[20,10])
 test_df = test_df.replace(['female','male'],[20,10])
 test_PassengerId = test_df.PassengerId
train_df.drop(columns=['Ticket', 'Fare', 'Cabin', 'Embarked','Name','Parch','SibSp','PassengerId'], inplace=True)
 test_df.drop(columns=['Ticket', 'Fare', 'Cabin', 'Embarked','Name','Parch','SibSp','PassengerId'], inplace=True )<data_type_conversions>
ff = 1.0
weights = [ 0.292, 0.165, 0.147, 0.200, 0.196 ]
train_label = train_df.Survived.to_numpy()
train_label = train_label.reshape(train_label.shape[0],1)
 train_df.drop(columns=['Survived'], inplace=True )<data_type_conversions>
print(sum(weights))
train_set = train_df.to_numpy()
test_set = test_df.to_numpy()
print("Training data Size : ", train_set.shape)
 print("Test data Size : ", test_set.shape )<data_type_conversions>
if CORRECT_FOR_BUG:
weights[1] /= 10
K.set_image_data_format('channels_last' )<choose_model_class>
fnames =('output_dataset2017a.csv',
'finalxgb20171015_145310.csv',
'2017Q4.csv',
'catboost_opt4.csv',
'simplad2017.csv')
 output="withSimpLADNoFudge.csv"
def FCModel(input_shape):
X_input = Input(input_shape)
 X = X_input
X = Dense(32, activation='relu', kernel_initializer=initializers.glorot_uniform(seed=0), kernel_regularizer=l2(0.001), bias_regularizer=l2(0.001))(X)
 X = Dense(16, activation='relu', kernel_initializer=initializers.glorot_uniform(seed=0), kernel_regularizer=l2(0.001), bias_regularizer=l2(0.001))(X)
 X = Dense(8, activation='relu', kernel_initializer=initializers.glorot_uniform(seed=0))(X)
 X = Dense(4, activation='relu', kernel_initializer=initializers.glorot_uniform(seed=0))(X)
 X = Dense(4, activation='relu', kernel_initializer=initializers.glorot_uniform(seed=0))(X)
 X = Dense(2, activation='softmax', name='fc7' )(X)
 model = Model(inputs = X_input, outputs = X, name='FCModel')
 return model<train_model>
if ACTUALLY_DO_SOMETHING:
for id, r in zip(ids,result):
fs.write(id)
 for j in range(6):
fs.write("," +str(round(r[j],6)))
 fs.write("
" )
MyModel = FCModel(train_set.shape[1:])
 MyModel.compile(optimizer = 'adam', loss = "sparse_categorical_crossentropy", metrics = ["accuracy"])
 taining_result = MyModel.fit(x = train_set*0.01, y = train_label, epochs = 150, validation_split= 0.1, batch_size = 20 )<save_model>
if ACTUALLY_DO_SOMETHING:
fs.close()
MyModel.save('TitanicPredict_SimpleNeuralNetwork.h5' )<predict_on_test>
if ACTUALLY_DO_SOMETHING:
f_in = open(output, 'rb')
 f_out = gzip.open(output+'.gz', 'wb')
 f_out.writelines(f_in)
 f_out.close()
f_in.close()
<create_dataframe><EOS> 
2+2