Next Article in Journal
A Multispecies Cross-Diffusion Model for Territorial Development
Next Article in Special Issue
Automatic Group Organization for Collaborative Learning Applying Genetic Algorithm Techniques and the Big Five Model
Previous Article in Journal
Coupling the Cell Method with the Boundary Element Method in Static and Quasi–Static Electromagnetic Problems
Previous Article in Special Issue
Discovery Model Based on Analogies for Teaching Computer Programming
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:

A Fuzzy Recommendation System for the Automatic Personalization of Physical Rehabilitation Exercises in Stroke Patients

Cristian Gmez-Portes
José Jesús Castro-Schez
Javier Albusac
Dorothy N. Monekosso
2,† and
David Vallejo
Department of Information Technologies and Systems, University of Castilla-La Mancha Paseo de la Universidad 4, 13071 Ciudad Real, Spain
School of Built Environment, Engineering and Computing, Leeds-Beckett University, Leeds LS6 3QT, UK
Author to whom correspondence should be addressed.
These authors contributed equally to this work.
Mathematics 2021, 9(12), 1427;
Submission received: 17 May 2021 / Revised: 10 June 2021 / Accepted: 17 June 2021 / Published: 19 June 2021


Stroke is among the top 10 leading causes of death and disability around the world. Patients who suffer from this disease usually perform physical exercises at home to improve their condition. These exercises are recommended by therapists based on the patient’s progress level, and may be remotely supervised by them if technology is an option for both. At this point, two major challenges must be faced. The first one is the lack of specialized medical staff to remotely handle the growing number of stroke patients. The second one is the difficulty of dynamically adapt the patient’s therapy plan in real time whilst they rehabilitate at home, since their evolution varies as the rehabilitation process progresses. In this context, we present a fuzzy system that is able to automatically adapt the rehabilitation plan of stroke patients. The use of fuzzy logic greatly facilitates the monitoring and guidance of stroke patients. Moreover, the system is capable of automatically generating modifications of existent exercises whilst considering their particularities at any given time. A preliminary experiment was conducted to show the advantages of the proposal, and the results suggest that the application of fuzzy logic may help make correct decisions based on the patient’s progress level.

1. Introduction

One in six people will suffer a stroke during their lifetime. Globally, stroke causes more than 6 million deaths each year, according to statistics provided by the World Health Organization [1]. Approximately two-thirds of stroke survivors leave hospital with some form of disability. Current predictions for the coming years are, unfortunately, negative, due to factors such as the incidence of stroke in middle-income countries [2]. In fact, 70% of strokes globally occur in low- and middle-income countries. This figure has doubled in recent decades, while in high-income countries, it has fallen by 42% [1]. The impact of this unresolved clinical challenge on health systems is enormous, due to issues such as the continuous need for physical rehabilitation and face-to-face supervision by qualified medical staff. In addition, stroke often affects people who are at the productive peak of their working careers, which can also have an impact on a country’s socioeconomic development [3].
Much of the post-stroke rehabilitation process focuses on the physical rehabilitation of patients. In this process, both physiotherapists and occupational therapists guide the patient to regain day-to-day autonomy by addressing the movement and mobility difficulties resulting from stroke. In this sense, rehabilitation plans are usually designed around the concept of self-care, i.e., based on activities and exercises that the patient can progressively perform at home and in an independent way, whenever possible. The intensity of rehabilitation will depend on the condition of each patient, although it is quite common to carry out daily sessions of 45 min for periods of between 2 and 6 weeks. In more severe cases of stroke, rehabilitation may last several months.
In recent years, a significant number of applied research studies have appeared in which technology has been used to deploy virtual home rehabilitation systems [4,5]. These pursue the dual goal of facilitating patient monitoring and motivating patients to carry out rehabilitation exercises at home. These systems generally provide natural interaction mechanisms in a 3D virtual environment, guiding and helping patients to perform rehabilitation exercises in a playful and enjoyable way. Typically, a system offering such features will consist of (i) a device that can detect the patient’s movements by means of a tracking system that calculates the positions and orientations of the joints in 3D space; (ii) a laptop running the system’s software; and (iii) a monitor that provides visual feedback. It should be noted that technological solutions based on the low-cost Microsoft KinectTM device have underpinned much of the research work conducted in recent years [6], with numerous studies giving credit to the clinical validity of the generated tools [7,8]. However, this device has already been replaced by more modern and scalable alternatives.
In order for a remote rehabilitation system to be used effectively from home, different aspects need to be considered. Firstly, usability is essential. If the underlying technology involves an entry barrier for the patient, then the system will be discontinued. Such a system can be considered usable when technology becomes transparent and natural for the patient. In this sense, natural interfaces based on gesture and movement detection are particularly relevant. At the same time, the system must be able to offer continuous assistance to the patient, making it as easy as possible to use the system, especially when approaching the system for the first time. Secondly, the ability to motivate the patient is another fundamental element to guarantee the continuous use of the system, since rehabilitation routines are usually based on the systematic repetition of a limited set of exercises. The integration of gamification techniques has been used in recent years to increase patient motivation [9]. Thirdly, the system must be able to recognize, with a certain precision and in an automatic way, the movements or exercises performed by the patient, which are usually previously assigned by the therapist. Home rehabilitation systems are often designed to encourage the patient to complete the entire routine, even if the execution is not perfect. In this regard, it is often desirable to strike a balance between the economic cost of the tracking system and the accuracy of the system.
A system that integrates these three fundamental characteristics will maximize the chances of successful use, guiding the patient through the rehabilitation process at home, facilitating the therapist’s work, and ultimately, improving the quality and effectiveness of remote rehabilitation. However, the therapist would still be responsible for the individualized supervision of each patient according to their inherent condition (considering aspects such as their age, physical condition, or severity of the stroke) and their level of progress according to the assigned rehabilitation routine. Ideally, a remote rehabilitation system may incorporate an intelligent module that would automatically and dynamically adapt this routine for each patient, thus incorporating the notion of personalization. This adaptation would serve, among other things, to recommend more difficult exercises or to suggest variations of exercises based on the patient’s performance.
In the previously introduced research context, our work has been essentially focused on the creation of a comprehensive remote rehabilitation system capable of automatically evaluating and classifying rehabilitation exercises [10]. On these foundations, we also designed a language whose sentences are processed by a software that can automatically generate personalized exergames that motivate the patient to perform rehabilitation exercises. In this article, we focus on the automated and intelligent personalization of the rehabilitation process adapted to each patient [11]. Thus, this paper proposes a fuzzy system for the recommendation of rehabilitation exercises for stroke patients. This system integrates an expert knowledge base defined by means of fuzzy rules and variables that reflects aspects such as the performance of a patient when performing rehabilitation exercises. The system is capable of adapting the rehabilitation plan initially assigned by the therapist. This adaptation takes the form of recommendations for new exercises, or exercises already performed by the patient, depending on the variation in the patient’s level of progress as the rehabilitation process progresses.
The remainder of this article is structured as follows. Section 2 positions our work in the context of recommender systems, and particularly, those that operate automatically in remote rehabilitation systems. Subsequently, Section 3 presents our contribution, discussing the fundamental aspects and addressing the integration in a remote rehabilitation system. Section 4 presents the results obtained after conducting an experiment that illustrates with examples of how the fuzzy recommender system adapts a patient’s rehabilitation routine. These results are discussed in Section 5, and the article ends with a series of conclusions in Section 6.

2. Related Work

