1 Introduction

With the advance and prevalence of low-cost low-power sensors, computing devices, and wireless communication networks, pervasive computing [1] has evolved from a vision to a realistically achievable computing paradigm. Research has been conducted in all related areas over the last decade, ranging from low-level data collection and intermediate-level information processing to high-level applications and service delivery.

With an increasingly aging population profile, the provision of healthcare is undergoing a fundamental shift toward the exploitation of pervasive computing technologies to support independent living and avoid expensive hospital-based care [2]. Pervasive and context-aware applications [3] have been widely recognized as promising solutions for providing activity of daily living (ADL) analysis for the elderly, in particular those suffering from chronic disease, as well as for reducing long-term healthcare costs and improving quality of care [4].

A context-aware system is designed to use the context to provide relevant information and services to the user. To achieve pervasive healthcare for independent living [5], a context-aware system should be able to observe, interpret, and reason about the dynamic situations (both temporal and spatial) in a smart home environment. Although the straightforward-rule-based reasoning engine is a competent approach, it still has some unsatisfactory limitations. For example, specific rules may be easy to apply and are reliable, but only apply to a narrow range of adaptation problems; whereas more abstract rules span a broad range of potential adaptations but not provide domain specific guidance. Case-based reasoning [6] is another approach targeting problem resolution in domains where structured domain knowledge is known; however, it requires an accumulation of sufficient previous cases to accomplish the reasoning task.

In this paper, we present a novel approach that combines context awareness, case-based reasoning, and general domain knowledge in a healthcare reasoning framework. In combining these concepts, the architecture of this system has the capability to handle uncertain knowledge and use context in order to analyze the situation and leads to an improved independent quality of life. The limitations of a single reasoning method are overcome by adapting the domain knowledge as rules in the process of reusing cases. Moreover, we introduce the idea of query-sensitive similarity measures in the case retrieval step which dynamically adjusts weights of contexts based on the output of the fuzzy-based rule engine.The context-aware hybrid reasoning framework we proposed is flexible and extendible which can be applied to various domains. Especially in the medical field, the knowledge of experts does not only consist of rules, but of a mixture of explicit knowledge and experience. Therefore, most medical knowledge-based systems should contain two types of knowledge: objective knowledge, which can be found in textbooks, and subjective knowledge, which is limited to space and time and individual. Both sorts of knowledge can clearly be separated: objective knowledge can be represented in the form of rules, while subjective knowledge is contained in cases. The limitations of subjective knowledge can partly be solved by incrementally updating the cases [7].

As part of the Context-Aware Real-time Assistant (CARA) pervasive healthcare system, the reasoning engine plays a crucial role by interpreting sensor data within a wider context, reasoning with all available knowledge for situation assessment, and performing actions according to the results of the reasoning process. The remaining components in the CARA are as follows:

  1. 1.

    Wearable wireless sensors. A key component of the system is a body area network (BAN, i.e., a portable electronic device capable of monitoring and communicating patient vital signs), and this includes medical sensors such as the ECG, SpO2 meter, temperature sensor, and mobility sensor.

  2. 2.

    Smart home sensors. We assume the presence of an environmental monitoring system equipped with a wireless sensor network and a reasoning engine. A rich set of sensors can be used for monitoring in home environments.

  3. 3.

    Remote monitoring system. This is responsible for remotely and continuously measuring physiological signals of the elderly through the BAN, monitoring ambient through smart home sensor network, and transmitting context to the reasoning engine in real-time.

  4. 4.

    Data and video review system. This is designed for a medical consultant or caregiver to review the data previously collected from the elderly in case s/he might not be available for real-time monitoring.

In the case of context-aware services, it is really difficult to get an accurate and well-defined context which could be classified as ‘unambiguous’ since the interpretation of sensed data as context is in general imperfect and incomplete. We contend that the hybrid reasoning framework we propose has the potential to minimize this problem. The fuzzy rule-based reasoning method overlaps to some extent with other mathematical models developed to deal with vagueness and uncertainty. The case-based reasoning approach addresses problems of incomplete data and limitations of domain knowledge. The objective of this paper is to present a scalable and flexible infrastructure for the delivery, management, and deployment of context-aware pervasive healthcare services to the elderly living independently.

The remainder of the paper is as follows. Related work about context-aware reasoning systems is summarized in Sect. 2. In Sect. 3, an overview of the background knowledge for the approach is introduced. This is followed by the presentation of system structure, and then, the context interpretation based on the model of context is described. In Sect. 6, our hybrid reasoning framework is incorporated into the CARA architecture for knowledge-intensive case-based reasoning. In Sect. 7, the system is evaluated on simulated realistic scenarios to illustrate how pervasive healthcare can be supported by the proposed scheme. The final section presents a summary and conclusions.

