<jupyter_start><jupyter_text>Logistic Regression- binomial classification(2 categories)- multinomail classification(more than 2)     Advantages   - less computation- easy to implement- better for linear data   Disadvantages   - it does not work better for the non linear data<jupyter_code>import pandas as pd
df=pd.read_csv("diabetes.csv")
df.head()
x=df.iloc[:,0:8]
x.head()
y=df["Outcome"]
y.head()
df.isna().sum()
from sklearn.model_selection import train_test_split
x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=0.3,random_state=25)
x_train.shape
from sklearn.linear_model import LogisticRegression
model=LogisticRegression(multi_class)
model.fit(x_train,y_train)
y_predict=model.predict(x_test)
y_predict
model.predict([[0,137,40,35,168,43.1,2.288,33]])
from sklearn.metrics import accuracy_score
print(accuracy_score(y_test,y_predict))<jupyter_output>0.7878787878787878<jupyter_text>actual=[0,1,1,1,0]predicted=[1,1,1,0,0]                                    predicted values                 diabetes     not a diabetesActual valuesdiabetes             2       1not diabetes         1        1<jupyter_code>from sklearn.metrics import confusion_matrix
print(confusion_matrix(y_test,y_predict))
#### Support Vector Machine (SVM)
from sklearn.datasets import load_iris
iris_data=load_iris()
iris_data.keys()
import pandas as pd
df=pd.DataFrame(iris_data.data,columns=iris_data.feature_names)
df["Target"]=iris_data.target
df.head()
x=df.iloc[:,0:4]
x.head()
y=df["Target"]
y.head()
from sklearn.model_selection import train_test_split
x_train,x_test,y_train,y_test=train_test_split(x,y,train_size=0.7,random_state=42)
from sklearn.svm import SVC
model=SVC()
model.fit(x_train,y_train)
y_predict=model.predict(x_test)
y_predict
model.predict([[5.1,3.5,1.4,0.2]])
from sklearn.metrics import accuracy_score,confusion_matrix
print(accuracy_score(y_test,y_predict))
print(confusion_matrix(y_test,y_predict))<jupyter_output>[[19  0  0]
 [ 0 13  0]
 [ 0  0 13]]
{'fraction_non_alphanumeric': 0.11860111505321845, 'fraction_numerical': 0.04308160162189559, 'mean_word_length': 6.02491103202847, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '237889', 'license': 'CC0-1.0', 'n_tokens_mistral': 768, 'n_tokens_neox': 736, 'n_words': 125, 'path': 'Day-5/Day5_18sep2020.ipynb', 'repo_name': 'AP-State-Skill-Development-Corporation/Machine-Learning-Using-Python-14Sept2020-EB-5', 'size': '1973'}