When designing remote rehabilitation systems, it is essential to take into account the personalization of the patient’s rehabilitation process. A symbiosis must be sought between the patient, the system, and the clinician, which seeks to adapt to the patient’s progress according to the state of their injury. Achieving this involves the design of recommendation systems that are adaptive to the patient.
The design of a recommender system depends to a large extent on the used information and the available knowledge. Recommender systems can be classified into different groups [12]: (i) user profile recommendation systems; (ii) content recommendation systems; (iii) hybrid recommendation systems; (iv) filter-based recommendation systems; and (v) feature-based recommendation systems.
In the field of remote rehabilitation, recommendation systems based on the user’s profile are commonly used. These systems analyze the patient’s profile, considering their condition and evolution, and based on this, recommend a rehabilitation routine from the established plan for the recovery of their injury.
One of the main problems to be faced when studying a patient’s profile is the uncertainty and vagueness with which the patient’s condition is usually assessed. Furthermore, determining how well they are performing a certain exercise or even establishing how they are progressing represent similar challenges. In this sense, fuzzy logic and linguistic variables [13,14] are well-validated tools to be taken into account when dealing with uncertainty and vagueness.
In the context of remote rehabilitation systems, González-González et al. [15] presented a proposal in which the general objective is the design of an intelligent rehabilitation system based on exergames, consisting of an exercise player and a tool for designing them. The system includes a recommendation module that analyses the user’s interactions, physical history, and preferences to assign the exergames to be performed. In turn, this module handles the concepts of difficulty levels and user skills. The recommendation algorithm revolves around three simple assumptions based on the patient’s most recent performance (last exergame performed): (i) if the performance was low, the algorithm chooses an easier exergame; (ii) if the performance was good, the algorithm assigns a more difficult exercise; (iii) otherwise, the algorithm chooses an exercise of medium difficulty. The system was evaluated with domain experts, users and therapists, with positive results in terms of gesture-based interaction and medical applications.
Esfahlani et al. [16] discussed a serious game designed for the user to perform a series of tasks based on a dynamic of reaching virtual goals with a therapeutic objective. The difficulty levels of these tasks are adjusted based on a fuzzy controller, which has the user’s skeleton tracking data (position and orientation of joints in 3D space) as input and the difficulty level of the game that the patient will perform later as output. In this sense, the proposed system allows to guide, in an automatic way, the patient’s rehabilitation routine through continuous and personalized learning. The fuzzy rules are derived from consultancy and collaboration with physiotherapists, along with the various tests carried out. On the other hand, the authors of [17] describe related work in which a grammar is used to enable therapists to specify rehabilitation exercises. The system includes a fuzzy logic-based component that evaluates, in real time, whether the patient performs the exercises according to the exercise definition. In a related context, the prototype of the patient rehabilitation station that integrates video games for rehabilitation based on computational intelligence techniques is presented in [18], both for the online monitoring of the execution of movements during the games and for the adaptation of the game to the patient’s condition. The prototype integrates a fuzzy system to monitor the execution of the exercises, in real time, according to the clinical constraints defined by the therapist at the time of configuration, and to provide direct feedback to the patients. At the same time, the system adapts to modify the game according to the patient’s current performance and progress and to the exercise plan specified by the therapist. This latter work represents one of the pillars of the methodology for the design of safe, therapeutic exergames introduced by these same authors [19].
In a line of research more linked to the management of expert knowledge, a tele-rehabilitation system for the remote selection, evaluation and management of physical therapies is proposed in [20]. The main contribution of this work is the creation of an integral system for tele-rehabilitation, although the authors place special emphasis on the extraction and use of knowledge through the definition of an ontology composed of 2300 classes and 100 properties, to appropriately select the exercises assigned to each patient. To do this, a knowledge base is used that contains information about the patient’s medical history and the previously assigned treatment.
On the other hand, Karime et al. [21] proposed a web-based framework for wrist rehabilitation that makes use of fuzzy logic to offer adaptive tasks to the patient, in parallel with the supervision performed by the therapist. In this work, an evaluation of the effectiveness of the framework is carried out, considering the adjustment of various parameters used in the rehabilitation process in a framework that combines the level of personalization of the rehabilitation based on the patient’s performance and the feedback offered by the therapist. The use of fuzzy logic is also present in articles focusing on patient rehabilitation using robots or exoskeletons, such as the work discussed in [22], where a system based on deterministic adaptive robust control is introduced whose control parameters are optimized thanks to a novel approach based upon cooperative game theory. External disturbances (possibly time-varying) are managed through fuzzy logic and its ability to work with uncertainty.
Our proposal, which is described in detail in Section 3, which falls within the scope of several lines of research that are currently considered popular research topics. Particularly noteworthy is the line that contemplates the definition of artificial intelligence models and the use of expert knowledge to guide or orientate the patient’s evolution, based on their clinical data and the context of their illness. This line is closely related to the impact that precision medicine has had on the medical domain, and whose ideas can be borrowed with the ultimate aim of adapting or personalizing the rehabilitation process to each patient. Furthermore, this work is also framed in the field of telemedicine tools in the context of physical rehabilitation, thus trying to respond to an unresolved clinical challenge as a consequence of the lack of specialized clinical staff to supervise patients affected by stroke or, from a more general point of view, by neurological diseases requiring physical rehabilitation.
Thus, the main contributions of this research article are as follows:
  • Firstly, a recommendation module which can automatically modify rehabilitation plans previously devised by physicians is proposed. Conditional knowledge is defined to select the most suitable exercise for the patients, depending on their current condition and how they progress in terms of rehabilitation;
  • Secondly, the gap between the rehabilitation system in which the recommendation module is integrated and the patients/physicians is reduced, thanks to the use of fuzzy logic to both represent and infer knowledge. This approach facilitates the understanding of the artificial system, and particularly, how the recommendation module operates. We think that this contribution is especially relevant when it comes to explain how artificial systems make decisions. Furthermore, the feedback provided to the patients can be used to guide the rehabilitation process in a dynamic way;
  • Thirdly, the proposal sets the foundations for providing physicians with a tool that reduces the time spent supervising stroke patients. Currently, there is a lack of specialized personnel to supervise, face-to-face and on a regular basis, patients affected by neurological diseases that require physical rehabilitation. Our work may eventually help improve the quality and effectiveness of remote rehabilitation by addressing the automatic adaptation of rehabilitation routines.

3. Material and Methods

3.1. Remote Rehabilitation System Overview