2 Literature review

2.1 Related work

Making computer systems adaptable to the changes of their operating environment has been previously researched in the context of agent technologies [8]. An intelligent agent is a software system operating in an environment. It senses the changes of the environment, makes a decision in terms of its goal and domain knowledge, and takes actions accordingly.

Recent technology advances in pervasive computing and ambient intelligence have provoked considerable interest in context-aware applications [913]. The use of context awareness in pervasive computing has been studied in healthcare domain. A number of research projects related to pervasive healthcare and semantic modeling of context have been conducted. Some are more general [14, 15]. Others have focused on specific aspects, such as health status monitoring, alert and reminders based on scheduled activities, patient behavior, and daily activities modeling. For instance, Jawbone UP is a personal care system providing long-term monitoring of a user’s activity profile, sleep pattern tracking, and automatic alarm notification [16]. The Gaia project [17] developed at the University of Illinois is a distributed middleware infrastructure that provides support for context-aware agents in smart spaces. CareMedia [18] uses multimedia information to track a person’s activities. MIT’s PlaceLab [19] includes a proactive health care application based on wearable sensors and environmental sensing. More relevant to context-aware pervasive healthcare for chronic conditions is H-SAUDE [20], which provides a decision-level data fusion technique for monitoring and reporting critical health conditions of a hypertensive patient at home. Context awareness is also one of the primary characteristics of smart homes. Many research smart home labs have been built as test beds for context-aware pervasive computing. Examples include the Georgia Tech Aware Home [21], MIT Intelligent Room [22], and Neural Network House [23] at the University Of Colorado Boulder. While our research shares ideas with these endeavors in adapting context awareness in pervasive computing, instead of focusing on one domain, our work deals with context-aware pervasive healthcare within a more general smart home environment.

Much work has been done on how to use reasoning mechanisms to achieve context awareness. Lum [24] uses decision trees to decide the optimal content for presentation, based on the specific context, such as intended target device capabilities, network conditions, and user preferences. Ranganathan and Campbell [25] propose a context model based on first-order predicate calculus. Wallace and Stamou [26] develop a context-aware clustering algorithms for data mining a user’s consumer interests of multimedia documents, based on user history. Case-based reasoning is also a successful technique for context-aware systems in many domains [27, 28], but less so for medical applications. The main problem for case-based reasoning is the adaptation task. Some more research is required on this topic; some formal adaptation models [29] but no general methods have been developed so far. In our work, a fuzzy logic-based method for knowledge acquisition is developed and used for case retrieval and adaptation in a case-based reasoning system.

2.2 Previous work

The original CARA healthcare architecture has been shown to enable improved healthcare through the intelligent use of wireless remote monitoring of patient vital signs, supplemented by rich contextual information [30, 31]. Important aspects of this application include the following: inter-visibility between patient and caregiver; real-time interactive medical consultation; and replay, review, and annotation of the remote consultation by the medical professional. A rule-based reasoning engine is implemented in the CARA system by using fuzzy logic [32]. It allows a user to configure the fuzzy membership functions which represent the context model and applies user-designed fuzzy rules to make inferences about the context. The annotation of significant parts of the fuzzy-based reasoning provides the basis for the automated intelligence of the CARA system. However, this system requires certain medical knowledge to structure fuzzy rules to perform the reasoning. It is limited by being domain specific and not so adaptable to a changing environment. This paper describes case-based reasoning mechanisms incorporating fuzzy-based domain knowledge to compensate for the deficiencies of a single reasoning model.

We are aware of the fact that research efforts are converging toward the combination of statistical reasoning and ontology-based knowledge representation. Many approaches have been proposed focusing on using Semantic Web Languages with ontologies and rules to build reasoning systems [3335]. Nevertheless, ontologies are primarily treated as data models for data integration, exchange, and sharing in these practices. In contrast, our work uses fuzzy sets (which are more expressive, flexible, and efficient in computation) as conceptual level knowledge models to support automated context interpretation and reasoning. The rules can be edited by a user using constrained natural language rather than dealing with machine understandable rules. The reasoning engine can work off-line on the client-handling rules loaded from the server and raw data collected from the WSN in real-time. In this paper, we handle uncertainty in the reasoning process using fuzzy logic, and we use a distance metric in case-based reasoning to avoid issues of incomplete context data; there are other papers where uncertainty is handled in an abstraction layer, separate from the symbolic reasoning process as in [36].

3 Background

In this section, we present the principles behind the two reasoning mechanisms used to build the hybrid reasoning framework for the CARA system. Some details of fuzzy logic and case-based reasoning engine are introduced.

