#!/usr/bin/env python
# coding: utf-8

# In[1]:


import os
import pandas as pd
import numpy as np


# In[3]:


os.chdir('C:/Users/HP/Desktop/ML Assignments')
traindata = pd.read_csv('train.csv')
testdata = pd.read_csv('test.csv')


# In[4]:


traindata.head()


# In[5]:


testdata.head()


# In[6]:


traindata.isnull().sum()


# In[7]:


testdata.isnull().sum()


# In[8]:


from sklearn.linear_model import LogisticRegression
logreg = LogisticRegression()

X = traindata.drop(['TARGET'],1)
y = traindata['TARGET']

from sklearn.model_selection import train_test_split as tts
X_train, X_val, y_train, y_val = tts(X, y, random_state = 42, test_size = 0.2)

model_fit = logreg.fit(X_train, y_train)
y_pred = logreg.predict(X_val)

model_fit.score(X_val, y_val)


# In[9]:


from sklearn.model_selection import cross_val_score
cross_val_score(logreg, X, y, cv = 10).mean()
