-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegression.py
34 lines (24 loc) · 1007 Bytes
/
Regression.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
from NeuralNetwork.NeuralArchitecture import *
from NeuralNetwork.GradientOptimization import *
from NeuralNetwork.datasets import *
np.random.seed(5)
X = np.random.randn(1,60000)
Y = X**2
layers_dims = [1,10,1]
activation_list = ["relu","linear"]
nn_model = Neural_Architecture(layers_dims,activation_list,
cost_type="msel",
A_type="xavier",
Reg_type="l2",
lambd =0.05)
optim = Set_Optimization_Attribute(X, Y, nn_model,
optimizer="adam",
lr=0.3,
num_epochs = 800,
mini_batch_size = 0,
beta1=0.9,
beta2=0.99)
optim.optimize(print_cost_at=100,plot_cost=True)
Y_predicted = Neural_Architecture.feed_forward(nn_model,np.array([[5,4,0.2]]))
print(Y_predicted)
plt.show()