Abstract
Hierarchical Temporal Memory is a new type of artificial neural network model, which imitates the structure and information processing flow of the human brain. Hierarchical Temporal Memory has strong adaptability and fast learning ability and becomes a hot spot in current research. Hierarchical Temporal Memory obtains and saves the temporal characteristics of input sequences by the temporal pool learning algorithm. However, the current algorithm has some problems such as low learning efficiency and poor learning effect when learning time series data. In this paper, a temporal pool learning algorithm based on location awareness is proposed. The cell selection rules based on location awareness and the dendritic updating rules based on adjacent inputs are designed to improve the learning efficiency and effect of the algorithm. Through the algorithm prototype, three different datasets are used to test and analyze the algorithm performance. The experimental results verify that the algorithm can quickly obtain the complete characteristics of the input sequence. No matter whether there are similar segments in the sequence, the proposed algorithm has higher prediction recall and precision than the existing algorithms.
1. Introduction
Hierarchical Temporal Memory (HTM) is a new neural network model that simulates the organization and structure of cortical cells and the way the human brain processes information. HTM uses a large amount of sequence data for training [1]. By extracting and storing the patterns, HTM can predict the subsequent occurrence of the current input or detect whether the current input is abnormal. Therefore, HTM is widely applied in the analysis and processing of time series data. The basic unit of HTM is the cell. A number of cells constitute the minicolumn, and a large number of minicolumns form the network space of HTM. Spatial pool learning algorithm (SPL) and temporal pool learning algorithm (TPL) are two important learning steps of HTM. SPL establishes the mapping relationship between the input and the minicolumn set to form the sparse distributed representation (SDR) of inputs. TPL constructs or adjusts the corresponding dendrite branches among the cells to form a temporal correlation of inputs [2].
In the process of human learning, the human brain remembers many things. When given clues, the human brain can retrieve relevant knowledge with high efficiency. HTM works by imitating the way the human brain processes information. Using the memorized patterns, HTM can also efficiently obtain the complete pattern information by the clues. With SPL, the input can be quickly located and represented in HTM. TPL uses different combinations of active cells to express the context of input and constructs the temporal relationship between inputs in different environments. When an input enters HTM, HTM can quickly retrieve all followups by activating all cells on the active minicolumn. With the continuous confirmation of the following inputs, HTM can identify and confirm the patterns containing sequential inputs. The retrieval efficiency of this method is much higher than that of the traditional comparison algorithm. Based on this, the trained HTM can be regarded as a warehouse of rules, which can detect whether the test sequence is abnormal. In this model, if the learning sequences are the rules, it is worth discussing how to get all features of the rules quickly and ensure that the trained HTM has high prediction recall and precision.
First, TPL uses Hebbian rules to adjust the dendritic branches of cells to establish the temporal association between adjacent inputs. When the number of connected synapses in the dendrite branch of the cell accumulates to a certain threshold, TPL completes the extraction and memory of sequence features. TPL needs multiple iterations to memorize the sequence features, which affects the learning efficiency of TPL. Secondly, TPL gives priority to enhance the sequence features that have been learned rather than the current position sequence features, which affects the learning effect of TPL. In particular, when there are many continuous same inputs in the sequence, TPL is easy to fall into the same input cycle training and unable to obtain all features of the pattern, which affects the learning effect of TPL. Therefore, it is necessary to design a new algorithm to improve the learning efficiency and effect of TPL.
In this paper, a temporal pool learning algorithm based on location awareness (TPL_LA) is proposed. The generation rules of learning cells and active cells based on location awareness and the adjustment rules of dendrite branches associated with adjacent inputs are designed. Three datasets are used to test the performance of TPL_LA and TPL. The main innovations of this paper are as follows.(1)Using the multiple cells contained in the minicolumn, the generated learning cells and active cells can accurately express the position information of the input. In this way, the algorithm can give priority to learning the current sequence features, reduce the possibility of selfcycle prediction when learning continuous same inputs, and improve the learning effect of TPL.(2)According to the generated learning cell set and active cell set, the algorithm adjusts the updating rules of dendritic branches associated with adjacent inputs, and a new setting strategy of synaptic value is designed to improve the learning efficiency of TPL.(3)According to the generated learning cell set, the algorithm reduces the scope of active cells to predict the followup more accurately, which reduces the impact of historical memory on learning(4)In the opensource framework of HTM, the prototype of TPL_LA is implemented, and different types of data sets are used to test and analyze it. The results verify that TPL_LA could effectively improve the learning efficiency and effect compared with TPL.
The remainder of this paper is structured as follows: the related works for HTM are discussed in Section 2. Then, in Section 3, the efficient temporal pool learning algorithm based on location awareness is discussed. Finally, the experiments and analysis are carried out in Section 4. And the last section concludes our study.
2. Related Works
HTM is a new artificial neural network model based on Jeff Hawkins’ memory prediction framework [3], and its main workflow is shown in Figure 1. The basic network space of HTM can be described as a region composed of multiple minicolumns. Regions and regions can have hierarchical relationships. There are many cells on a minicolumn. The cells on each minicolumn share a proximal dendrite to receive input stimuli. Every cell may have many branches of distal dendrites, which can build relationships with other cells [1]. The encoder converts the input into a binary vector of equal length, and the number of components with 1 in the vector is equal.
The vector can activate a small number of minicolumns to express the input content through SPL. TPL selects some cells on these activated minicolumns to express the input location information and establishes dendrite branches on these cells to construct the correlation between inputs. The sequence can be learned through the SPL and TPL to form memory in the network space of HTM. When the input sequence is consistent with the memorized pattern, the HTM can predict the next content based on the memory [4]. Two core algorithms, SPL and TPL, are used to construct the spaceinvariant and timeinvariant features of input sequences, which are the key technologies for HTM to distinguish similar patterns.
For SPL, Ahmad and Hawkins give the characteristic description of sparse matrix and the expression form of information in the spatial pool [5], which provides theoretical guidance for the following research. Lattner Stefan uses the vector to study the spatial pool and proposes a formula for calculating the overlapping values and the corresponding learning rules [6]. Byrne describes the structure of HTM formally by using matrixes [7], which provides a mathematical basis for the derivation of rules. Leake et al. study and discuss the influence of initialization parameters on SPL [8]. Mnatzaganian et al. give a comprehensive mathematical framework of the spatial pool [9] so that the followup scholars can understand the core characteristics of SPL and improve the algorithm from a mathematical point of view. Li et al. propose an improved algorithm for spatial pool learning, which can make the training process of the spatial pool more efficient and stable [10]. In recent years, increasing scholars have begun to study the hardware implementation of the spatial pool to give full play to the advantages of HTM architecture [11]. Deliang Fan et al. propose that the computing blocks for HTM can be mapped using lowvoltage, magnetometallic spinneurons combined with an emerging resistive crossbar network [12]. Krestinskaya et al. develop circuits and systems to achieve the optimized design of an HTM SP, an HTM TM, and a memristive analog pattern matcher for pattern recognition applications [13]. SPL abstracts the input features through a hierarchical structure [14], which makes HTM have wideranging applications in recognition and classification, such as data classification [15], face recognition [16], speech recognition [17], biometric recognition [18], detection of multiple objects located in clutter color images [19], handwriting recognition [20], action recognition [21], gait recognition and understanding [22], and natural language processing [23].
For TPL, Hawkins and Ahmad give the formal expression of learning rules by matrixes [2], which gives a mathematical description of the rules related to active cells, learning cells, predicting cells, and synaptic renewal. This provides a theoretical basis for the subsequent study of the temporal pool learning algorithm. Younes Bouhadjar et al. reformulate the model in terms of a network of spiking neurons with continuoustime dynamics [24], in which they discuss how neuronal parameters such as cellintrinsic time constants and synaptic weights constrain the sequenceprocessing speed. ElGanainy et al. propose an improved Hierarchical Temporal Memory that can consider longterm dependence [25]. Suzugamine et al. propose a selfstructured cortical learning algorithm that dynamically adjusts the numbers of columns and cells according to the input data [26]. In this model, the backtracking algorithm proposed by the author makes the prediction of the temporal pool more stable. In recent years, some scholars start to implement TPL on hardware [27]. Many scholars combine SPL with TPL and apply HTM to many fields with time series data, such as anomaly detection of time series data [28], heart attack detection [29], medical data flow prediction [25], hydrological intelligent monitoring [30], abnormal ECG detection [31], and abnormal detection in crowd management [32]. However, when the sequence data is learned as rules, TPL in the above research still has some limitations. For example, it needs multiple iterations to memorize the sequence features, it gives priority to enhancing the memory of a historical pattern when learning a sequence, and it is easy to fall into the same input cycle training when learning the sequence with many continuous same inputs. When TPL obtains all features of sequences, these limitations will lead to low learning efficiency and poor learning effect.
3. The Temporal Pool Learning Algorithm Based on Location Awareness
In TPL_LA, the learning process of TPL is reconstructed. The active cell and learning cell selection rules based on location awareness are proposed to make TPL_LA more focused on the current sequence features, which improves the learning effect of the algorithm. The dendrite updating rules associated with adjacent inputs are proposed to improve the learning efficiency of TPL_LA. The algorithm reduces the scope of active cells to predict the followup more accurately, which reduces the impact of historical memory on learning. The learning process of TPL_LA is shown in Figure 2.
3.1. Notation
The following notations are given for the HTM consisting of N minicolumns and M cells in each minicolumn:(1)W^{t}: the set of active minicolumns in HTM at time t. The set includes the identifiers of the activated minicolumns at time t. W^{t} is the output of SPL.(2)A^{t} = : the matrix of active cells at time t. A^{t} is a binary matrix of M × N. indicates whether the ith cell on the jth minicolumn is active at the time of t. A value of 1 indicates an active state and a value of 0 indicates an inactive state.(3)Π^{t} = : the matrix of predictive cells at time t. Π^{t} is a binary matrix of M × N. indicates whether the ith cell on the jth minicolumn is predictive at the time of t. A value of 1 indicates a predicted state and a value of 0 indicates an unpredicted state.(4): the matrix of dendrite branch synaptic. is a binary matrix of M × N. j is the minicolumn’s number. i is the cell number on the minicolumn. k is the dendrite branch number of the cell. The matrix is used to store the synaptic permanence in the kth dendrite branch between ith cell of jth minicolumn and other m × n^{−1} cells. Permanence is a scalar value, and its range is [0.0, 1.0].(5): the matrix of dendrite branch connectivity. is a binary matrix of M × N constructed by the following equation. C_P is the threshold of connectivity.(6): the matrix of positive terms of dendrite branch synapses. is a binary matrix of M × N constructed by the following equation:(7): the matrix of learning cells at time t. is a binary matrix of M × N which is a subset of A^{t}. contains the cells whose dendrite branches need to be added or modified in the training process at time t. When = 1, it means that the cell participates in the learning process of the current input.(8): initial synaptic permanence. is a scalar with a value range of [0.0, 1.0], indicating the permanence of the first connection between two cells.
3.2. Analysis of the Temporal Pool Learning Algorithm
Each input in the sequence continuously activates the microcolumns to express itself through SPL. TPL activates cells in these minicolumns to express the context of current input and uses active cells to predict the followup content. TPL selects a small number of cells from active cells as learning cells to reduce the number of dendritic branches on cells. By adjusting the permanence of dendritic branches owned by these learning cells, TPL constructs the association between the input before and after and learns the sequence features. Active cell generation rule, learning cell generation rule, and dendritic branch synaptic adjustment method are important factors affecting the performance of TPL. Next, from the two aspects of learning efficiency and learning effect, this paper analyzes the implementation details existing in TPL, such as the selection rules of learning cells and active cells and the updating rules of dendritic branches.
3.2.1. Learning Efficiency
In HTM, cells maintain a large number of dendritic branches, which record the relationship between cells. With these dendrite branches, HTM can save the sequence relationship between inputs so that the TPL can predict the future according to the current input. When a cell creates a new dendritic branch, its synapses are usually not connected. After TPL learns the input many times, the Hebbian rule makes the permanence of the dendrite branch increase or decrease. The cell can become the prediction cell of the associated active cell, and TPL completes the memory of the sequence only when the connected synapses in the dendrite branch reach the threshold. Therefore, the sequence needs to be learned repeatedly before being memorized by HTM.
Secondly, in the minicolumn activated at time t, TPL uses the following equation to generate active cells:
If there are no predictive cells on an activated minicolumn at time t, TPL selects all cells on the minicolumn as active cells. TPL selects one of the cells as the learning cell to avoid creating too many dendritic branches in the learning process. TPL uses the following equation to select the learning cell on this minicolumn, which is called the best matching cell.where determines whether contains a dendritic branch that overlaps with the last active cells the most among all cells on j minicolumn. The minThreshold is the minimum threshold of overlap values of dendrite branches, which is used to avoid some invalid dendritic branches from participating in the calculation.
TPL selects a dendrite branch on the learning cell and enhances its synaptic value to strengthen its association with active cells at time t−1. The selected dendrite branch should satisfy the following formula:
In this case, with the unpredicted activated minicolumn, the adjusted dendrite branches have the following two situations:(1)The dendrite branch constructs the association between and . TPL adjusts the synaptic permanence to enhance the association between the current input and the previous input.(2)The dendrite branch does not construct the association between and . TPL adjusts the synaptic permanence to enhance the characteristics of a historical subsequence.
The use of equation (4) increases the probability of Case 2, which makes TPL give priority to learning the features of repeated subsequences. When TPL cannot find the learning cell with equation (4), TPL will randomly select one with the least utilization rate as the learning cell on the unpredicted activated minicolumn. TPL constructs a new dendrite branch on the cell and establishes the association with the learning cells at time t−1. In this way, TPL can learn and memorize the current new sequence feature and add it to the last learning content. Therefore, TPL needs to learn a sequence repeatedly before it can memorize and store all characteristics, even if TPL directly sets the initial synapse permanence of the newly created dendritic branch to the connected state.
3.2.2. Learning Effect
TPL gives priority to learning the features of repeated subsequences rather than those of the current input sequence. Therefore, after a round of training of the input sequence, TPL can only memorize and store the repeated segments. These memories are fragmentary. Compared with the complete sequence, there are many breakpoints in memory. Although more iterative training can repair these memory breakpoints, it also needs more time. By repairing memory breakpoints, fragment memories can string into a longer memory, which can be called the memory axis. However, some sequence fragments will be memorized again in the new context and form memory branches on the memory axis. The following experimental results can verify this conclusion.
Besides, there may be continuous same inputs in the sequence. Although the contents of these inputs are the same, their meanings are different due to their different positions. TPL selects different learning cells from the activated minicolumns to represent the different contexts of input. The cells associated with learning cells also come from these minicolumns. When TPL learns the continuous same inputs, it is easy to make the input cycle predict itself. In this case, TPL will no longer learn the same new input, which will affect the training effect.
As shown in Figure 3, HTM has learned b for P times, and each b has different learning cells due to its different positions. When TPL learns the subsequent b, the active cells of the input may be a subset of the predicted cells, i.e., . This leads to the fact that the modified dendrite branches only strengthen the memory of history, and TPL no longer learns new repetitive content. Therefore, TPL cannot effectively learn repeated inputs, and HTM may only form one or more memory segments of the sequence.
When TPL learns a sequence, the memory generated by HTM usually has memory breakpoints and memory branches, which will affect the prediction effect. Memory breakpoints indicate that TPL cannot form a complete memory of a sequence, and they will reduce the recall of predictions. Memory branches will reduce the precision of prediction.
3.3. Cell Selection Rules Based on Location Awareness
In TPL_LA, the cell selection rules based on location awareness are designed. The rules reduce the range of active cells and no longer use the best matching cells. In this way, TPL_LA can distinguish the same input in different positions and give priority to learning the features of the current sequence.
When there are predictive cells on the activated minicolumns at time t, these cells contain active dendritic branches. Adjusting these dendrite branches will learn the sequence characteristics of the current position. TPL_LA uses the following equation to set the cell as a learning cell.
When there are not predictive cells on the activated minicolumns at time t, these cells do not contain active dendritic branches. TPL_LA uses the following equation to set the cell as a learning cell, where determines whether is the least used cell on j minicolumn.
TPL_LA adds dendrite branches to the learning cell to construct the association with to learn the sequence characteristics of the current position.
Finally, based on the selected learning cells, TPL_LA uses the following equation to create active cells.
Different from the way TPL generates the learning cells and active cells, the algorithm no longer selects the best matching cells but randomly selects the cells with the least frequency as the learning cells with the unpredicted activated minicolumns. Therefore, TPL_LA can accurately express the context of the current input and learn the sequence features of the current position. Active cells usually express multiple contexts of input. The algorithm generates the active cells according to the learning cells, so it can accurately express the current context of the input. Such active cells reduce the prediction of historical content, which makes TPL learn the sequence characteristics of the current position and reduces the occurrence of memory breakpoints and memory branches. Besides, when TPL_LA learns the same continuous inputs, such active cells can also reduce the cycle prediction of the input and improve the learning effect of TPL_LA. The purpose of the proposed algorithm is to obtain the complete features of the rule. Every input owns different cell combinations to express the context through location awareness. To some extent, this increases the number of dendritic branches on the cell. This strategy will take up more storage space but improve the accuracy of prediction.
3.4. Dendrite Updating Rules Associated with Adjacent Inputs
In TPL_LA, the updating rules of dendritic branches associated with adjacent inputs are designed, which makes TPL_LA quickly complete the learning of sequence features.
By adjusting the active dendrite branches of learning cells generated by equation (6), TPL_LA can learn the sequence features of the current position. TPL_LA uses the following equation to select the dendrite branches to be adjusted. The a_T is the activation threshold of dendritic branches.
Reinforcing the above segments is to decrease all permanence values by a small value p− and increase the permanence values corresponding to active presynaptic cells by a larger value p+ [2].
By adding the active dendrite branches to the learning cells generated by equation (7), TPL_LA can establish the association between the current learning cell and and learn the sequence features of the current position. The algorithm adds a new dendrite branch according to the following equation. I_P is usually greater than the connectivity threshold of synapses.
According to the above rules, either the selected active dendritic branches or the newly added dendritic branches construct the association between learning cells at the time before and after. All of these make learning aim at the current sequence and reduce the interference of historical memory on current learning. When the synapse permanence is greater than or equal to the connectivity threshold, the synapse is connected. Therefore, using a bigger I_ P, TPL_LA can quickly construct the temporal association of the sequence, extract the features of the memory sequence, and improve the learning efficiency.
3.5. The Pseudocode of the Proposed Algorithm
Based on Sections 3.3 and 3.4, the pseudocode of TPL_LA is shown as follows. (Algorithm 1).