3.1 Fuzzy logic

The declarative logical framework we use for knowledge representation and reasoning in the CARA system is that of fuzzy logic, based on the fuzzy set theory proposed by Zadeh [38, 39]. Fuzzy logic is useful when working with vague, ambiguous, imprecise, noisy, or missing information. We can use it to control nonlinear systems that are too tricky to model mathematically. We adapt fuzzy logic for use in a pervasive healthcare system. Before describing the reasoning system in detail, we want to recall some basic fuzzy logic definitions. A fuzzy logic system consists of three main parts: fuzzy set, rules, and inference engine. These components and the general architecture are shown in Fig. 1. The process of fuzzy logic is explained as follows: Firstly, a crisp set of input data are gathered and converted to a fuzzy set using fuzzy linguistic variables, fuzzy linguistic terms, and membership functions. This step is known as fuzzification. Afterward, an inference is made based on a set of rules. Lastly, the resulting fuzzy output is mapped to a crisp output using the membership functions in the defuzzification step.

Fig. 1
figure 1

A fuzzy logic system

The original definition of a fuzzy set from Zadeh [38] is as follows: Let X be a space of points, with a generic element of X denoted by x. Thus, X = {x}. A fuzzy set A in X is characterized by a membership function f A (x) which associates with each point in X a real number in the interval [0, 1], with the values of f A (x) at x representing the “grade of membership” of x in A. Thus, the nearer the value of f A (x) to unity, the higher the grade of membership of x in A. Fuzzy sets can be further divided based on the type of membership function which describes them. After the inference step, the overall result is a fuzzy value. This result should be defuzzified to obtain a final crisp output. Defuzzification is performed according to the membership function of the output variables. There are different algorithms for defuzzification too. The common algorithms are listed in Table 1, where U is the result of defuzzification, u is the output variable, min is the lower limit for defuzzification, max is the upper limit for defuzzification, inf is the smallest value, and sup is the largest value.

Table 1 Defuzzification algorithms

3.2 Case-based reasoning

Case-based reasoning (CBR) is a paradigm for combining problem solving and learning that has became one of the most successful applied methods of AI. CBR means to retrieve former, already solved problems similar to the current one and to attempt to modify their solutions to fit for the current problem. The underlying idea is the assumption that similar problems have similar solutions. CBR has several advantages over traditional knowledge-based systems, e.g., it reduces the knowledge acquisition effort, requires less maintenance effort, improves over time, and adapts to changes in the environment. These features make it an ideal tool to use in the CARA system to detect abnormal situations or diagnose an illness from observed attributes. Figure 2 shows the Cased-Based reasoning cycle developed by Aamodt [37].

Fig. 2
figure 2

Common case-based reasoning cycle

At the highest level of generality, a general CBR application can be described by a cycle composed of the following four processes:

  1. 1.

    RETRIEVE the most similar case or cases.

  2. 2.

    REUSE the information and knowledge in that case to solve the problem.

  3. 3.

    REVISE the proposed solution.

  4. 4.

    RETAIN the parts of this experience likely to be useful for future problem solving.

A new case represents an initial description of a problem which also defines the query. It is used to retrieve most similar cases from the collection of previous cases. Similarity measure algorithms are applied to the case retrieval task. Similarity measures involved in retrieving a case from the case base depend very much on the memory model and application domain. One commonly used method is nearest neighbor retrieval.

In nearest neighbor retrieval, let CB denotes a set of input descriptions P for which a solution S exists such that (PS) is in the case base. A similarity measure is a mapping \(\hbox{sim}: P * CB \to [0,1] \in R. \) For an attribute-value representation, a simple similarity measure is the generalized hamming measure that combines the importance of each attribute of the problem description with its local similarity value and sums the values to create a global similarity value for each case as shown in Eq. 1 where sim j is local similarity for attribute j and w j represents relevance (weight) of attribute j for the problem description.

$$ \hbox{sim}(P1,\,P2) = \sum w_{j} * \hbox{sim}_{j}(P1,P2) $$
(1)

The case-retrieved is chosen when the weighted sum of its features that match that query case is greater than the other cases in the case base. In simple terms, a case that matches the query case on n number of features will be retrieved rather than a case which matches on k number of features where k < n. Some features that are considered more important in a problem-solving situation may have their importance denoted by weighting these features more heavily in the matching.

In terms of the case adaptation (reuse and revision), if there are no important differences between a current and a similar case, then a simple solution transfer is sufficient. Sometimes, only a few substitutions are required, but in other situations, the adaptation is a very complicated process. So far, no general adaptation methods or algorithms have been developed. The adaptation is still absolutely domain dependent. Our approach is to integrate fuzzy rule-based reasoning (FRBR) mechanism into the process of case adaptation.

