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

# In[12]:


import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn import datasets
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
from sklearn.metrics import confusion_matrix


# In[13]:


Iris = datasets.load_iris()


# In[14]:


iris = pd.DataFrame(Iris.data, columns=Iris.feature_names)
iris['target'] = Iris.target


# In[16]:


Iris


# In[17]:


x = iris_data.data 
y = iris_data.target 

xtrain, xtest, ytrain, ytest = train_test_split(x, y, test_size =0.2, 
                                                    random_state = 0) 
   
print("xtrain shape : ", xtrain.shape) 
print("xtest shape  : ", xtest.shape) 
print("ytrain shape : ", ytrain.shape) 
print("ytest shape  : ", ytest.shape)


# In[18]:


#Fitting Multi Linear regression model to training model 
lr =  LogisticRegression()
lr.fit(xtrain, ytrain)

# predicting the test set results 
y_pred = lr.predict(xtest)


# In[23]:


print('\nConfusion Matrix :\n', confusion_matrix(ytest, y_pred))


# In[24]:


print('Accuracy score: ', format(accuracy_score(ytest, y_pred)))
print('Precision score: ', format(precision_score(ytest, y_pred, average='micro')))


# In[25]:


from sklearn.linear_model import Ridge
clf = Ridge(alpha=1.0)
clf.fit(xtrain, ytrain)

# predicting the test set results 
y_pred = lr.predict(xtest)


# In[26]:


print('Accuracy score: ', format(accuracy_score(ytest, y_pred)))
print('Precision score: ', format(precision_score(ytest, y_pred, average='micro')))


# In[27]:


print('\nConfusion Matrix :\n', confusion_matrix(ytest, y_pred))


# Comparing 

# In[22]:


print('Accuracy score: ', format(accuracy_score(ytest, y_pred)))
print('Precision score: ', format(precision_score(ytest, y_pred, average='micro')))
print('Accuracy score: ', format(accuracy_score(ytest, y_pred)))
print('Precision score: ', format(precision_score(ytest, y_pred, average='micro')))


# In[ ]:
