forked from zenith1598/Cancer-Treatment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathML Training.py
79 lines (32 loc) · 1.05 KB
/
ML Training.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import math
import numpy as np
import h5py
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.python.framework import ops
from sklearn import preprocessing
from sklearn.preprocessing import OneHotEncoder
from tf_utils import load_dataset, convert_to_one_hot
from backwardPropagation import model
from keras.utils import to_categorical
X_train, X_test, y_train, y_test = load_dataset()
# Take transpose of the input data and also normalize it
X_train = X_train.T
X_train = (X_train - X_train.mean()) / (X_train.max() - X_train.min())
X_train = X_train.fillna(0)
X_test = X_test.T
X_test = (X_test - X_test.mean()) / (X_test.max() - X_test.min())
X_test = X_test.fillna(0)
# Convert training and test labels to one hot matrices
y_train = to_categorical(y_train,9)
y_train = y_train.T
#print(y_train)
#print(y_train.shape)
y_test = to_categorical(y_test,9)
y_test = y_test.T
#print(X_train)
#print(y_train)
#print(X_test)
#print(y_test)
parameters = model(X_train,y_train,X_test,y_test)
print(parameters["W1"])