4 System design overview

Advancements in internet technology have made possible innovative methods for the delivery of healthcare. Universal access and a networking infrastructure that can facilitate efficient and secure sharing of patient information and clinical data make the internet an ideal tool for remote-patient-monitoring applications.

The overall design of the CARA pervasive healthcare system is shown in Fig. 3. The patient’s vital signs are monitored by different kinds of sensor within a wireless BAN, and environmental sensors are deployed to monitor the home surroundings. All measurement data are transmitted to a gateway (often a PC or a smart phone) through wireless connection. The mobile application collect raw accelerometer and gyroscope readings from wearable sensors and smart phone itself and produce low-level activity contexts(i.e., sitting, lying, standing, moving, rolling). These contexts along with other environmental and physiological sensor readings are then transferred to the PC over Bluetooth connection in real-time. The software agent running on the gateway transforms raw sensor data into contextual information known as sensor data fusion. The gateway connects over the Internet to the CARA cloud server which provides sensor data management and remote monitoring services. A Flash application running on the gateway publishes real-time sensor data along with live video streams to the CARA server so that the remote caregiver can communicate with the elderly throughout the monitoring. On the server side, data derived from the sensor data are stored in an implementation independent generic format (i.e., XML), and the contexts are stored as cases for CBR.

Fig. 3
figure 3

CARA pervasive healthcare system overview

The reasoning engine plays a crucial role in the system both on the client and on the server side as an intelligent agent. It can be tailored with different rules for different applications (such as for in-clinic assessment or smart home monitoring), and it also executes in real-time and offers immediate notification of critical conditions. Some critical conditions may only be identified from correlating different sensor readings and trends in sensor readings accumulated over time. The CARA reasoning component is capable of performing the following reasoning tasks: (i) continuous contextualization of the physical state of a person, (ii) prediction of possibly risky situations, (iii) notification of emergency situations indicating a health risk, and (iv) home automation or user prompting within a smart home environment.

Figure 4 illustrates the architecture of the CARA system. In the smart home healthcare scenario, BAN and various home environmental sensors are deployed to gather as much information about and around the person as possible. The system listens to all available sensor data via wireless communication protocols (i.e., Bluetooth, ZigBee). The raw numeric data are interpreted to construct the context for the monitored individual and environment. It can then be used by the intelligent reasoning components, which act as the brain of the system, to provide risk assessment and home monitoring. The real-time reasoning task is carried out with remote monitoring services and data mining services in parallel. In this paper, we focus on the hybrid reasoning framework which is a combination of case-based reasoning and fuzzy rule-based reasoning. It is worth to mention that, although case-based reasoning has several advantages and performs good results in reasoning task, its efficiency suffers as the size of the case base grows. Especially for a mobile client with limited computing power, it seems a bit too expensive in term of efficiency to run the case-based reasoning applications. So ongoing work is to make use of the power of cloud computing to improve the performance of case retrieval in case-based reasoning. Eventually, the case-based reasoning component running on a private cloud environment should cooperate seamlessly with the light-weight fuzzy rule-based reasoning running on a PC or mobile client.

Fig. 4
figure 4

Architecture of CARA system

5 Context modeling

5.1 Context in case-based reasoning

Context is any information that can be used to characterize the situation of an entity. Context-aware computing is the use of context to provide relevant information and services to the user, where relevancy depends on the particular task of the user [40]. Context modeling is a key feature in context-aware systems providing context for intelligent services. Studies of context models indicate that there are certain entities in a context that, in practice, are more important than others for home monitoring. These are location, identity, activity, and time [42]. In order to represent this information in our context model, we identify the following entities:

  • Person entity to model the person, his clinical profile, and his movement.

  • Physiology entity to model vital signs of a person.

  • Area entity to model rooms and area in the environment.

  • Object entity to model objects or resources the person can interact with.

Research has shown that CBR is a reliable approach to provide smart home solutions. In a smart home scenario, contexts are used to focus on the part of the home environment that can be sensed. Thus, the context supplies the dynamic part of the home environment that is available to identify the situation. The home environment depicted in the context-aware part provides the parameters CARA uses in the retrieval part of the case-based reasoning cycle. These parameters can be the location where the situation is occurring, the activity of a person, and the time of day.

Figure 5 presents the structured contexts that are concerned in the processing of our case-based reasoning engine. A case has two main parts: the findings of the situation, which consists of the perceived context; and the solution, which consists of the goal to be achieved and the corresponding task to be accomplished. Note that, in this application, an interpreted solution involves anomaly detection and home automation. A notable improvement of our context model for case-based reasoning is the introduction of the grouped attributes. The model was populated through observations done in the process of system evaluation. It turns out that not all the context is relevant to a specific situation. For example, if hypertension is detected during the night when subject is watching TV, it certainly does not matter whether the lights are on or off or the humidity of the room is high or low. In order to improve the efficiency and accuracy of case retrieval, we use different context groups and calculate their group similarities to archive the goals of the reasoning task.

