# Learning and Development of Home Service Robots' Service Cognition Based on a Learning Mechanism
## 3 Service Cognition Based on the Autonomous Development Algorithm
### Analysis of the Modified IHDR Algorithm
#### 3.2.3 Search the IHDR Tree  
When \(Y_{t}\) in the sample S = (\(X_{t}\), \(Y_{t}\)) is unknown, it can be obtained by searching the IHDR tree to find the leaf node that matches \(X_{t}\); the output of this leaf node is \(Y_{t}\). The modified search process of the IHDR tree is shown in Algorithm 3. The process of retrieving the tree is shown in Figure 5, in which the shaded nodes are true nodes, and the searching process is as follows. Let all nodes in the first layer be the active nodes set, and the true nodes set, which is \(Y_{1}\), \(Y_{4}\), \(Y_{5}\), can be obtained by computing the response of \(X_{t}\). Then, let all children nodes of \(Y_{1}\), \(Y_{4}\), and \(Y_{5}\) be the new active node set; the response is thus similarly computed. The rest of the process can be carried out in the same way. Finally, the three shaded leaf nodes form the set of the last true nodes, whose output can be regarded as the output of \(X_{t}\).  
```
Input: A set of sample data S without output; Output: A service sequence SS; Step 1: Initialization; Step 1.1: Define an active node set as a set of active nodes waiting to be searched, and the active node set is initialized as the set of all nodes in the first layer of the IHDR tree; Step 2: Search tree; Step 2.1: Traverse the active node set, find the nodes that respond to (Xt as true by calling step 3, and let these nodes be the true node set; Step 2.2: If all nodes in the true node set are leaf nodes, then SS is the output set of all these leaf nodes, and the searching process of the current sample ends; Step 2.3: Else, clear the current active node set, add all leaf nodes and all child nodes of internal nodes in the true node set to the active node set, and repeat step 2. Step 3: Calculate the response of (\(X_{t}\) in sample S to some node's cluster information. The result \"true\" means that S has exactly the same input as this node, and S's output should be the same as this node's output; Step 3.1: Traverse all the features of (Xt and set the value of the current feature equal to T; Step 3.2: The feature value in the cluster information corresponding to T is \"0\", continue; Step 3.3: If the feature value in the cluster information corresponding to T is a list, and T belongs to the list, then continue. Else, return false; Step 3.4: If the feature value is mean and range, and if T satisfies Formula 7, continue. Else, return false; Step 3.5: Return true if the traversing is over.
```  
**Algorithm 3**Update Tree Algorithm.  
The modification of the algorithm also follows the principle of \"only concentrate on the necessary conditions for a service instead of other unrelated conditions\", so we are not concerned with features whose value is 0. A continuous feature should have a value that is in the same range as one cluster; a discrete feature should have a value that belongs to the list that records the possible values. If it belongs to this cluster, then its output is the same as the cluster's output. Step 3 in Algorithm 3 shows these details:  
\[T\in[ave-range,ave+range]. \tag{7}\]  
Thus, the IHDR algorithm is complete. As the robot continues to process increasingly more sample data, the tree is incrementally constructed and expanded. The more \"flourished\" the IHDR tree, the richer the historical experiential knowledge stored in the tree, and the greater the service recognition of the robots. By analyzing the theory of the IHDR algorithm, we can conclude that it updates its historical experience using an incremental learning method, which is different from the traditional batch learning method, such as that used in a neural network. If the robot must learn a lot of new sample data in the home environment, then it only needs to learn the added data and store new experience in its human-brain-like knowledge base using this incremental learning method ratherthan learn all of the sample data again using the batch learning method. This is more in line with the process of human learning and mental development.