Kaggle competition: Titanic - Machine Learning from Disaster
o_train = pd.read_csv(".. /input/train.csv")
 o_valid = pd.read_csv(".. /input/valid.csv")
 train = pd.read_csv(".. /input/train.csv")
 valid = pd.read_csv(".. /input/valid.csv")
 data = pd.concat([train, valid], sort=False)
 example_sub = pd.read_csv(".. /input/sample_submission.csv" )<filter>
train_data = pd.read_csv('/kaggle/input/titanic/train.csv')
 test_data = pd.read_csv('/kaggle/input/titanic/test.csv' )
train[train.ID == 5022].article_link<filter>
features = ['Pclass','Sex','SibSp','Parch','Fare','Age']
x = pd.get_dummies(train_data[features])
 x_test = pd.get_dummies(test_data[features])
 y = train_data["Survived"]
sarcastic = len(train[train.is_sarcastic == 1])
 non_sarcastic = len(train[train.is_sarcastic == 0])
 sarcastic /(non_sarcastic + sarcastic )<filter>
x['Fare'].fillna(x['Fare'].mode() [0], inplace=True)
 x_test['Fare'].fillna(x_test['Fare'].mode() [0], inplace=True)
 x['Age'].fillna(x['Age'].mode() [0], inplace=True)
 x_test['Age'].fillna(x_test['Age'].mode() [0], inplace=True)
print(np.where(pd.isnull(train)))
 print(np.where(pd.isna(train)))
 np.where(train.applymap(lambda x: x == ''))<choose_model_class>
param_grid = {'alpha': sp_rand() }
model = Ridge()
rsearch = RandomizedSearchCV(estimator=model, param_distributions=param_grid, n_iter=100)
 rsearch.fit(x,y)
 print(rsearch )
sarcasm_classfication = Pipeline([ 
('vect', CountVectorizer()), 
('tfidf', TfidfTransformer()), 
('classify', LinearSVC(C=1))
] )<split>
output = pd.DataFrame({'PassengerId': test_data.PassengerId, 'Survived': y_pred})
 output.to_csv('submission3.csv', index=False)
 print("Your submission was successfully saved!" )