Fig. 5
figure 5

Grouped contexts for case-based reasoning

5.2 Fuzzy context model

The main problem that we consider here is the following: given the current raw data, how can we model the context, e.g., the current values of relevant context parameters, and deal with data coming from multiple sources where part of the data might be erroneous or missing. Therefore, we adopt a fuzzy logic model [41] to represent the relevant variables and to build low-level and high-level context models. An overview of the fuzzy context model is shown in Fig. 6 where we structure the low-level context according to the Physiological Context, Personal Context, and Environmental Context and generate high-level context consisting of Activity Event and Medical Condition. These are the contexts required in a ubiquitous context-aware environment.

Fig. 6
figure 6

Fuzzy context model

All pieces of information gathered by sensors can be indexed as attributes of the context entities. In our work, we map these attributes into individual fuzzy sets in the fuzzy logic framework. Some of the attributes associated with entities in our context model and their fuzzy sets are detailed in Table 2. These fuzzy sets can be used for high-level context interpretation and further for decision inference.

Table 2 Fuzzy sets representing attributes about person and area entities

6 Hybrid reasoning engine

6.1 Overall design

A pervasive healthcare system is an ambient intelligence system that is able to (i) reason about gathered data providing a context-aware interpretation of their meaning, (ii) support understanding and decision, and (iii) provide corresponding healthcare services. To achieve that in the CARA system, we adopted a context-aware hybrid reasoning framework by means of case-based reasoning and fuzzy rule-based analogy. The high-level interactions in the hybrid reasoning engine are presented in Fig. 7. Raw data coming from sensors are processed and integrated with context knowledge by the context data fusion services, producing contexts for building case queries and fuzzy sets. After that, the case-based reasoning component starts running a standard CBR cycle (Retrieve, Reuse, Revise, and Retain) to perform anomaly detection and home automation. Meanwhile, the fuzzy rule-based analogical component loads fuzzy rules from the inference rule database to generate higher level contexts (e.g., medical condition and accident event) and further to identify current situation of the user (normal, abnormal, or emergency). The result of the fuzzy output can be used to dynamically adjust weights of features or groups for case retrieval and can also affect the adaptation of the retrieved solution to the new case. The case is revised according to the combination of retrieved similar cases and fuzzy outputs. Finally, if the detected situation is abnormal or an emergency, then a notification or alarm is automatically sent to the remote monitoring server and an emergency service call can be triggered. The collected raw data and revised case are stored for enhancing the case base and subsequent additional analysis.

Fig. 7
figure 7

The structure of context-aware hybrid reasoning framework

6.2 Context-aware query sensitive

Case-based reasoning is recommended to build intelligent systems that are challenged to reduce the knowledge acquisition task, avoid repeating mistakes made in the past, reason in domains that have not been fully understood or modeled, learn over time, reason with incomplete or imprecise data and concepts, provide a means of explanation, and reflect human reasoning. However, the common k-Nearest Neighbor (k-NN) algorithm for case retrieving has limitation as pointed out in [43], finding nearest neighbors in a high-dimensional space raises the following issues:

  1. 1.

    Lack of contrast: Two high-dimensional objects are unlikely to be very similar in all the dimensions.

  2. 2.

    Statistical sensitivity: The data are rarely uniformly distributed, and for a pair of objects, there may be only relatively few coordinates that are statistically significant for comparing those objects.

In our reasoning framework, a case query usually contains following features listed in Table 3. The high-dimensional features of each query are unlikely to be equally uniformed for similarity measure, and it is certainly in some cases some of the features are more importantly considered then the rest of the features.

Table 3 Features of the case involved in a query

To address these problems, we propose to construct, together with context awareness, a query-sensitive mechanism for similarity or distance measure. The term Query Sensitive means that the distance measure changes depending on the current query object. In particular, the weights used for the features similarity measure automatically adjusted to each query. Specifically, we apply fuzzy rules to the input query and use the crisp value of fuzzy output to dynamically adjust weights, which we expect to be significantly more accurate than the simple k-NN method associated with case retrieving. The query-sensitive similarity measure function employed by our reasoning framework is shown in Eq. 2.

$$ \hbox{Sim}_{g}(Q,P) = \frac{\sum\limits_{k=1}^n W_{k} \hbox{Sim}_{l}(Q_{k},P_{k})}{\sum\limits_{k=1}^n W_{k}} $$
(2)