TPL_LA modifies the rules of TPL. By sensing the position information of the input in the sequence, TPL_LA selects different learning cells to distinguish the same input. By reducing the range of active cells and no longer using the best matching cells as learning cells, TPL_LA only learns the sequence features at the current position. In this way, the memory of HTM rarely produces memory breakpoints and memory branches, and the algorithm can memorize all features of the sequence. Therefore, the learning effect of TPL_LA is highly improved. By increasing the synaptic permanence in the new dendrite branch of the learning cell, TPL_LA can learn the features of the sequences faster. Therefore, the algorithm not only guarantees the learning effect but also has high learning efficiency.
4. Experiments and Analysis
In the opensource framework of HTM, the prototype of TPL_LA is implemented. Different types of datasets are used to test and analyze it compared to TPL.
4.1. Datasets and Evaluation Indicators
In this paper, three datasets are used to test and analyze TPL_LA and TPL. Fifty digits after the π decimal point are used to construct the first dataset representing a random sequence. A sequence such as “211111...... 11113” is used as the second dataset to represent a sequence with continuously repeated inputs, whose length is set to 50. The third dataset is the statistical data of New York taxi passengers. From July 1, 2014, to January 31, 2015, the number of passengers per 30 minutes of New York taxi is used to construct the input sequence, with a total of 10320 data.
These three datasets are used to train the two algorithms, respectively, and the corresponding datasets are used for prediction tests. The test results are used to evaluate the learning effect of whether the two algorithms can obtain all features of the sequence. Three evaluation indicators, i.e., mean recall (MR), mean precision (MP), and F1, are used to evaluate the two algorithms. The describes whether the input is within the prediction range at time t. The describes the proportion of the input in the prediction range at time t. The evaluation indicators are calculated using the following equations:
L is the length of a sequence. When the values of MR and MP are both large, it shows that the algorithm has a high degree of restoration for the input sequence. The larger the value of F1, the better the learning effect of the algorithm.
4.2. The Testing with Random Inputs
The sequence with random inputs is constructed using dataset 1. Figure 4 is a graphical representation of each input in dataset 1.
Dataset 1 has a small input range, so the prototype system uses Table 1 to set the relevant parameters.
4.2.1. The Comparison of Testing Results
When learning a sequence, TPL_LA needs larger initial value synapses. Therefore, I_P is set to the connectivity threshold of 0.8 and TPL_LA trains the sequence only once. TPL is tested in two cases. (1) TPL sets I_P to the connective threshold of 0.8 and trains the sequence once. (2) TPL sets I_P to the disconnected value of 0.7 and trains the sequence one and more times. Table 2 shows the testing results.
Through F1, it can be seen that TPL_LA is better than TPL. From the perspective of MR or MP, the results of the TPL_LA training sequence once are better than those of TPL in various situations. TPL_LA gives a distinct context to the input in different positions, so the recall and precision of the prediction are both the highest. In the learning process of TPL with connected I_P, repeated content is easy to form memory breakpoints. In addition, without repeated iterative learning, these breakpoints are difficult to repair, so the recall and precision of the prediction cannot reach the high point, which reduces the value of F1. In the learning process of TPL with unconnected I_P, nonrepetitive content is easy to form memory breakpoints. Repeated iterative learning can repair these memory breakpoints and produce some memory branches. Therefore, the learning result makes the recall of prediction very high but reduces the precision of prediction, which slightly reduces the value of F1. Although the TPL can also achieve a high approval of recall or precision through iterative learning, it needs more learning time. Therefore, TPL_LA has better learning efficiency and learning effect when learning a random sequence.
4.2.2. The Prediction State of Every Step
To better analyze the results in Table 2, the prediction states of each step when the two algorithms process dataset 1 are listed in Figure 5.
(a)
(b)
(c)
(d)
As can be seen from Figure 5(a), when TPL sets I_P disconnected and learns the sequence once, HTM only remembers the repeat patterns. Some patterns do not repeat in the dataset, which lets the synaptic value between the inputs of these patterns not reach the connectivity state, so HTM does not memorize these patterns. Compared with the complete sequence, there are many breakpoints in memory, so the recall and precision of prediction are very low. It can be seen from Figure 5(b) that when TPL sets I_P disconnected and learns the sequence 100 times, the memory in HTM can restore the complete sequence. Through iterative learning, TPL strengthens the disconnected synapses between inputs to the connected state, so these nonrepetitive patterns are also memorized. At the same time, the repeated patterns in different positions are given different contexts, so some memory branches are formed in HTM. Therefore, the recall of prediction is very high, and the precision of prediction is not high. It can be seen from Figure 5(c) that when TPL sets I_P connected and learns the sequence once, HTM memorizes long sequence fragments. However, memory breakpoints are formed at the position of each repetitive subsequence. The memory breakpoint will make the subsequent input have no context, which causes multiple following predictions. As a result, the recall and precision of prediction are not very high. It can be seen from Figure 5(d) that when TPL_LA learns the sequence once, the memory in HTM can restore the complete sequence. The algorithm gives a distinct context to the input in different positions, so the memory in HTM has few memory breakpoints and memory branches. Therefore, the recall and precision of the prediction are both the highest.
4.3. The Testing with Repeated Inputs
The sequence with continuously repeated inputs is constructed using dataset 2. There are only three input types in the sequence, so the algorithms still use the parameters in Table 1.
4.3.1. The Comparison of Testing Results
For the sequence with continuously repeated inputs, the test is still carried out with the plan designed in Section 4.2.1. Table 3 shows the testing results.
Through F1, it can be seen that TPL_LA is better than TPL. From the perspective of MR or MP, the results of the TPL_LA training sequence once are better than those of TPL in various situations. TPL_LA also gives a distinct context to the input in different positions, so the recall and precision of the prediction are both the highest. In the learning process of TPL with connected I_P, continuous repeated content can be seen as the repeated iterative learning, which can repair the memory breakpoints. However, the continuous repeated content makes the active cell set the same as the predicted cell set, which prevents the algorithm from memorizing longer sequences. Therefore, the recall and precision of the prediction cannot reach a high point, which reduces the value of F1. In the learning process of TPL with unconnected I_P, repeated iterative learning can repair more memory breakpoints. However, because the active cell set is the same as the predicted cell set, the algorithm cannot memorize longer sequences. Therefore, the learning result makes the recall and precision of the prediction cannot reach the high point, which reduces the value of F1. Therefore, TPL_LA has better learning efficiency and learning effect when learning a sequence with continuously repeated inputs.
4.3.2. The Prediction State of Every Step
To better analyze the results in Table 3, the prediction states of each step when the two algorithms process dataset 2 are shown in Figure 5.
As can be seen from Figure 6(a), when TPL sets I_P disconnected and learns the sequence once, HTM only remembers a segment of the sequence. The existing algorithms will give priority to strengthening the repeated patterns. When the previous patterns are memorized, the algorithm will extend the memory content and increase the length of the memory axis. Since HTM only learns part of the sequence, the recall and precision of prediction are not high. As can be seen from Figure 6(b), when TPL sets I_P disconnected and learns the sequence 100 times, the memory in HTM still cannot restore the complete sequence. Through iterative learning, when the memorized sequence reaches a certain length, the active cells and prediction cells will be the same, which leads to the algorithm not learning new repeated content. At the same time, the repeated pattern, especially the “13,” owns different contexts, so some memory branches are formed in HTM. Therefore, the recall of prediction is not improved much, and the precision of prediction is decreased. As can be seen from Figure 6(c), when TPL sets I_P connected and learns the sequence once, HTM still only remembers a segment of the sequence. The reason is also that when the repeat sequence is memorized to a certain length, the active cells and the prediction cells will be the same, resulting in the fact that the algorithm could not learn new content. The algorithm learns the sequence “13” only once, so the pattern has only one context. Compared with the results of Figure 6(c), the recall and the precision of the prediction are not much different. As can be seen from Figure 6(d), when TPL_LA learns the sequence once, the memory in HTM can restore the complete sequence. The algorithm gives different contexts to the input in distinct positions, so the memory in HTM has few memory breakpoints and memory branches. Therefore, the recall and precision of the prediction are both the highest.
(a)
(b)
(c)
(d)
4.4. The Testing of the Taxi Passenger Flow of New York
The real data sequence is constructed by dataset 3. Because the dataset is much larger than the first two datasets, TPL_LA and TPL use Table 4 to set the parameters.
In this testing, TPL_LA set I_P to 0.8. TPL is tested in two cases. (1) TPL sets the I_P to 0.8. (2) TPL sets I_P to 0.7. Each algorithm only learns the data set once under the corresponding configuration.
The dataset has 10320 data and 8090 different numbers. This dataset may be seen as the first level dataset, which includes less repeated subsequence. Table 5 shows the testing results on the first level dataset.
To further study the performance of the algorithm, each data in the original dataset is divided by 10. In this way, the number of repeats in the sequence can be increased by increasing the unit of measurement of the data. This dataset may be seen as the second level dataset, which has 10320 data and 2470 different numbers. Table 6 shows the testing results on the second level dataset.
Go further, each data in the original dataset is divided by 100. This dataset may be seen as the third level dataset, which has 10320 data and 287 different numbers. The data set contains more repetitive subsequences. Table 7 shows the testing results on the third level dataset.
From the indicators in Tables 5–7, it can be seen that TPL_LA always has the highest MR and MP. TPL_LA gives different contexts to the input in different positions and can enable HTM to remember all features of the sequence by learning them once. The memory in HTM can completely restore the content of the sequence, no matter how many repetitive patterns are included in the sequence. TPL_LA has good learning efficiency and learning effect. If only learning the sequence once, TPL with connected I_P can get a good learning effect on the sequence without repeated content, but the learning effect will decline when there are repeated contents in the sequence. In this setting, repeated content is easy to form memory breakpoints. On the other hand, if only learning the sequence once, TPL with disconnected I_P can hardly remember the characteristics of the sequence without repeated contents. In this setting, the synapses between data cannot reach the connected state, and the temporal relationship between data cannot be formed in HTM. Only when there are repeated contents in the sequence or HTM learns the sequence more times can the algorithm extract and memorize the features of the sequence.
5. Conclusions
Through the analysis of TPL, the authors explain the reasons for the low learning efficiency and poor learning effect of TPL and propose an efficient temporal pool learning algorithm based on location awareness. After one training of TPL_LA, the sequence can be effectively memorized by HTM, which shows that the algorithm has good learning efficiency and learning effect.
In the following research, the authors intend to add more input feature information to the TPL_LA and modify the learning mechanism of the proposed algorithm, which could enhance the smoothness of the memory, make the predictive generalization higher, and improve the utilization rate of the network space of the HTM. In this way, the proposed algorithm can be better used in the intelligent network in the future.
Data Availability
The artificial data used to support the findings of this study are included within the article. The timeperiod statistics of New York taxi passengers can be found at https://www1.nyc.gov/site/tlc/about/tlctriprecorddata.page.
Conflicts of Interest
The authors declare that they have no conflicts of interest.
Acknowledgments
This research work was supported in part by the National Natural Science Foundation of China (grant no. 61806086), in part by the Project of National Key R&D Program of China (2018YFB0804204), and in part by Jiangsu Provincial doctoral Innovation Fund (CXZZ13_0689).