Kaggle competition: Natural Language Processing with Disaster Tweets
test.isnull().sum()<drop_column>
df_train = pd.read_csv("/kaggle/input/nlp-getting-started/train.csv")
 df_test = pd.read_csv("/kaggle/input/nlp-getting-started/test.csv" )
for items in train.columns:
if train[items].std() == 0:
print(items)
 train.drop(items,axis = 1,inplace = True )<drop_column>
! pip uninstall torch torchvision -y
! pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
!pip install -U transformers
!pip install -U simpletransformers
test.drop("Soil_Type7",axis = 1,inplace = True)
 test.drop("Soil_Type15",axis = 1,inplace =True )<feature_engineering>
logging.basicConfig(level=logging.INFO)
 transformers_logger = logging.getLogger("transformers")
 transformers_logger.setLevel(logging.WARNING )
train["net_hyd_distance"]=np.sqrt(train["Vertical_Distance_To_Hydrology"]**2 + train["Horizontal_Distance_To_Hydrology"]**2)
 test["net_hyd_distance"]=np.sqrt(test["Vertical_Distance_To_Hydrology"]**2 + test["Horizontal_Distance_To_Hydrology"]**2 )<feature_engineering>
X = df_train['text']
y = df_train['target']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42, stratify=y )
train["mean_distance_aminity"] =(train["Horizontal_Distance_To_Hydrology"] + train["Horizontal_Distance_To_Roadways"] + train["Horizontal_Distance_To_Fire_Points"])/3
test["mean_distance_aminity"] =(test["Horizontal_Distance_To_Hydrology"] + test["Horizontal_Distance_To_Roadways"] + test["Horizontal_Distance_To_Fire_Points"])/3<feature_engineering>
train_df = pd.DataFrame(X_train)
 train_df['target'] = y_train
eval_df = pd.DataFrame(X_test)
 eval_df['target'] = y_test
train["closeness1"] = train["Horizontal_Distance_To_Hydrology"] - train["Horizontal_Distance_To_Roadways"]
train["closeness2"] = train["Horizontal_Distance_To_Hydrology"] - train["Horizontal_Distance_To_Fire_Points"]
train["closeness3"] = train["Horizontal_Distance_To_Roadways"] - train["Horizontal_Distance_To_Fire_Points"]
test["closeness1"] = test["Horizontal_Distance_To_Hydrology"] - test["Horizontal_Distance_To_Roadways"]
test["closeness2"] = test["Horizontal_Distance_To_Hydrology"] - test["Horizontal_Distance_To_Fire_Points"]
test["closeness3"] = test["Horizontal_Distance_To_Roadways"] - test["Horizontal_Distance_To_Fire_Points"]<prepare_x_and_y>
logging.basicConfig(level=logging.INFO)
 transformers_logger = logging.getLogger("transformers")
 transformers_logger.setLevel(logging.WARNING)

model = ClassificationModel('xlnet', 'xlnet-base-cased', args={'num_train_epochs':2, 'train_batch_size':16, 'max_seq_length':128})
 model.train_model(train_df)
 result, model_outputs, wrong_predictions = model.eval_model(eval_df, acc=sklearn.metrics.accuracy_score )
predictor = train.drop(["Id","Cover_Type"],axis = 1)
 target = train["Cover_Type"]<normalization>
predictions, raw_outputs = model.predict(df_test.text.tolist() )
<train_model><EOS> 
sample_sub=pd.read_csv("/kaggle/input/nlp-getting-started/sample_submission.csv")
 sample_sub['target'] = predictions
sample_sub.to_csv("submission_01092020_xlnet_base.csv", index=False )