Skip to content

Commit 9d3f835

Browse files
authored
Add files via upload
1 parent fb92753 commit 9d3f835

File tree

6 files changed

+33097
-0
lines changed

6 files changed

+33097
-0
lines changed

1log.py

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
"""
4+
Created on Sun Jul 7 12:02:30 2019
5+
6+
@author: aman
7+
"""
8+
9+
"""
10+
Logistic regression produce a result in binary format which
11+
is used to predict the outcome of caategorical dependdent
12+
variable. So the output should be discreat or categorical
13+
classification family of algo are mostly of two type
14+
probablistic and determinstic
15+
logistic regression bellong to probabilstic family of
16+
classifiction
17+
"""
18+
19+
20+
import numpy as np
21+
import pandas as pd
22+
import matplotlib.pyplot as plt
23+
24+
25+
x = np.arange(-10,10,0.01)
26+
27+
sig = 1/(1+np.power(np.e,-x))
28+
29+
30+
plt.plot(x,sig)
31+
plt.show()
32+
33+
#y = mx+c
34+
lin= 3*x+7
35+
36+
plt.plot(x,lin)
37+
plt.show()
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+

2log.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
"""
4+
Created on Sun Jul 7 12:37:14 2019
5+
6+
@author: aman
7+
"""
8+
import numpy as np
9+
import pandas as pd
10+
import matplotlib.pyplot as plt
11+
12+
from sklearn.datasets import load_breast_cancer
13+
dataset=load_breast_cancer()
14+
15+
X = dataset.data
16+
y = dataset.target
17+
18+
19+
from sklearn.model_selection import train_test_split
20+
X_train, X_test,y_train,y_test= train_test_split(X,y,test_size=0.2)
21+
22+
23+
from sklearn.linear_model import LogisticRegression
24+
log = LogisticRegression()
25+
log.fit(X_train,y_train)
26+
27+
y_pred=log.predict(X_test)
28+
29+
30+
log.score(X_test,y_test)
31+
32+
33+
34+
35+
from sklearn.metrics import confusion_matrix
36+
37+
confusion_matrix(y_pred,y_test)
38+
39+
40+
41+
42+
43+

3log.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
"""
4+
Created on Sun Jul 7 13:10:03 2019
5+
6+
@author: aman
7+
"""
8+
9+
import numpy as np
10+
import pandas as pd
11+
import matplotlib.pyplot as plt
12+
13+
14+
data = pd.read_csv("/home/aman/Desktop/ML/suv.csv")
15+
data
16+
17+
X = data.iloc[:,[2,3]].values
18+
y = data.iloc[:,4]
19+
20+
21+
from sklearn.preprocessing import StandardScaler
22+
#from sklearn.impute import SimpleImputer
23+
sc = StandardScaler()
24+
X = sc.fit_transform(X)
25+
26+
from sklearn.model_selection import train_test_split
27+
X_train , X_test,y_train,y_test=train_test_split(X,y,test_size =0.2)
28+
29+
30+
from sklearn.linear_model import LogisticRegression
31+
log = LogisticRegression()
32+
log.fit(X_train,y_train)
33+
34+
y_pred = log.predict(X_test)
35+
36+
log.score(X_test,y_test)
37+
38+
39+
from sklearn.metrics import confusion_matrix
40+
confusion_matrix(y_pred,y_test)
41+
42+
43+

blood.xlsx

8.77 KB
Binary file not shown.

0 commit comments

Comments
 (0)