-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
45 lines (29 loc) · 899 Bytes
/
test.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from scratch import MyLinearRegression, MyLogisticRegression, MyPreProcessor
import numpy as np
preprocessor = MyPreProcessor()
print('Linear Regression')
X, y = preprocessor.pre_process(0)
# Create your k-fold splits or train-val-test splits as required
split = X.shape[0]//5
Xtrain = X[split:]
ytrain = y[split:]
Xtest = X[:split]
ytest = y[:split]
linear = MyLinearRegression()
linear.fit(Xtrain, ytrain)
ypred = linear.predict(Xtest)
print('Predicted Values:', ypred)
print('True Values:', ytest)
print('Logistic Regression')
X, y = preprocessor.pre_process(2)
# Create your k-fold splits or train-val-test splits as required
split = X.shape[0]//5
Xtrain = X[split:]
ytrain = y[split:]
Xtest = X[:split]
ytest = y[:split]
logistic = MyLogisticRegression()
logistic.fit(Xtrain, ytrain)
ypred = logistic.predict(Xtest)
print('Predicted Values:', ypred)
print('True Values:', ytest)