在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Shikhar1998/Stock-Market-Prediction-using-Neural-Networks-and-Genetic-Algorithm开源软件地址(OpenSource Url):https://github.com/Shikhar1998/Stock-Market-Prediction-using-Neural-Networks-and-Genetic-Algorithm开源编程语言(OpenSource Language):MATLAB 100.0%开源软件介绍(OpenSource Introduction):Stock Market Prediction using Neural Networks and Genetic AlgorithmThis module employs Neural Networks and Genetic Algorithm to predict the future values of stock market. The test data used for simulation is from the Bombay Stock Exchange(BSE) for the past 40 years. 1. IntroductionStock market prediction is the “act of determining” the future value of a company stock or other financial instrument traded on an exchange. The successful prediction of a stock's future price could yield significant profit. The efficient-market hypothesis suggests that stock prices reflect all currently available information and any price changes that are not based on newly revealed information thus are inherently unpredictable. In this project, we have proposed a stock market prediction model using Genetic Algorithm and Neural Networks. This technique utilises seven distinct features as the input parameters for training, and gives ‘Closing Price’ of the stock as the output. The usage of neural networks for prediction is advantageous as they are able to learn from examples only and after their learning is finished, they are able to catch hidden and strongly non-linear dependencies, even when there is a significant noise in the training set.Genetic Algorithms are more suited for optimization problems. Hence, it is used to optimize the parameters of the Neural Network for more accurate predictions. A programming language must be combined with special tools that support the task that has to be performed, whether one is modelling data or analysing an image. Therefore, for this project, MATLAB is used as the MATLAB toolboxes offer professionally developed, rigorously tested and fully documented functionality for scientific and engineering applications. 2. Background2.1. Neural NetworkWhat is an Artificial Neural Network?An Artificial Neural Network (ANN) is an information processing paradigm that is inspired by the way biological nervous systems, such as the brain, process information. The key element of this paradigm is the novel structure of the information processing system. It is composed of a large number of highly interconnected processing elements (neurones) working in unison to solve specific problems. ANNs, like people, learn by example. An ANN is configured for a specific application, such as pattern recognition or data classification, through a learning process. Basic Structure of ANNsANNs are composed of multiple nodes, which imitate biological neurons of human brain. The neurons are connected by links and they interact with each other. The nodes can take input data and perform simple operations on the data. The result of these operations is passed to other neurons. The output at each node is called its activation or node value.Each link is associated with weight. ANNs are capable of learning, which takes place by altering weight values. The following illustration shows a simple ANN Feed Forward Neural Networks:The information flow is unidirectional. A unit sends information to other unit from which it does not receive any information. There are no feedback loops. They are used in pattern generation/recognition/classification. They have fixed inputs and outputs. Back Propagation Algorithm:It is the training or learning algorithm. It learns by example. If you submit to the algorithm the example of what you want the network to do, it changes the network’s weights so that it can produce desired output for a particular input on finishing the training.Back Propagation networks are ideal for simple Pattern Recognition and Mapping Tasks. 2.2. Genetic AlgorithmWhat is Genetic Algorithm?The genetic algorithm is a method for solving both constrained and unconstrained optimization problems that is based on natural selection, the process that drives biological evolution. The genetic algorithm repeatedly modifies a population of individual solutions. At each step, the genetic algorithm selects individuals at random from the current population to be parents and uses them to produce the children for the next generation. Over successive generations, the population "evolves" toward an optimal solution.The genetic algorithm uses three main types of rules at each step to create the next generation from the current population: • Selection rules select the individuals, called parents, that contribute to the population at the next generation. • Crossover rules combine two parents to form children for the next generation. • Mutation rules apply random changes to individual parents to form children. Outline of the Algorithm:
Genetic Algorithm Terminology• Fitness Functions: The fitness function is the function you want to optimize. For standard optimization algorithms, this is known as the objective function. The toolbox software tries to find the minimum of the fitness function. • Individuals: An individual is any point to which you can apply the fitness function. The value of the fitness function for an individual is its score. For example, if the • Populations and Generations: A population is an array of individuals. For example, if the size of the population is 100 and the number of variables in the fitness function is 3, you represent the population by a 100-by-3 matrix. The same individual can appear more than once in the population At each iteration, the genetic algorithm performs a series of computations on the current population to produce a new population. Each successive population is called a new generation. • Diversity Diversity refers to the average distance between individuals in a population. A population has high diversity if the average distance is large; otherwise it has low diversity. Diversity is essential to the genetic algorithm because it enables the algorithm to search a larger region of the space. • Fitness Values and Best Fitness Values The fitness value of an individual is the value of the fitness function for that individual. Because the toolbox software finds the minimum of the fitness function, the best fitness value for a population is the smallest fitness value for any individual in the population. • Parents and Children To create the next generation, the genetic algorithm selects certain individuals in the current population, called parents, and uses them to create individuals in the next generation, called children. Typically, the algorithm is more likely to select parents that have better fitness values.
3.1. FeaturesIn machine learning and pattern recognition, a feature is an individual measurable property or characteristic of a phenomenon being observed. Choosing informative, discriminating and independent features is a crucial step for effective algorithms in pattern recognition, classification and regression. The features used in this project are as follows:
The exponential moving average is a type of moving average that gives more weight to recent prices in an attempt to make it more responsive to new information. There are three steps to calculating an exponential moving average (EMA). First, calculate the simple moving average for the initial EMA value. An exponential moving average (EMA) has to start somewhere, so a simple moving average is used as the previous period's EMA in the first calculation. Second, calculate the weighting multiplier. Third, calculate the exponential moving average for each day between the initial EMA value and today, using the price, the multiplier, and the previous period's EMA value. 3.2. Training data and parameter valuesThe data used to train the neural network is the securities exchange on the Bombay Stock Exchange (BSE) for the time period Jan 1, 1996 to Jan 1 2016. The data used to test the neural network is from Jan 2016 to 31 July 2017. Table 1 and Table 2 provide details about the various parameters for optimisation using the Genetic Algorithm and Neural Networks. Parameter Name Value Population Size 50 Tournament Size 2 Crossover Fraction 0.8 Migration Fraction 0.2 Migration Interval 20 Table 1: Parameters used for Genetic Algorithm Parameter Name Value Training Gradient Descent with Momentum and Adaptive Learning Rate Performance Parameter Mean square Error Learning Rate 0.001 Maximum number of Epochs 8000 Table 2: Parameters used for Neural Networks For the neural network we have used the Gradient Descent with Momentum and Adaptive Learning Rate to achieve better optimisation results as compared to simple Gradient Descent algorithm. This algorithm tunes the learning rate automatically by observing the regression trace. The number of epochs was set to 8000 to achieve best possible results for each computation. 3.3. Procedure
Step 1: Calling the |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论