Kaggle competition: Aerial Cactus Identification
le = LabelEncoder()
training_data[["Ticket"]] = le.fit_transform(training_data[["Ticket"]] ).ravel()
training_data[["Embarked"]] = le.fit_transform(training_data[["Embarked"]] ).ravel()
testing_data[["Ticket"]] = le.fit_transform(testing_data[["Ticket"]])
 testing_data[["Embarked"]] = le.fit_transform(testing_data[["Embarked"]] )<drop_column>
train = pd.read_csv('.. /input/train.csv')
 test_file = pd.read_csv('.. /input/sample_submission.csv')
train_data = training_data.drop(['PassengerId','Name','Cabin','Survived'],axis = 1)
 survived = training_data['Survived']
test_data = testing_data.drop(['PassengerId','Name','Cabin'], axis = 1 )<split>
learn = cnn_learner(train_img , models.densenet201, metrics = [error_rate,accuracy] )
X_train, X_test, y_train, y_test = train_test_split(train_data, survived, test_size=0.2, random_state=42 )<choose_model_class>
learn.lr_find()
lgbm = lgb.LGBMClassifier(max_depth = 8,
num_leaves=90,
lambda_l1 = 0.1,
lambda_l2 = 0.01,
learning_rate = 0.01,
max_bin= 350,
n_estimators = 600,
reg_alpha = 1.6,
colsample_bytree = 0.9,
subsample = 0.9,
n_jobs = 6)
 lgbm.fit(X_train,y_train)
 pred = lgbm.predict(test_data )<save_to_csv>
alpha = 3e-02
learn.fit_one_cycle(5,slice(alpha))
submission = pd.DataFrame({"PassengerId": testing_data["PassengerId"],"Survived": pred})
 submission.to_csv('submission.csv',index= False )<set_options>
preds,_ = learn.get_preds(ds_type = DatasetType.Test)
%matplotlib inline
warnings.filterwarnings("ignore")
<load_from_csv>
test_file.has_cactus = preds.numpy() [:,0]
<create_dataframe><EOS> 
test_file.to_csv('submission.csv',index=False )