Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

DATA SCIENCE LAB

Assignment: Stock Market Prediction using Neural Networks


Name: Vemula Yaminee Jyothsna
Roll no: 20BM6JP44

INTRODUCTION:

There are 5 datasets given. In each dataset Close the output column, which we have to predict using
Regression. Column Date and Name are dropped. Remaining columns are taken has input into the
model.

The sklearn library used is MLPRegressor.

This Library has following parameters:

• Hidden_layer_sizes
Default value = 100. The ith element represents the number of neurons in the ith hidden
layer
• Activation
Activation function for the hidden layer.
‘identity’, no-op activation, useful to implement linear bottleneck, returns f(x) = x
‘logistic’, the logistic sigmoid function, returns f(x) = 1 / (1 + exp(-x)).
‘tanh’, the hyperbolic tan function, returns f(x) = tanh(x).
‘relu’, the rectified linear unit function, returns f(x) = max(0, x)
• Solver
The solver for weight optimization.
‘lbfgs’ is an optimizer in the family of quasi-Newton methods.
‘sgd’ refers to stochastic gradient descent.
‘adam’ refers to a stochastic gradient-based optimizer
• Learning_rate
Learning rate schedule for weight updates.
‘constant’ is a constant learning rate given by ‘learning_rate_init’.
‘invscaling’ gradually decreases the learning rate learning_rate_ at each time step ‘t’ using
an inverse scaling exponent of ‘power_t’. effective_learning_rate = learning_rate_init /
pow(t, power_t)
‘adaptive’ keeps the learning rate constant to ‘learning_rate_init’ as long as training loss
keeps decreasing. Each time two consecutive epochs fail to decrease training loss by at least
tol, or fail to increase validation score by at least tol if ‘early_stopping’ is on, the current
learning rate is divided by 5.
Only used when solver=’sgd’.

Experimentation setup:
Below mentioned R2 scores are calculated by doing above mentioned parameters of the
model.
Reading for Processed_NASDAQ:

Parameters R2 value
Default parameters 0.989
Lbfgs, identity,200 0.990
Sgd, relu, constant,300 -7.497
Adam, relu,100 -10.38
Lbfgs, tanh,100 -0.0019
Lbfgs, logistic,100 -0.0019
Lbfgs, identity,300 0.990
Adam, relu, 300 0.989
Sgd, relu, adaptive, 100 -0.0019
Sgd, relu, constant, 50 -0.0019

Reading for Processed_DJI:

Parameters R2 value
Default parameters 0.985
Lbfgs, identity,200 0.986
Sgd, relu, constant,300 -8.174
Adam, relu,100 -22.15
Lbfgs, tanh,100 -0.0017
Lbfgs, logistic,100 -0.0017
Lbfgs, identity,300 0.988
Adam, relu, 300 0.988
Sgd, relu, adaptive, 100 -0.0017
Sgd, relu, constant, 50 -0.0017

Observation:

• For all other datasets the R2 scores are almost similar.


• With increase in hidden_layer_size and parameter solver not equal to sgd the R2 value
becomes positive and reaches 1.
• If parameter solver is sgd the R2 value increases with decrease in hidden_later_size.

You might also like