In this section, a fuzzy system for automatically recommending rehabilitation exercises for stroke patients is proposed. Particularly, the exercises recommended by this system are therapeutic exergames, which involve physical effort guided by gamification techniques. Fundamentally, this system was mainly designed to enable patients to perform home rehabilitation exercises, according to their condition and situation at a given moment of their therapy. The proposed approach employs the therapist’s knowledge to evaluate the patient mobility and recommend, in consequence, a rehabilitation exercise according to such information. However, it should be pointed out that the recommendation of an exercise when patients perform rehabilitation at home is exacerbated, since the adjustment of the therapy turns into a more complex process by having a fuzzy idea of their current situation. This system bears this in mind, and is able to automatically generate personalized modifications of existent exercises by considering the particularities of the patients. Despite this, it should be noted that the system does not pretend to remove the therapist’s role. On the contrary, it aims to complement it in order to reduce their workload by delegating tasks to the proposed intelligent system.
The system introduced herein consists of several components that interact between them. Figure 1 depicts the overall architecture, whose interrelated components are the domain knowledge module (i); the interface module (ii); the tracking module (iii); the evaluation module (iv); and the recommender module (v). Each component is briefly described below.
The domain knowledge module integrates the knowledge necessary for the system to correctly work. This module considers the following aspects: knowledge about the physical rehabilitation of stroke patients, knowledge about the performance of rehabilitation exercises, knowledge about managing their rehabilitation plan, knowledge about the patient’s body, their injury, their condition, and the evolution in their rehabilitation. This module is referred to as the knowledge of domain experts from a higher perspective. Specifically, this is structured and organized in three specific classes of knowledge, which are clearly differentiated: declarative knowledge, procedural knowledge, and conditional knowledge:
  • Declarative knowledge. It refers to the facts or static knowledge. In this regard, it defines the set of existent body joints that can be exercised during the rehabilitation, which will be recognized by the system (i.e., J = { j 1 , j 2 , , j 31 }, accessed on 11 June 2021), the constraints associated with them (i.e., C ( J ) = { C ( j 1 ) , C ( j 2 ) , , C ( j 31 ) } ), the associated variables to monitor the rehabilitation exercise of patients (i.e., V = { v 1 , v 2 , , v k } );
  • Procedural knowledge. This knowledge defines the rehabilitation exercises and the game dynamics associated with them (i.e., E = { e 1 , e 2 , , e n } . In each e i E , the patient works out a concrete joint (i.e., j x J ) with a different degree of complexity, trying to rehabilitate a body member with low mobility. The procedural knowledge also includes the knowledge required to check how well the patient performs an exercise and to determine how the patient is progressing in the rehabilitation process;
  • Conditional knowledge. This knowledge will be used to recommend the next exercise to be performed in the patients’ rehabilitation plan (i.e., e i E ), based on their degree of injury and their progress towards recovery. Fundamentally, it makes use of a set of fuzzy (if–then) rules (i.e., R = { r 1 , r 2 , , r m } ) to achieve the aforementioned goal. This will be deepened in the following section.
The interface module enables the communication between the patient/therapist and the system. On the one hand, it includes the adequate interaction mechanisms so that patients perform rehabilitation exercises as if they played games. On the other hand, it provides the software components to the therapists in order to define rehabilitation exercises and game dynamics associated with them.
The tracking module is responsible for recognizing in real time the users’ movements to perform rehabilitation exercises. In essence, it captures the body tracking results from a sensor device, in this case Microsoft Azure Kinect DK, accessed on 11 June 2021. These results represent the 3D spatial coordinates of the human body joints, i.e., positions (x, y and z) R 3 , and rotations (w, a, b and c) R 4 . The latter is expressed as a normalized quaternion.
The evaluation module assesses the performance of a rehabilitation exercise according to the level of complexity that it entails for the patient. This information is necessary to know the patient’s status within the context of the rehabilitation plan and to recommend new rehabilitation exercises.
The recommendation module is responsible for modifying the patient’s rehabilitation plan according to the patient’s current condition. This module will make use of conditional knowledge to determine the most appropriate exercise for the patient based on their injury and their current level of progress within their rehabilitation plan. This module, which is the core of the paper, is fully detailed in the next section.
As described above, procedural knowledge contains the exercises used in this system. These are physical activities to be executed by patients within the rehabilitation plan with a motivational approach that is based on play, i.e., exergames. The exergame constitutes the core of the system and it is defined as a 8-tuple, consisting of the following elements:
e i = < D i , J I i , S E T i , V E i , T i , R G i , C i ( J I i ) , K P I i >
where each element represents the following:
  • D i is a description of the exercise e i ;
  • J I i is the set associated with the joints involved in the rehabilitation exercise e i , i.e., J I i J ;
  • S E T _ i is the setup of the exercise which is defined as a 4-tuple ( s c , r p , t , c ) . s c indicates the degree of success by achieving a step in the rehabilitation exercise e i ( s c N ); r p are the repetitions required to perform the exercise e i ( r p N ); t is the time needed to finish the exercise e i ( t R ); and c is the degree of complexity of the exercise ( c N );
  • V E i represents the virtual objects positioned in a playable scene in the 3D space. Examples of this objects may be rings, spheres and hoops, among others;
  • T i refers to the trajectories associated with the movements that a patient will make when performing the exergame e i . T i is defined as a set of virtual points that establish the movements the patient must perform;
  • R G i is a set of rules that contains the game mechanics of the exercise e i , which are based on the interaction between J I i and T i in the 3D space to achieve an objective. Formally, R G i = ( r g i 1 , r g i 2 , , r g i n ) , where each particular rule of the game r g i j is used to define the function J I i × V E i × O G M where:
    J I i establishes the joints that interact with the game rule;
    V E i establishes the virtual nodes that interact with the game rule;
    O is a set of objectives defined to satisfy the game rules ( O = { o 1 , o 2 , , o m } );
    G M is a set of game mechanics to be triggered when a joint involved J I i interacts with a virtual node V E i meeting a certain objective o j . Example of game mechanics may be visual feedback provided to the patient to correct a bad movement.
  • C i ( J I i ) is a set of constraints that are associated with joints that the patient should not ideally move to compensate for the lack of mobility or strength in the exercise e i (i.e., ( C i ( J I i ) C ( J ) );
  • K P I i is a set of key performance indicators that are used to monitor the patient’s evolution according to the performance of the exercise e i .

3.2. Proposed Recommendation Module

This module aims to help therapists recommend new exercises to patients who perform home rehabilitation. Generally, therapists ask patients to carry out a series of exercises at home, when the therapy has not yet been completed in the rehabilitation center. Once the patients return to the clinic, therapists interview them about how they have performed the exercises and evaluate their progress in order to be able to recommend new exercises. Without the use of technology, the therapists’ knowledge may be inaccurate regarding the patients’ progress as they do not know their commitment at home.
The developed system will collect data on how the patients have performed exercises at home within their rehabilitation plan. In addition, the system, using an intelligent recommender, is able to adapt the rehabilitation plan to the patients’ needs. This section presents the architecture devised for the intelligent rehabilitation module which will be used by the general system to autonomously modify the patients’ rehabilitation plan according to their evolution.
However, entering before fully into detail of the formal model, the next subsection shows the fundamental ideas of the proposed system.

3.2.1. Fundamental Ideas

This system allows therapists to define a rehabilitation therapy based on the patients’ injury and the their initial assessment regarding the patients’ condition (their injury state, their physical condition, and their age).
Particularly, the overall rehabilitation system makes use of the gym metaphor to define a rehabilitation therapy. This means that our approach is based on the global concept of patient’s rehabilitation plan, which can be considered as a succession of exercises taken from E and ordered by their complexity, which must be carried out by the patient in a sequential way. However, the plan should be able to be altered according to the patient’s progress. Thus, provided that the system detects that the patient is finding difficulties to perform an exercise in the plan, the system should be capable of recommending an exercise with lower complexity. It even may modify an existent exercise, reducing the number of repetitions or increasing the time to be spent on it. On the other hand, the system should behave in a similar way when in a situation in which complex exercises are easily performed.
Thus, a rehabilitation plan for a patient p i , denoted as P ( p i ) , is defined as follows: P ( p i ) = { e x , e y , , e k } where each e j P ( p i ) is also an element of E (i.e., e j E ) and it is satisfied that C o m p l e x i t y ( e x ) C o m p l e x i t y ( e y ) C o m p l e x i t y ( e k ) with C o m p l e x i t y ( e j ) being a function that returns the complexity of the exergame e j (taken from c S E T _ j ).
As mentioned above, the exercises that form part of a patient’s plan are initially selected and organized by the therapists according to the patient’s injury and condition. The recommendation module will automatically adjust the plan according to the patient’s performance, acting on the set of exercises included, their order or even their configuration (values of parameters r p (number of repetitions) and t (time needed to finish the exercise) taken from S E T x ).

3.2.2. Recommender Module Definition

The recommendation system presented herein has been proposed as a function that will determine an action on the patient’s rehabilitation plan to be adjusted, as much as possible, to the patient’s state of recovery. Therefore, this function models the existing relationship between the domain, i.e., the patient’s condition in the recovery of the injured limb, and the codomain, i.e., an action to be performed in the rehabilitation plan.
The challenge to be faced is the domain of definition of such a function. This should provide information on how the patients are progressing in their recovery. It will be determined by how they have performed the last exercise of the plan as well as the state in which they are found regarding their recovery.
The variables, which can be recorded by the system, and can provide information on how the patient performed the last exercise of the plan, are defined below:
  • difference_number_steps ( V 1 ) is the difference between the number of steps that the patients and the therapists performed to carry out the last rehabilitation exercise l a s t _ e x g (i.e., the patient fails to pass through all the virtual points that establish the exercise trajectory);
  • accumulated_deviation ( V 2 ) is the cumulative spatial deviation between the patient’s exercise and that gold standard or the therapist’s exercise (i.e., this calculation is based on the distance accumulated when traversing the trajectory associated to the last exercise l a s t _ e x g );
  • difference_time ( V 3 ) is the temporal difference regarding the execution of the last exercise l a s t _ e x g between the patient and the therapist.
These variables collect information about the patients’ status, i.e., how they have performed the last exercise of the allocated plan. However, they do not take into account their evolution, that is, how they have progressed. Significantly, it becomes essential to add this information to the domain to know the actual state of the patient in detail. Thus, the variable progress_level ( P P L ) was included in order to track the state in which a patient is found before performing the last exercise. Its value belongs to the range [ 0 , 10 ] , and the initial one is determined by the therapists when they assess the patient for the first time. It should be noted that the value of the previous variable is considered to choose the exercises for the patient’s rehabilitation plan. Furthermore, this variable is modified depending on the patient’s evolution towards the last recovery session.
On the other hand, the codomain should reflect the next exercise to be performed by the patients according to their condition. In this research work, the initial rehabilitation plan established by the therapist is modified by proposing a new exercise based on a desirable difficulty recommended to the patient. Thus, the output will consist of a new exercise, which will be established depending on the difficulty given by one of the following functions:
  • p r o p o s e _ e x e r c i s e . It chooses an exercise from E whose lesion and joint J I i are similar to the last exercise l a s t _ e x g . This function takes into account an exercise that has not yet been performed, since the system internally stores information about the patients and the exercises they performed, i.e., their level of success regarding the exercise, their points, as well as the time spent by the patient to complete it. To do this, this function takes two parameters: (1) a label indicating the complexity of the exercise to be searched for ( M C , more complexity; S C , same complexity; L C , less complexity) based on the (2) last performed exercise ( l a s t _ e x g );
  • r e p e a t _ l a s t _ e x g . It recommends the repetition of the last exercise performed by the patient l a s t _ e x g based on modifying its configuration. This function takes as parameters r p (number of repetitions) and t (time needed to finish the exercise) from S E T l a s t _ e x g .
It is important to highlight that the execution of the last exercise influences the patient’s progress level, i.e., the results from the execution of the l a s t _ e x g affects the value of the variable progress_level ( P P L ). This is why any action on this variable will also be included as an output of the recommender system. This variable, denoted as E P P L , is named Effect_on_PPL.
When modeling the function that relates the domain or inputs to the codomain or outputs, a mechanism is used to understand why the recommendation was made. At the same time, this mechanism also deals with the imprecision and uncertainty that exists when evaluating the performance of the last exercise performed by the patient. Even when evaluating the level of progress of the patient within the context of their rehabilitation plan. For this reason, a set of IF-THEN fuzzy rules (R), which model the function V 1 × V 2 × V 3 × P P L E × E P P L , are defined.
The linguistic variable V (i.e., V = { V 1 , V 2 , V 3 } ) considers the following domain of definition: D D V x = { very low ( V L ), low (L), medium (M), high (H), very high ( V H )} being x defined from 1 to 3. Each linguistic value in D D V x is defined by means of a trapezoidal function ( Π ), enclosed by a lower limit a, an upper limit d, a lower support limit b, and an upper support limit c, where a < b < c < d (see Equation (2)). If the values of b and c are equal, a triangular function is obtained:
Π ( x ; a , b , c , d ) = 0 i f f x < a ( x a ) / ( b a ) i f f a x < b 1 i f f b x c ( d x ) / ( d c ) i f f c < x d 0 i f f x > d
The choice of the trapezoidal function to construct the membership function, for each of the values that the variables used in the system can take, is justified because it is the only one that gives us the necessary freedom to represent any type of value (i.e., ordered-discrete or ordinal, unordered-discrete or nominal, boolean, numerical, ranking or the most frequent continuous) [23].
The domain of the definition of each variable V x V , i.e., D D V x , is matched to the normalized measurements { 0 , 0.25 , 0.5 , 0.75 , 1.0 } . The membership value was confined to the closed range [ 0 , 1 ] . The corresponding fuzzy membership set is depicted in Figure 2.
On the other hand, the linguistic input variable P P L may take the following values: “excellent achievement” ( E A , equivalent to 9 or 10); “outstanding achievement” ( O A , equivalent to 7 or 8); “satisfactory achievement” ( S A , equivalent to 5 or 6); and “not achieved” ( N A , smaller than 5). Each linguistic value that this variable can take is defined by means of a trapezoidal function—as can be seen Figure 3.
The linguistic output variable E P P L takes the following values: “substantial decrease” ( S D , equivalent to decrease 1 point); “moderate decrease” ( M D , equivalent to decrease 0.5 point); “no change” ( N C ); “moderate increase” ( M I , equivalent to increase 0.5 point); and “substantial increase” ( S I , equivalent to increase 1 point). Each one of these linguistic values will also be defined by means of a trapezoidal function—as can be seen in Figure 4. It is purely used to modify the patient’s level of progress as the patient recovery level potentially suffers a change after a physical activity. The operations to be considered are three: increasing the patient’s progress, decreasing it or maintaining it.
Knowledge engineering techniques have been used during the design of the system, mainly based on interviews with physicians, using designs and executions which have been fine-tuned in different stages as a basis. Thanks to this process, the rules and the variables and values they take have been determined, seeking a compromise between understandability and efficiency.
As for the other output of the system, it will be a recommended exercise for the patient by invoking the function p r o p o s e _ e x e r c i s e , as mentioned above. This function will recommend an exercise from the set P ( p i ) with higher, lower or same complexity as the last exercise performed by the patient. Otherwise, if the exercise to be recommended is not found, E will be used. The function is shown in Algorithm 1. It should be pointed out that we assume an exercise will certainly be taken from E.
Invoking the function r e p e a t _ l a s t _ e x g ( r p , t ) involves recommending to the patient the repetition of the last performed exercise e y , however, altering some of its configuration parameters from S E T y , namely r p by setting a different number of repetitions, or t by giving a different time to finish the exercise e y . The modification of the values may be an increase (+) or reduction (-) in the parameters r p and t.
Algorithm 1: Behavior of proposed exergame function.
Mathematics 09 01427 i001
Each rule r i R has the following form: IF V 1 is D D V 1 ( i ) AND V 2 is D D V 2 ( i ) AND V 3 is D D V 3 ( i ) AND P P L is D D V P P L ( i ) THEN e y and E P P L is D D V E P P L ( i ) . On the one hand, e y represents the exercise to be recommended. On the other hand, D D V x ( i ) represents the values that the variable V x takes in the rule i, that is, D D V x ( i ) D D V x . Similarly, D D V P P L ( i ) and D D V E P P L ( i ) represent the values that the variables P P L and E P P L take in the rule i, respectively, where D D V P P L ( i ) D D V P P L and D D V E P P L ( i ) D D V E P P L . The set D D V x is a global set that represents the values that must take the variable V. Furthermore, the set D D V P P L and D D V E P P L are the global sets that represent the values that must take the variables P P L and E P P L .
Lastly, some of the rules defined in this system to model the behavior of the recommender system, which will constitute the conditional knowledge of the remote rehabilitation system, are shown below:
r 1 :IF d i f f e r e n c e _ n u m b e r _ s t e p s is { V L }
AND a c c u m u l a t e d _ d e v i a t i o n is { V L }
AND P P L is { E A , O A }
THEN p r o p o s e _ e x e r c i s e ( H C , l a s t _ e x g ) AND E P P L is { S I }
r 5 :IF d i f f e r e n c e _ n u m b e r _ s t e p s is {M}
AND d i f f e r e n c e _ t i m e is {M}
AND P P L is { S A }
THEN p r o p o s e _ e x e r c i s e ( S C , l a s t _ e x g ) AND E P P L is { N C }
r 9 :IF a c c u m u l a t e d _ d e v i a t i o n is { V H }
AND d i f f e r e n c e _ t i m e is { V H ,H}
AND P P L is { S A }
THEN p r o p o s e _ e x e r c i s e ( L C , l a s t _ e x g ) AND E P P L is { S D }
r 11 :IF d i f f e r e n c e _ n u m b e r _ s t e p s is {M}
AND a c c u m u l a t e d _ d e v i a t i o n is {M}
AND d i f f e r e n c e _ t i m e is {M}
AND P P L is { N A }
THEN r e p e a t _ l a s t _ e x g ( r p , + t ) AND E P P L is { N C }
At this point, we must clarify that a variable not appearing in a rule means that all the values of its definition domain may be taken. For example, in the rule r 1 , the variable d i f f e r e n c e _ t i m e ( V 3 ) takes the following values: { V L , L , M , H , V H } . As can be seen, the rules are highly explainable, which will help understand why the system makes a new recommendation.

3.2.3. Functions Of The Proposed Recommender System

In this section, we present how the proposed system uses the fuzzy rules presented above to recommend a new rehabilitation exercise and to alter a patient’s progress level.
Given that the output of the rules consists of two elements, that is, the recommended exercise and an alteration in the value of the patient’s progress level, two outputs need to be obtained for each occurrence of the inputs ( V 1 × V 2 × V 3 × P P L ). Therefore, the system infers two situations for each input, which are enumerated below:
  • The next rehabilitation exercise that the patient should perform;
  • How to alter the value of the patient’s progress level.
For this purpose, we will consider that the rules inform of the following two relations, since the consequent is related to a logical AND: V 1 × V 2 × V 3 × P P L E and V 1 × V 2 × V 3 × P P L E P P L .
To infer within the first relationship, we will check the activation degree of each rule. This will be done by evaluating the antecedent of each one. This evaluation is performed as discussed subsequently.
A function φ j i will be associated with each variable V i in the rule j, whose definition depends on the values taken by the variable V i in it. Therefore, if the variable takes a single linguistic label L x (i.e., L x D D V i ), the definition of the function φ j i will be the same as the one defining the linguistic value (i.e., φ j i = Π L x ). However, when the variable takes more than one linguistic value, this function will be built based on whether or not the values are close to the domain of definition of the variable V i , i.e., D D V i . For consecutive linguistic values, we will refer to this set as C. The function φ j i will be defined as a trapezoidal one with the following parameters:
a = m i n a { Π L x ( x ; a , b , c , d ) | L x C }
b = m i n b { Π L x ( x ; a , b , c , d ) | L x C }
c = m a x c { Π L x ( x ; a , b , c , d ) | L x C }
d = m a x d { Π L x ( x ; a , b , c , d ) | L x C }
If the variable V i in a rule takes non-consecutive values, or there are two non-consecutive groups of values, the function φ j i will be defined with as many trapezoidal functions as there are non-consecutive values or non-consecutive groups (Figure 5).
Example 1.
For the rule r 1 shown above, which is: IF V 1 is {VL} AND V 2 is {VL} AND V 3 is {VL,L,M,H,VH} AND PPL( V 4 ) is {OA,EA} THEN p r o p o s e _ e x e r c i s e ( M C , l a s t _ e x g ) AND EPPL is {SI}, the φ 1 i functions will be defined as follows:
φ 11 ( x ) = Π V L ( x ; 0 , 0 , 0 , 0.25 ) φ 12 ( x ) = Π V L ( x ; 0 , 0 , 0 , 0.25 ) φ 13 ( x ) = Π { V L , L , M , H , V H } ( x ; 0 , 0 , 1 , 1 ) φ 14 ( x ) = Π { O A , E A } ( x ; 6 , 7 , 10 , 10 )
The activation degree of a rule r j for an input ( x 1 , x 2 , x 3 , x 4 ), where x i is the input value (crisp value) taken by the variable V i , will be calculated by determining the membership value of each input x i to the function that defines the input variable V i , i.e., φ j i ( x i ) . Given that the antecedent of our rules has more than one part related with a logical AND operator, the t-norm [24] of the minimum has been applied to obtain a single membership value. The definition of this calculus is as follows:
activation degree ( r j ) = m i n i = 1 , , 4 { φ j i ( x i ) }
To obtain the output of this first inference process, the t-conorm [24] of the maximum will be used (i.e., the t-conorm corresponding to the minimum t-norm). As a result, the system will recommend the exercise that proposes the rule with the highest activation degree:
output _ exercise ( r j ) = m a x j = 1 , , n { activation degree ( r j ) }
On the other hand, the inference of the second relationship has been carried out by using the Mamdani’s fuzzy inference method [25], whose output is a fuzzy set. This fuzzy inference process is composed of the following steps:
  • Evaluate the antecedent for each rule r j R to obtain a single membership value, i.e., activation degree ( r j ). We will do this as in the previous case;
  • Obtain the conclusion of each rule in E P P L . To do this, we truncate the fuzzy value taken by the consequent of the rule in the variable E E P L using the minimum with the activation degree( r j ) on its membership function. The output will be a new fuzzy set defined by means of a membership function μ j where:
    μ j : [ 1 , 1 ] [ 0 , activation degree ( r j ) ]  
    and it is defined as
    μ j ( x ) = m i n { Π L x ( x ) , activation degree ( r j ) }
    with L x being the value that the variable E P P L takes in the rule r j ( L x D D V E P P L ).
  • Aggregate rule’s conclusions into a single fuzzy set defined by means of the function μ , using a fuzzy aggregation operator. The t-conorm of the maximum has been used to aggregate the truncated output functions returned by the previous step:
    μ ( x ) = m a x j = 1 , , | R | { μ j ( x ) }
  • Defuzzification. Since we want to obtain a crisp value that affects to the P P L value, which we recall is confined to the range [ 0 , 10 ] , so we need to transform the fuzzy set obtained in step 3 into a single numerical value. To do this, we used the defuzzification method of the centroid, which returns the center of the area under the fuzzy set obtained in step 3. It should be pointed out that the total area of the membership function distribution used to represent the combined control action is divided into a number of sub-areas. We denote the centroid as E P P L c o and it is calculated as
    E P P L c o = i = 1 N x i μ ( x i ) i = 1 N μ ( x i )
    where N indicates the number of sub-areas, μ ( x i ) and x i represent the area and the centroid of the area, respectively, of the i t h sub-area.
The value E P P L c o ( E P P L c o [ 1 , 1 ] ) is used to modify the patient’s progress level ( P P L ) with the aim of updating their progress:
P P L = 0 i f f P P L + E P P L c o 0 P P L + E P P L c o i f f 0 < P P L + E P P L c o < 10 10 i f f P P L + E P P L c o 10
We would like to conclude by stressing that Zadeh’s conventional t-operators of Min and Max, which have been used in this system, perform significantly well within the context of our problem [26].

4. Proposed System In Operation

This section describes an experimental case study conducted to show the benefits of the proposal discussed in this research work. Then, an example that describes how the fuzzy system that underpins our proposal would work in a real-world situation is presented.
However, before fully entering the description of the experimental case study, let us take a look at the holistic view of the whole recommender system presented in Figure 6 in order to understand how it works with all the modules involved.
  • The system proposes an exercises ( e x E ) to the patient through the interface module;
  • The patient performs an exercise whose movements are captured by the tracking module;
  • The system evaluates, through the evaluation module, the performance of the patient. Particularly, it obtains the value of the variables ( V 1 , V 2 , V 3 );
  • The system, based upon the values of the variables ( V 1 , V 2 , V 3 , and P P L ), triggers the rules following the next criteria:
    It computes the activation degree of the rules belonging to the knowledge base (i.e., conditional knowledge);
    It selects, employing the first inference system, the rule whose activation degree is greater among the set of rules. Its consequent contains the exercise to be recommended, which may be a new one or a modification of the last exercise performed;
    It modifies, employing the second inference system, the patient’s progress level ( E E P L ). It should be noted that this modification takes into account the last exercise performed.
Consider a stroke patient whose mobility on the left side of the body has been substantially reduced. Fortunately, the patient’s progress has relatively improved over the past few sessions. Imagine that the last exercises performed consisted in, from an upright bipedal posture, raising the left arm from the hip to the shoulder, passing the hand in red color through the spheres placed in the 3D world that draw a trajectory. Fundamentally, the hand must pass first through the sphere close to the hip and with the largest size, ending the repetition when the colored joint reaches the sphere close to the shoulder and with the smallest size. This exercise comprises three repetitions and it must be completed under two minutes. Figure 7 graphically shows the left shoulder abduction by means of a virtual system in which the patient simulates the movement, so that their left hand touches the colored spheres.
Example 2.
Assume that the value of the variable P P L is assigned to 4.5 based on the last session. After performing the last exercise, the values of the variables V 1 , V 2 and V 3 were obtained. They are 0.75 , 0.80 and 0.55 , respectively. The process to obtain the E P P L value is described below.
The previous description means that the patient took more steps than the therapist. The trajectory between them differed considerable. However, the patient did not spend much more time on completing the exercise than the therapist. It should be reminded that the values of these variables are the result of the mean after the patient performing all repetitions.
It should be highlighted that the previous values of the input scores are computed taking into account the configuration S E T i and the performance of the therapist. However, the underlying details of this process are not provided as it is beyond the scope of this paper.
Considering this situation as an starting point, the inference process that this system carries out is discussed subsequently. At this point, it is important to point out that the system infers two situations for each input, i.e., V 1 × V 2 × V 3 × P P L E and V 1 × V 2 × V 3 × P P L E P P L .
The first inference process consists of proposing a physical rehabilitation exercise that is best suited according to the patient’s situation. Initially, the values associated with each input v i are applied to each rule r j to obtain its activation degree. We show below only the rules from R whose activation degree is greater than 0 (i.e., { r i r i R activation degree ( r i ) > 0 }):
r 3 :IF a c c u m u l a t e d _ d e v i a t i o n is { M , H }
AND d i f f e r e n c e _ t i m e is { L , M }
AND P P L is { N A , S A }
THEN r e p e a t _ l a s t _ e x g ( r p , + t ) AND E P P L is { N C }
r 8 :IF d i f f e r e n c e _ n u m b e r _ s t e p s is { M , H }
AND d i f f e r e n c e _ t i m e is {H}
AND P P L is { N A , S A }
THEN p r o p o s e _ e x e r c i s e ( L C , l a s t _ e x g ) AND E P P L is { M D }
r 12 :IF d i f f e r e n c e _ n u m b e r _ s t e p s is { M , H }
AND a c c u m u l a t e d _ d e v i a t i o n is { H , V H }
AND P P L is { N A }
THEN p r o p o s e _ e x e r c i s e ( L C , l a s t _ e x g ) AND E P P L is { S D }
Their activation degrees are as follows:
activation degree ( r 3 ) = 0.80 activation degree ( r 8 ) = 0.20 activation degree ( r 12 ) = 0.50
Therefore, the best compelling exercise to be recommended is obtained from the rule whose activation degree is greater among the set from the previous step. In other words:
m a x { activation degree ( r 3 ) , activation degree ( r 8 ) , activation degree ( r 12 ) }
As a result, the recommended exercise is the one related to the rule r 3 which proposes the repetition of the last performed exercise, but reducing the repetitions and increasing the time. Given that the system infers that the exercise was not well performed because of time, the algorithm responsible for this update proposes two repetitions in 3 min. That is, the system subtracts one repetition and adds one minute. The underlying details of this algorithm are not provided as it is beyond the scope of this paper. This new configuration for the proposed exercise will be used later so as to see the reliability level of the system in terms of decisions making.
On the other hand, the inference of the second relationship was also performed in order to update the patient’s progress level. Clearly, the completion of the last rehabilitation exercise must have had some effect on their progress. Let us see how that effect is computed.
As from the activation degrees previously obtained, the output fuzzy set is truncated with the aforementioned values by using the minimum method. That is, the output fuzzy set is reshaped for each rule r j , whose output is represented by the following new sets defined as membership functions:
μ 3 ( x ) = m i n { Π N C ( x ) , 0.80 } μ 8 ( x ) = m i n { Π M D ( x ) , 0.20 } μ 12 ( x ) = m i n { Π S D ( x ) , 0.50 }
From the outputs calculated in the previous step, an aggregation process is employed to unify these values in a single fuzzy set. The outputs of each rule (i.e., activation degree) are combined into a single fuzzy set as follows:
μ ( x ) = m a x { μ 3 ( x ) , μ 8 ( x ) , μ 12 ( x ) }
In Figure 8, all three rules, which are activated, are displayed to show how their outputs are aggregated into a single fuzzy set ( μ ( x ) ). The membership function of this fuzzy set assigns a weight for every output E P P L value.
Finally, a representative value is obtained after performing the defuzzification step that uses the E P P L c o defined in Equation (11). In the aggregated fuzzy set, as shown in Figure 8, the total area is divided into five sub-areas. This value and with the centroid of each sub-area are calculated in Table 1.
The defuzzified value E P P L c o is: A r e a * x i / A r e a ; 0.36572 / 0.9825 0.38 . Therefore, the new P P L value is updated through Equation (12), that is, 4.5 0.38 = 4.12 . This result indicates that the patient’s progress level should be reduced.
The system now proposes performing the last exercise with reduced repetitions but increased time (output of the rule r 3 ). The repetitions to be taken are 2 and the time is 3 min.
Example 3.
After performing the last proposed exercise, the values of the variables V 1 , V 2 and V 3 are 0.2 , 0.45 and 0.15 , respectively. The P P L value is 4.12 , whose result was obtained in the previous example. The process to obtain the new E P P L value is described below, omitting unnecessary steps.
It is remarkable that the patient correctly performed the exercise. They took almost the same number of steps as the therapist. The trajectory was relatively low. Furthermore, the time spent completing the exercise was also similar to that of the therapist.
As in the previous example, we show below only the rules from R whose activation degrees are greater than 0:
r 2 :IF d i f f e r e n c e _ n u m b e r _ s t e p s is {L}
AND a c c u m u l a t e d _ d e v i a t i o n is {L}
AND P P L is { N A , S A }
THEN p r o p o s e _ e x e r c i s e ( H C , l a s t _ e x g ) AND E P P L is { M I }
r 7 :IF a c c u m u l a t e d _ d e v i a t i o n is { L , M }
AND d i f f e r e n c e _ t i m e is { L , M }
AND P P L is { N A , S A }
THEN p r o p o s e _ e x e r c i s e ( S C , l a s t _ e x g ) AND E P P L is { N C }
r 13 :IF d i f f e r e n c e _ n u m b e r _ s t e p s is {L}
AND a c c u m u l a t e d _ d e v i a t i o n is {M}
AND P P L is { N A , S A }
THEN p r o p o s e _ e x e r c i s e ( S C , l a s t _ e x g ) AND E P P L is { M I }
Furthermore, their activation degrees are as follows:
activation degree ( r 2 ) = 0.20 activation degree ( r 7 ) = 0.60 activation degree ( r 13 ) = 0.80
As a result of applying the output exercise function 8, the rule r 13 is triggered as its activation degrees is greater among the others. Therefore, the best compelling exercise to be proposed by the system is one whose complexity is the same as the last exercise performed. This exercise consists of a left arm abduction, that is, a movement which implies raising the left arm around the shoulder, moving it laterally away from the body. This exercise comprises two repetitions and it must be completed under three minutes. Figure 9 graphically shows the left shoulder abduction by means of a virtual system in which the patient simulates the movement, so that their left hand touches the colored spheres.
Then, the new membership functions are computed as a consequence of truncating the output fuzzy sets with the values previously obtained. In other words:
μ 2 ( x ) = m i n { Π M I ( x ) , 0.20 } μ 7 ( x ) = m i n { Π N C ( x ) , 0.60 } μ 13 ( x ) = m i n { Π S D ( x ) , 0.80 }
After that, a single fuzzy set is obtained by combining the previous outputs using the function 10. The result is as follows:
μ ( x ) = m a x { μ 2 ( x ) , μ 7 ( x ) , μ 13 ( x ) }
Finally, the output, i.e., E P P L c o , is computed using the centroid function defined in (11). Similar to the previous example, the total area is divided into six sub-areas. Table 2 shows the area and centroid of each sub-area. Furthermore, Figure 10 depicts the new aggregated fuzzy set.
The defuzzified value E P P L c o is: A r e a * x i / A r e a ; 0.21148425 / 0.775 0.27 . Therefore, the new P P L value is updated through Equation (12), that is, 4.12 + 0.27 = 4.39 . This result indicates that the patient’s progress level has relatively improved.

5. Discussion

A preliminary evaluation was carried out and the results obtained appear to be quite interesting. The discussed case study showed that the system proposed in this research work is capable of inferring the next rehabilitation exercise and appropriately updating the patient’s progress level. Both tasks are based on the performance of the last exercise made by the patient.
The main goal of the experiment conducted was oriented towards demonstrating the utility of the proposed system. This is the first step before using the system for a clinical trial with patients, who have a suffered moderate or severe stroke, according to the levels measured by the National Institutes of Health Stroke Scale (NIHSS) scoring system. These clinical trials will test the efficacy of the system in the recovery of stroke patients.
Interestingly, the results of the evaluation are in accordance with the values of the input variables v i . The patient’s progress level was relatively low ( P P L = 4.5 ). The time invested was not too bad with respect to the time spent by the therapist ( V 1 = 0.55 ), but the number of steps between the patient and the therapist was significantly different ( V 2 = 0.75 ). In addition, the trajectory greatly differed from the one charted by therapist ( V 3 = 0.8 ). In other words, the exercise was not accurately performed by the patient. This means that the patient preferred to sacrifice accuracy over time. In this regard, the system automatically concluded that the patient needs to keep working out to positively upgrade their progress. Additionally, the system suggested that the patient repeats the last performed exergame, considering that the number of repetitions should be reduced but the time spent in performing the exercise should be increased. Remarkably, the result of this system’s suggestion is coherent taking into account the progress level of the patient ( P P L = 4.12 ) and also the performance of the last exercise proposed ( V 1 = 0.2 , V 2 = 0.45 , V 3 = 015 ). As a result, the patient’s progress level was moderately upgraded, highlighting that this increase is reasonable based on two previous performances. In view of these facts, the reliability of the system is noteworthy. The system adequately performs recommendations and updates the progress of the patient accordingly.
However, one limitation of our research work is the difficulty to test the proposed system with a representative sample of stroke patients due to the current COVID-19 pandemic. To date, we focused our work on evaluating the system from an internal point of view, that is, according to case studies such as the one described in Section 4. Therefore, the results presented in this paper need to be interpreted with caution.
Despite the limitations of this evaluation, our findings suggest that the use of Fuzzy Logic for physical rehabilitation seems to make sense as it enables making decisions in an automatic and understandable way. What this approach offers is to dynamically monitor and guide the home rehabilitation process, whose supervision is difficult to be made by a therapist because of their lack of time and the need for a face-to-face supervision. However, the developed system does not aim at replacing the therapist. On the contrary, it is intended to relieve the therapists’ workload and help them interpret, through an inference process similar to the human one, how the patient progresses as the rehabilitation plan is being completed.
This research aims to be complemented, in a second phase, with a clinical trial to evaluate the impact of using our system on the recovery process of real stroke patients. In a third phase, another clinical trial will be conducted to analyze the efficacy of the system for its intended use, which is to improve physical rehabilitation at home.

6. Conclusions

In order for a remote rehabilitation system to be used continuously and effectively by stroke patients, three essential characteristics must be provided: (i) usability, to remove the barrier that the use of technology may represent, and adequately guide the user in the process of autonomous rehabilitation; (ii) motivation, to encourage the continued use of the system and reduce the possibility of abandonment by the patient; and (iii) autonomy, to be able to automatically recognize and evaluate the rehabilitation exercises performed by the patient without the need for continuous supervision and presence of the therapist. A significant part of the existing research work focuses on one or more of these features, with the therapist being responsible for adjusting the rehabilitation routine according to the level of progress of their patients. Ideally, a remote rehabilitation system that offers an integral solution should be able to offer suggestions or recommendations that enable the ability to customize the rehabilitation routine automatically or semi-automatically.
In this paper, we proposed a new recommender system to determine the next action that should be performed by the patient in their rehabilitation plan. The system is based on a set of fuzzy rules and a double inference process on them. The use of fuzzy logic is justified because it provides patients and physicians with guidance that they can understand. In this sense, the use of linguistic variables makes it easier for them to interpret this information. On the other hand, the recommender system provides the patients with detailed feedback on the work they have done, with an explanation about the areas in which they have performed well, and others which may still need improvement. In addition, on a broader level, patients will be informed whether they have truly performed the rehabilitation routine well.
The approach presented herein shows the potential of automating the work of monitoring and guiding the steps in a patient’s rehabilitation. The idea of this method is not to replace the role of the physician, but to support them with tools that enable them to conduct an efficient rehabilitation process, dedicating their time to higher level tasks. The proposed system is intended to speed up the assignment of exercises to patients and to obtain data that can be provided to physicians. All these data allow them to evaluate and determine the patient’s state of evolution in their injury.
The discussed case study shows the potential of our approach in terms of adapting the rehabilitation process to the patient’s progress level. Particularly, the adoption of fuzzy logic to guide the processes of knowledge representation and inference of recommendations greatly facilitates the automatic customization of rehabilitation routines, since the way such processes are described is inherently close to the way therapists adjust rehabilitation routines. Thus, this research work contributes to increase the level of autonomy for remote rehabilitation systems thanks to the capacity of dynamically adjusting the rehabilitation process.
As future lines of research, we can stress the need to work on a main objective: evaluating the degree of improvement on stroke patients using the proposed system in a real treatment. For doing so, once the system has been validated by the research community, two clinical trials will be conducted. The first will study the impact of using the recommender system on real stroke patients over a significant period of time. The second will study the efficacy of the system on patient recovery. The data collected in these clinical trials will be used for improving the system and exploring other solutions that may be of interest to be included in it.

Author Contributions

Conceptualization, J.J.C.-S., D.V., C.G.-P., J.A. and D.N.M.; methodology, J.J.C.-S., D.V. and D.N.M.; software, C.G.-P.; validation, J.A., J.J.C.-S.; investigation, J.J.C.-S., J.A.; visualization, J.A., C.G.-P.; writing—original draft preparation, C.G.-P., D.V.; writing—review and editing, J.A., J.J.C.-S., D.V. and D.N.M.; supervision, D.V.; project administration, D.V.; funding acquisition, J.A., J.J.C.-S., D.V. and D.N.M. All authors have read and agreed to the published version of the manuscript.


This research was funded by Instituto de Salud Carlos III grant number DTS18/00122, co-funded by the European Regional Development Fund, European Social Fund “Investing in your future”.

Informed Consent Statement

Informed consent was obtained from all subjects involved in the study.

Conflicts of Interest

The authors declare no conflict of interest.


  1. Johnson, W.; Onuma, O.; Owolabi, M.; Sachdev, S. Stroke: A global response is needed. Bull. World Health Organ. 2016, 94, 634–644. [Google Scholar] [CrossRef]
  2. Semrau, M.; Evans-Lacko, S.; Alem, A.; Ayuso-Mateos, J.L.; Chisholm, D.; Gureje, O.; Hanlon, C.; Jordans, M.; Kigozi, F.; Lempp, H.; et al. Strengthening mental health systems in low-and middle-income countries: The Emerald programme. BMC Med. 2015, 13, 1–9. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  3. Mensah, G.A.; Norrving, B.; Feigin, V.L. The global burden of stroke. Neuroepidemiology 2015, 45, 143–145. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  4. Sarfo, F.S.; Ulasavets, U.; Opare-Sem, O.K.; Ovbiagele, B. Tele-rehabilitation after stroke: An updated systematic review of the literature. J. Stroke Cerebrovasc. Dis. 2018, 27, 2306–2318. [Google Scholar] [CrossRef] [PubMed]
  5. Moral-Munoz, J.A.; Zhang, W.; Cobo, M.J.; Herrera-Viedma, E.; Kaber, D.B. Smartphone-based systems for physical rehabilitation applications: A systematic review. Assist. Technol. 2019. [Google Scholar] [CrossRef] [PubMed]
  6. Webster, D.; Celik, O. Systematic review of Kinect applications in elderly care and stroke rehabilitation. J. Neuroeng. Rehabil. 2014, 11, 108. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  7. Clark, R.A.; Pua, Y.; Fortin, K.; Ritchie, C.; Webster, K.E.; Denehy, L.; Bryant, A.L. Validity of the Microsoft Kinect for assessment of postural control. Gait Posture 2012, 36, 372–377. [Google Scholar] [CrossRef]
  8. Mobini, A.; Behzadipour, S.; Saadat, F.M. Accuracy of Kinect’s skeleton tracking for upper body rehabilitation applications. Disabil. Rehabil. Assist. Technol. 2014, 9, 344–352. [Google Scholar] [CrossRef]
  9. Sardi, L.; Idri, A.; Fernández-Alemán, J.L. A systematic review of gamification in e-Health. J. Biomed. Inform. 2017, 71, 31–48. [Google Scholar] [CrossRef]
  10. Schez-Sobrino, S.; Vallejo, D.; Monekosso, D.N.; Glez-Morcillo, C.; Remagnino, P. A distributed gamified system based on automatic assessment of physical exercises to promote remote physical rehabilitation. IEEE Access 2020, 8, 91424–91434. [Google Scholar] [CrossRef]
  11. Vallejo, D.; Gmez-Portes, C.; Albusac, J.; Glez-Morcillo, C.; Castro-Schez, J.J. Personalized Exergames Language: A Novel Approach to the Automatic Generation of Personalized Exergames for Stroke Patients. Appl. Sci. 2020, 10, 7378. [Google Scholar] [CrossRef]
  12. Bhaskaran, S.; Marappan, R.; Santhi, B. Design and Analysis of a Cluster-Based Intelligent Hybrid Recommendation System for E-Learning Applications. Mathematics 2021, 9, 197. [Google Scholar] [CrossRef]
  13. Zadeh, L.A. Fuzzy sets. Inf. Control 1965, 8, 338–353. [Google Scholar] [CrossRef] [Green Version]
  14. Zadeh, L.A. The concept of a linguistic variable and its application to approximate reasoning-I. Inf. Control 1975, 8, 199–249. [Google Scholar] [CrossRef]
  15. González-González, C.S.; Toledo-Delgado, P.A.; Muñoz-Cruz, V.; Torres-Carrion, P.V. Serious games for rehabilitation: Gestural interaction in personalized gamified exercises through a recommender system. J. Biomed. Inform. 2019, 97, 103266–103285. [Google Scholar] [CrossRef] [PubMed]
  16. Esfahlani, S.S.; Cirstea, S.; Sanaei, A.; Wilson, G. An adaptive self-organizing fuzzy logic controller in a serious game for motor impairment rehabilitation. In Proceedings of the 2017 IEEE 26th International Symposium on Industrial Electronics (ISIE), Edinburgh, UK, 19–21 June 2017; pp. 1311–1318. [Google Scholar]
  17. Fernandez-Cervantes, V.; Stroulia, E.; Oliva, L.E.; Gonzalez, F.; Castillo, C. Serious games: Rehabilitation fuzzy grammar for exercise and therapy compliance. In Proceedings of the 2015 IEEE Games Entertainment Media Conference (IEEE), Toronto, ON, Canada, 14–16 October 2015; pp. 1–8. [Google Scholar]
  18. Pirovano, M.; Mainetti, R.; Baud-Bovy, G.; Lanzi, P.L.; Borghese, N.A. Self-adaptive games for rehabilitation at home. In Proceedings of the 2012 IEEE Conference on Computational Intelligence and Games (IEEE), Granada, Spain, 11–14 September 2012; pp. 179–186. [Google Scholar]
  19. Pirovano, M.; Surer, E.; Mainetti, R.; Lanzi, P.L.; Borghese, N.A. Exergaming and rehabilitation: A methodology for the design of effective and safe therapeutic exergames. Entertain. Comput. 2016, 14, 55–65. [Google Scholar] [CrossRef]
  20. Anton, D.; Berges, I.; Bermúdez, J.; Goñi, A.; Illarramendi, A. A telerehabilitation system for the selection, evaluation and remote management of therapies. Sensors 2018, 18, 1459. [Google Scholar] [CrossRef] [Green Version]
  21. Karime, A.; Mohamad, E.; Alja’Am, J.M.; El Saddik, A.; Gueaieb, W. A fuzzy-based adaptive rehabilitation framework for home-based wrist training. IEEE Trans. Instrum. Meas. 2013, 63, 135–144. [Google Scholar] [CrossRef] [Green Version]
  22. Han, J.; Yang, S.; Xia, L.; Chen, Y. Deterministic adaptive robust control with a novel optimal gain design approach for a fuzzy 2DOF lower limb exoskeleton robot system. IEEE Trans. Fuzzy Syst. 2021. [Google Scholar] [CrossRef]
  23. Castro-Schez, J.J.; Castro, J.L.; Zurita, J. M Fuzzy Repertory Table: A Method for Acquiring Knowledge About Input Variables to Machine Learning Algorithm. IEEE Trans. Fuzzy Syst. 2004, 12, 123–139. [Google Scholar] [CrossRef]
  24. Klement, E.P.; Mesiar, R.; Pap, E. Fuzzy set theory, Cap. In Triangular Norms; Springer: Berlin/Heidelberg, Germany, 2000; pp. 249–264. [Google Scholar]
  25. Mandami, E.H.; Assilian, S. An experiment in linguistic synthesis with a fuzzy logic controller. Int. J. Man Mach. Stud. 1975, 7. [Google Scholar] [CrossRef]
  26. Gupta, M.M.; Qi, J. Theory of T-norms and fuzzy inference methods. Fuzzy Sets Syst. 1991, 40, 431–450. [Google Scholar] [CrossRef]
Figure 1. Architectural overview of the proposed system.
Figure 1. Architectural overview of the proposed system.
Mathematics 09 01427 g001
Figure 2. Domain of definition of the variable V x , i.e., V 1 , V 2 , V 3 .
Figure 2. Domain of definition of the variable V x , i.e., V 1 , V 2 , V 3 .
Mathematics 09 01427 g002
Figure 3. Domain of definition of the variable P P L .
Figure 3. Domain of definition of the variable P P L .
Mathematics 09 01427 g003
Figure 4. Domain of definition of the variable E P P L .
Figure 4. Domain of definition of the variable E P P L .
Mathematics 09 01427 g004
Figure 5. φ 1 i functions for each variable V i in the rule r 1 .
Figure 5. φ 1 i functions for each variable V i in the rule r 1 .
Mathematics 09 01427 g005
Figure 6. Holistic view of the recommender system.
Figure 6. Holistic view of the recommender system.
Mathematics 09 01427 g006
Figure 7. Left elbow flexion representation.
Figure 7. Left elbow flexion representation.
Mathematics 09 01427 g007
Figure 8. Visual representation and results when applying the aggregation method (max) related to example 2.
Figure 8. Visual representation and results when applying the aggregation method (max) related to example 2.
Mathematics 09 01427 g008
Figure 9. Left shoulder abduction representation.
Figure 9. Left shoulder abduction representation.
Mathematics 09 01427 g009
Figure 10. Visual representation and results when applying the aggregation method (max) related to example 3.
Figure 10. Visual representation and results when applying the aggregation method (max) related to example 3.
Mathematics 09 01427 g010
Table 1. Result of each sub-area and centroid related to example 2.
Table 1. Result of each sub-area and centroid related to example 2.
Sub-Area NumberArea ( μ ( x i ) )Centroid of Area ( x i ) Area * x i
∑ Area = 0.9825 ∑ Area * x i = −0.36572
Table 2. Result of each sub-area and centroid related to example 3.
Table 2. Result of each sub-area and centroid related to example 3.
Sub-Area NumberArea ( μ ( x i ) )Centroid of Area ( x i ) Area * x i
∑ Area = 0.775 ∑ Area * x i = 0.21148425
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Gmez-Portes, C.; Castro-Schez, J.J.; Albusac, J.; Monekosso, D.N.; Vallejo, D. A Fuzzy Recommendation System for the Automatic Personalization of Physical Rehabilitation Exercises in Stroke Patients. Mathematics 2021, 9, 1427.

AMA Style

Gmez-Portes C, Castro-Schez JJ, Albusac J, Monekosso DN, Vallejo D. A Fuzzy Recommendation System for the Automatic Personalization of Physical Rehabilitation Exercises in Stroke Patients. Mathematics. 2021; 9(12):1427.

Chicago/Turabian Style

Gmez-Portes, Cristian, José Jesús Castro-Schez, Javier Albusac, Dorothy N. Monekosso, and David Vallejo. 2021. "A Fuzzy Recommendation System for the Automatic Personalization of Physical Rehabilitation Exercises in Stroke Patients" Mathematics 9, no. 12: 1427.

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop