-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinRegression.py
More file actions
31 lines (25 loc) · 864 Bytes
/
LinRegression.py
File metadata and controls
31 lines (25 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import numpy as np
import sklearn.linear_model as lm
#df = np.loadtxt("D:\Regression\data_set.txt", delimiter = ' ')
#print df
x_data = np.loadtxt("D:\Regression\input.txt", delimiter = ' ')
y_data = np.loadtxt("D:\Regression\output.txt")
<<<<<<< HEAD
test_data = np.loadtxt("D:/Regression/test_input.txt", delimiter = ' ')
#print test_data
skm = lm.LogisticRegression(solver='lbfgs')
skm.fit(x_data, y_data)
f = open('D:/Regression/our_output.txt', 'w')
for array in test_data:
prediction = skm.predict(array)
for element in prediction:
#print element
f.write(str(element) + '\n')
f.close()
=======
skm = lm.LogisticRegression(solver='lbfgs')
skm.fit(x_data, y_data)
prediction = skm.predict([3, 0])
print "Prediction"
print prediction
>>>>>>> branch 'master' of https://github.com/BruchesLena/Python.git