In this formula, Sim g (Globe Similarity) of Q (Query) and P (Past Case) is calculated based on Sim l (Local Similarity) of Q k (Feature k of Query) and P k (Feature k of Past Case), and the dynamic weight of the feature W k . If k is the feature of a query, we use the term weighted to denote any function mapping W k (weight of k) to the binary set 0, 1. We can readily define the function using fuzzy logic. Given a query Q, and a block of fuzzy rules F rule, we can define a weighted function \(W_{Q,F_{\rm rule}} \rightarrow \{0, 1\}\) as follows:

$$ W_{Q,F_{\rm rule}}(k)=\left\{ \begin{array}{ll} f(k)&{\hbox{if}}\, \forall\, k,\, k \in F_{\rm rule}\\ 0&\hbox{otherwise} \end{array}\right. $$
(3)

where f(k) is the degree of fuzzy membership function of feature k. For instance, we define the fuzzy membership function of systolic blood pressure containing fuzzy sets {very  low,   slightly  low,   normal,   slightly  high,   very  high}, among them, very high is a left-linear fuzzy set in the range of 140–200. If the Systolic Blood Pressure of a new case is 167 mm Hg, once the fuzzy rule “if (Activity is Sleeping or Activity is Resting or Activity is Watching TV or Activity is Toileting) and (Systolic Blood Pressure is High or Dynamic Blood Pressure is High) then Situation is Abnormal” is evaluated and triggered, the weight of systolic blood pressure used for the similar case retrieval is set to 0.45 which is the fuzzy degree of very high fuzzy set of systolic blood pressure. As a result, the final weight for each feature of the query is dynamically adjusted by the fuzzy outputs.

6.3 Similarity weighted vote

K most similar cases are retrieved after the K-Nearest Neighbor (K-NN) function is applied to similarity measurement. Normally, the possible solution for the given query can be predicted from the most similar case. In our case, for anomaly detection, the results of retrieved cases are supposed to be classified into Normal, Abnormal, Emergency categories. To determine the possible situation of the subject, a similarity weighted voting mechanism is considered to be used in the voting decision during prediction. Basically, every nearest neighbor has a different influence on the prediction according to its distance to the query. The principle of similarity weighted voting method, the elfevident, is to use the similarity value of each retrieved case as the weight to vote for the most reasonable solution. It is achieved in following steps (the details of the similarity weighted voting algorithm are as shown in Algorithm 1).

  1. 1.

    Classify K-NN retrieving result into different groups.

  2. 2.

    Calculate total similarity of all retrieved cases.

  3. 3.

    Get the sum of similarity of each group.

  4. 4.

    Use the group similarity to vote for prediction.

  5. 5.

    Calculate confidence value of the predicted result.

To distinguish the predicted result from past cases, we apply a threshold to the confidence value of the predicted solution which is used as a controller to balance the detection rate and false alarm rate of the rule engine. Let us remark that the threshold \(\varepsilon\) can be freely set by the user. If user chooses \(\varepsilon = 0, \) the rule engine takes into account all possible problems in P (Past Case), and the determination of the solution of a unique Q (Query) associated with given P lies in this case on the voting result. Otherwise, the threshold \(\varepsilon\) can be considered as a level of decidability: if there exists no P such that \(\hbox{Conf}(Q,P) \geqslant \varepsilon, \) then there is no already solved problem sufficiently similar to Q and no solution can be proposed. In this case, we introduce the fuzzy adaptation model to deal with the uncertainty. The core competence of our reasoning framework is that domain knowledge, which is represented by fuzzy rules and fuzzy sets, is applied to both case retrieving and case adaptation.

6.4 Fuzzy adaptation model

We have developed an adaptation technique for case-based reasoning derived from fuzzy logic-based analogical reasoning and modeling. Fuzzy logic imparts to case-based reasoning the perceptiveness and case-discriminating ability of domain knowledge. Problems and solutions are, in many cases, described by means of linguistic terms or approximate values derived from expert knowledge, for instance “If the room temperature is very low and the season is not summer then turn on the heater.” A convenient knowledge representation is thus fuzzy set-based. The reason why we choose fuzzy logic is because it provides a simple way to arrive at a definite conclusion based upon ambiguous, imprecise, noisy, or missing input information. It is an approach to control problems that mimics how a person would make decisions, only much faster [41]. The steps to constructing the fuzzy adaptation model assisting CBR are as follows:

  1. 1.

    Configure the fuzzy reasoning model.

  2. 2.

    Traverse the case base to find k-NN similar cases.

  3. 3.

    Make a prediction based on weighted median of similarity.

  4. 4.

    Apply the fuzzy adaptation if the confidence of the prediction is low.

  5. 5.

    Use the fuzzy output to revise the solution of the present case.

Step 1 is performed only once to configure the fuzzy membership function and register fuzzy rules. Step 2–4 are performed every time a CBR cycle starts. Note, the fuzzy reasoning mechanism is applied if and only if the CBR method could not find a similar solution for the present query, the result of fuzzy output then uses a possible solution from the domain knowledge point of view to make up for the lack of experience.

The principle of building a fuzzy framework is to design appropriate member functions which are also referred to as fuzzy sets. A membership function is a representation of the magnitude of participation of each input. It associates a weighting with each of the inputs that are processed, and it defines functional overlap between inputs and ultimately determines the output response [44]. The fuzzy relations among these fuzzy sets indicate some of the rules in our reasoning engine. The rules use the input membership values as weighting factors to determine their influence on the fuzzy output sets of the final output conclusion. The inputs are combined logically using the logical operator to produce output response values for all the expected inputs. The active conclusions are then combined into a logical sum for each membership function. Once the functions are inferred, scaled, and combined, they are defuzzified into a crisp output which gives the strength of each output membership function. An example of anomaly detection rules is given in Table 4. Such rules can be specified by medical experts or a particular healthcare giver. They can also be modified by patient under supervision in case of individualization.

Table 4 Sample rules for anomaly detection in smart home environment

7 Implementation and evaluation

It is difficult to evaluate the CARA system in its entirety without extensive field deployment and analysis. Issues including medical, ethical, and practical make field experiments infeasible at present.

However, we have conducted realistic simulation experiments in our lab to test the correctness of the proposed context-aware hybrid reasoning framework in a pervasive healthcare environment and report the results in this section. In our testing scenario, we deploy the CARA system composed of Remote Healthcare Sever, Wearable Sensors, and Client Applications in our lab. For this test stage, real-time vital signs of the patient are collected from wearable BioHarness sensors [46] while environmental sensing is simulated by an android application which we developed to reflect the change of the ambient environment. Biomedical parameters currently taken into account in the model are as follows: heart rate frequency, pulse oxygen level, systolic and diastolic blood pressure, body temperature, and respiration rate, while ambient contexts involves time, space, and duration associated with a subject’s activity, environmental sensing, e.g., temperature, light, noise, and humidity, device interactions, e.g., usage of TV, cooker, phone, and status of heater, window, and lights. Figure 8 illustrates the screen shot of our protype application in a testing scenario.

Fig. 8
figure 8

Left is the Android application built for CBR in a smart home environment. Right is the demo of the CARA pervasive healthcare system showing context-aware reasoning and remote monitoring application

The remote monitoring and data review functions are previously implemented in CARA system as described in [30, 31]. Later, a fuzzy-based reasoning engine was integrated into the system which provides real-time intelligence for prediction in various healthcare situations [32]. We develop a context-aware hybrid reasoning framework which enhances the previous fuzzy rule-based reasoning engine with learning ability by adopting a novel case-based reasoning model. The approach is implemented based on jCOLIBRI:CBR Framework [45] and our previous work. It is implemented in Android and evaluated on an Android device (Motorola Xoom Tablet). Wireless connection between sensor network and client application is done using Bluetooth, and the application is also connected to the home gateway and Remote Healthcare Server.

Use-case testing is underway with a trial in our lab. It is carried out to evaluate performance and acceptance of the implemented features. Since the test bed for smart home environment is still under construction, we have to simulate the behavior of a person living in a realistic home environment based on the daily routine of an elderly person as shown in Fig. 9, which provides us with Activity Contexts. We also simulate light, room temperature, sound, and humidity changes during the test stage which gives us Ambient Contexts. Physiology Contexts and Personal Contexts are collected from the BAN and loaded from server database, respectively.

Fig. 9
figure 9

Daily routine of the interviewee

All the contexts are used to build up the input query for CBR, and they are also mapped into fuzzy sets and enforced by applying consistency rules which refers to the domain knowledge. The system then produces the final decision which indicates the current situation of the subject. The case base used for testing contains 262 cases, among them, 192 are normal cases and 70 are abnormal cases. We evaluated the proposed approach against the common CBR approach and evolving CBR approach using dynamic weights in case retrieval. Given the high variability among these trials, we are able to evaluate the accuracy of situation prediction over a wide range. The results are shown in Table 5. To simplify the evaluation process for anomaly detection, here, we only consider a two-class prediction problem (Normal or Abnormal), in which the outcomes are labeled either as positive or negative. If the outcome from a prediction is Abnormal and the actual situation is also Abnormal, then it is called a true positive (TP); however, if the actual situation is Normal, then it is said to be a false positive (FP). Conversely, a true negative (TN) has occurred when both the prediction outcome and the actual situation are Normal, and false negative (FN) is when the prediction outcome is Normal, while the actual situation is Abnormal. As we discussed in the previous section, we adjust the threshold for the confidence value to get a trade-off between detection rate and false alarm rate. The contingency table above can derive several evaluation metrics, e.g., true positive rate (Recall), false positive rate (Fall-out), true negative rate (Specificity), and positive predictive value (Precision) [47]. It turns out that accuracy is not a sufficient metric for the evaluation of anomaly detection. Since most of the cases are normal, even if it predicts every situation as normal, the accuracy could still be very high. As a result, we introduce the idea of receiver operating characteristic (ROC) in signal detection theory [47] to evaluate our reasoning framework. By calculating true positive rate and false positive rate, we are able to draw a ROC curve as shown in Fig. 10a. Each prediction result or instance of a confusion matrix represents one point in the ROC space. The best possible prediction method would yield a point in the upper left corner at coordinate (0,1), and it is also called a perfect classification. So any point closer to that would be considered as a better approach. It is shown that the proposed approach is the best prediction method for anomaly detection. The best performance of each approach is compared and presented in Fig. 11, where the proposed approach gives 97.4% Specificity, 91.5 % Precision, and 92.6 % Accuracy at confidence threshold value of 0.7, while the normal CBR approach only gives 93.7 % Specificity, 81.2 % Precision, and 88.5 % Accuracy at confidence threshold value of 0.8.

Table 5 Results of various CBR approaches
Fig. 10
figure 10

ROC space of three different approaches for anomaly detection

Fig. 11
figure 11

Best performance of three different approaches

To measure the performance of our approach, we added a time-checking function. A start time is noted before calling a method, and then, the finish time is noted after calling the method, providing a measure of the execution time for each task. We applied tenfold cross-validation to several case bases with different amounts of Normal and Abnormal cases. The summarized test results are shown in Table 6.

Table 6 Inference performance for various case bases

Although the reasoning tasks mostly rely on the computational power of the client device, it is clear that the response time of our rule engine is in direct proportion to the amount of cases being checked and the complexity of rules. We notice that the CBR mechanism gets computationally extensive as the size of the case base increases. If we have the system running for weeks and months, producing many thousands of cases, then it would become unacceptable in terms of efficiency for the user. To relieve the problem, we are working on the following two approaches. Firstly, a regular maintenance scheme is essential to remove redundancy from the case base. Secondly, the underlying cloud computing could provide a reasonable solution for big data mining by sub-dividing the case bases and then allocating groups to different servers to allow parallel processing.

8 Conclusion and future work

There are some existing reasoning approaches which have been proved have the potential to support pervasive healthcare systems, such as semantics-based ontology mechanisms and rule-based expert methods. However, such systems require as much as possible domain knowledge in advance to produce better reasoning results. Other machine-learning approaches like neural networks and Bayesian networks, although they are capable of gaining understanding about a problem domain and providing reasoning functions after learning, take great efforts to train these systems no matter whether they are designed for supervised learning or semi-supervised learning. We are not arguing with these existing methods and their capabilities in this paper, and we are but to improve them by adapting rule-based mechanism with learning ability which makes our reasoning system more adaptive and more intelligent.

In this paper, we have proposed a novel context-aware hybrid reasoning framework that integrates fuzzy rule-based reasoning with an instance-based model to achieve pervasive healthcare in smart home environment. The advantage of the approach is that it performs fully unsupervised learning and with the minimum input from the domain expert. The evaluation result shows that comparing with other approaches (e.g., rule-based reasoning and common case-based reasoning), it significantly improves the performance of the reasoning engine in terms of efficiency, accuracy, and flexibility. It achieves this by adopting context models for case representation, dynamic weights and hierarchic similarity for case retrieving, and intelligent rule validation for case adaptation. We believe the proposed reasoning framework makes the CARA system more robust and more adaptive to a changing environment.

Despite initial encouraging results, our current approach can be further refined and extended. The next phases of our work include recognizing user activities by tracking user movement and related context (e.g., location and duration) and then comparing them with recorded patterns. We are also working on building up a smart home lab by deploying wireless sensor networks, containing various environmental and device sensors, in a real-home environment.

Another direction for future research we want to explore is to tie our findings back in to our earlier work on a design methodology for medical healthcare systems with a socio-technical perspective. Our research has shown that ambient intelligent systems can benefit from a clinical knowledge model, but we have not yet explored the relation with the different knowledge containers in detail. Additionally, we want to deploy our reasoning framework in a private cloud environment for data mining and more efficient case retrieving, since the current implementation is limited by the computing power of the device.