Decision Making Using Fuzzy Discrete Event Systems
You can use a fuzzy discrete event system (FDES) for deciding between different outcomes in scenarios where discrete events can be modeled using a fuzzy transition matrix.
This example shows a sample FDES for clinical decision making in selecting medical treatments. A clinical decision-making system assists a medical practitioner in the diagnosis and treatment of a disease using relevant medical evidence. An FDES [1] allows continuous monitoring of the patient state to recommend a possible course of treatments for a disease [2]. This medical application in this example is for illustrative purposes and does not include real clinical data.
An FDES compactly and explicitly represents application-specific knowledge, even when the knowledge is imprecise or subjective. Also, an FDES model is not a black box. Rather, you can intuitively understand and validate the model structure and operational logic based on the event-transition matrices and related fuzzy state transfers. This model interpretability is important to many applications, especially those in medicine, as patient safety is paramount. Also, interpretability makes model design, development, refinement, and implementation easier, quicker, and more cost-effective.
This example performs decision making using single-event FDES models. You can also use multi-event FDES models for more complex treatment decision where each option consists of two or more different kinds of treatment.
FDES Basics
An FDES complements a conventional discrete event system (DES) by using fuzzy sets and fuzzy logic. A conventional automaton model, which defines a DES, is extended to a fuzzy automaton to define an FDES as follows:
where:
is a 1-by- vector that represents the overall system state using fuzzy states. Each fuzzy state in can have membership values in the range [0, 1], as opposed to only 0 or 1 in conventional discrete event systems.
is the initial fuzzy state vector.
is a set of fuzzy events, each of which is represented by an -by- state-transition matrix. The elements of a fuzzy state-transition matrix can have values in the range [0, 1] rather than only 0 or 1. Therefore, the occurrence of a fuzzy event can produce a new overall system state with partial membership values for the individual fuzzy states. An FDES can consist of one or more fuzzy events, which can be defined by domain experts or learned from available domain-specific data.
represents state transitions. The state-transition mapping uses fuzzy reasoning, such as the max-product composition method.
A conventional automaton is a special case of a fuzzy automaton while a discrete event system is a special case of a fuzzy discrete event system.
FDES Model for Clinical Status
For this example, the treatment model uses an FDES for patients recently diagnosed with an aggressive, early-stage cancer.
The FDES represents the clinical status of the patient using four fuzzy states, each of which is defined by a fuzzy set.
Healthy — Fuzzy set with maximum membership or peak value at
Good — Fuzzy set with peak value at
Fair — Fuzzy set with peak value at
Poor — Fuzzy set with peak value at
xPeak = 4:-1:1; statusStateNames = ["Healthy" "Good" "Fair" "Poor"]; showStateVector(xPeak,statusStateNames,"xPeak","Peak")
State vector, xPeak: Healthy Good Fair Poor _______ ____ ____ ____ Peak 4 3 2 1
is the fuzzy state vector representing the patient status.
Here:
is the membership value in Healthy state.
is the membership value in Good state.
is the membership value in Fair state.
is the membership value in Poor state.
Lower values of , , and , and corresponding higher values of indicate a more serious status of the patient.
To obtain a crisp health index value for the patient, you can defuzzify using the centroid method. For more information on defuzzification, see defuzz
.
The resulting health index is in the range [1, 4], where a lower value indicates a more serious patient status.
Initial State
Before starting the treatment process, the initial clinical state of the patient is diagnosed as .
qo_c = [0 0.2 0.7 0.1]; showStateVector(qo_c,statusStateNames,"qo_c","Membership")
State vector, qo_c: Healthy Good Fair Poor _______ ____ ____ ____ Membership 0 0.2 0.7 0.1
The initial state vector represents the following crisp health index value .
xo_c = defuzz(xPeak,qo_c,"centroid")
xo_c = 2.1000
Hence, the patient is initially somewhat in the Fair state.
Events
Assume that the patient is considering the following two treatment options:
Surgery to remove the cancer
Radiation therapy to kill cancer cells
You can model each option as a single-event fuzzy discrete system.
Define the fuzzy state-transition matrix for the surgery option.
alpha_c = [
1 0.8 0.1 0;
0.9 0.8 0.2 0.1;
0.1 0.6 0.3 0.2;
0 0.3 0.5 0.3];
showEventMatrix(alpha_c,statusStateNames,"alpha_c")
Event matrix, alpha_c: Healthy Good Fair Poor _______ ____ ____ ____ Healthy 1 0.8 0.1 0 Good 0.9 0.8 0.2 0.1 Fair 0.1 0.6 0.3 0.2 Poor 0 0.3 0.5 0.3
Each row of the transition matrix represents the possible surgery outcomes for a patient in a given state. For example:
A patient in a Fair state will transition to a Good state with a likelihood of 0.6.
A patient in a Good state will transition to a Poor state with a likelihood of 0.1.
A patient in a Poor state will remain in a Poor state with a likelihood of 0.3.
Similarly, define fuzzy state-transition matrix for the radiation option.
beta_c = [
1 0.7 0.2 0;
0.7 0.6 0.4 0.3;
0 0.4 0.5 0.4;
0 0 0.7 0.6];
showEventMatrix(beta_c,statusStateNames,"beta_c")
Event matrix, beta_c: Healthy Good Fair Poor _______ ____ ____ ____ Healthy 1 0.7 0.2 0 Good 0.7 0.6 0.4 0.3 Fair 0 0.4 0.5 0.4 Poor 0 0 0.7 0.6
Comparing to suggests that radiation therapy is a less effective treatment for this particular cancer. For example, in , the possibilities for patients in a Good or Fair state to respectively transition to a Healthy or Good state significantly smaller than in . Furthermore, the possibilities for these two states to change to a Fair or Poor state are significantly higher than in .
State Transition
The patient state changes after the occurrence of an event. Each state-transition matrix, constructed using historical patient cases, represents the general clinical state transfer for all patients. When you apply the matrices to a new individual patient, the computed post-event fuzzy state is an estimation of the expected outcome. You cannot predict the actual treatment outcome in advance.
This example uses max-product composition to determine an expected post-event state. Expected state vectors are optionally normalized for comparison.
Compute the expected state after occurrence of event .
Qalpha_c = findNextState(qo_c,alpha_c); showStateVector(Qalpha_c,statusStateNames,"Qalpha_c","Membership")
State vector, Qalpha_c: Healthy Good Fair Poor _______ _______ _______ _______ Membership 0.18947 0.44211 0.22105 0.14737
Comparing with the initial state , the overall clinical state of the patient is expected to improve significantly after the surgery since the membership values for the Healthy and Good states increase, the membership value for Fair state (from 0.7 to 0.221), and a little change in Poor state (0.1 from 0.147).
Compute a crisp health index for from .
xalpha_c = defuzz(xPeak,Qalpha_c,"centroid")
xalpha_c = 2.6737
Similarly, compute the expected state after occurrence of event .
Qbeta_c = findNextState(qo_c,beta_c); showStateVector(Qbeta_c,statusStateNames,"Qbeta_c","Membership")
State vector, Qbeta_c: Healthy Good Fair Poor _______ _______ _______ _______ Membership 0.13333 0.26667 0.33333 0.26667
As compared to , has higher membership values for the Fair and Poor states but lower membership values for Healthy and Good states. Therefore, the overall clinical state of the patient after radiation would not be as good as after surgery.
Compute the crisp health index from .
xbeta_c = defuzz(xPeak,Qbeta_c,"centroid")
xbeta_c = 2.2667
To confirm this assessment compare the crisp health index values for each option. While both and are higher than the original health index , the post-surgery index is higher than the post-radiation index.
FDES Model for Quality of Life
While the surgery appears to be a better treatment option in terms of clinical status, it may have adverse effects on the long-term quality of life of the patient. For example, the following factors can impact a the post-treatment quality of life for the patient.
Known historical permanent medical problems caused by the treatment under consideration
Adverse effects from preexisting medical issues and the age of the patient to be treated
For this example, create a separate FDES for assessing the impact of treatment on the patient quality of life. Represent the expected long-term quality of life using three fuzzy states, each of which is defined by a fuzzy set.
High — Fuzzy set with peak value at
Medium — Fuzzy set with peak value at
Low — Fuzzy set with peak value at
yPeak = 3:-1:1; qualityStateNames = ["High" "Medium" "Low"]; showStateVector(yPeak,qualityStateNames,"yPeak","Peak")
State vector, yPeak: High Medium Low ____ ______ ___ Peak 3 2 1
Initial State
Before starting the treatment process, the initial quality of life of the patient is assessed as .
qo_l = [0.1 0.5 0.4]; showStateVector(qo_l,qualityStateNames,"qo_l","Membership")
State vector, qo_l: High Medium Low ____ ______ ___ Membership 0.1 0.5 0.4
The initial state vector represents the following crisp health index value .
xo_l = defuzz(yPeak,qo_l,"centroid")
xo_l = 1.7000
Hence, the patient is initially somewhat in the Medium state.
Events
Define two more event matrices to model the treatment effects of surgery and radiation therapy on long-term life quality of life.
Transition matrix represents the impact of surgery on quality of life.
alpha_l = [
0.6 0.8 0.3;
0 0.5 0.4;
0 0 1];
showEventMatrix(alpha_l,qualityStateNames,"alpha_l")
Event matrix, alpha_l: High Medium Low ____ ______ ___ High 0.6 0.8 0.3 Medium 0 0.5 0.4 Low 0 0 1
Transition matrix represents the impact of radiation therapy on quality of life.
beta_l = [
0.8 0.6 0.1;
0 0.9 0.2;
0 0 1];
showEventMatrix(beta_l,qualityStateNames,"beta_l")
Event matrix, beta_l: High Medium Low ____ ______ ___ High 0.8 0.6 0.1 Medium 0 0.9 0.2 Low 0 0 1
A comparison of the two matrices shows that the surgery can potentially induce more side effects than the radiation therapy can because:
The possibility (0.6) that a High quality state remains unchanged after the surgery is lower than for radiation therapy (0.8).
The possibility of a High quality state to worsen to a Medium or Low quality state are higher for surgery.
It is less likely that a Medium quality state remains unchanged after surgery and it is more likely to worsen to Low quality state.
State Transition
Similar to the clinical status model, the expected long-term quality of life of the patient changes after treatment.
Compute the quality-of-life state after surgery .
Qalpha_l = findNextState(qo_l,alpha_l); showStateVector(Qalpha_l,qualityStateNames,"Qalpha_l","Membership")
State vector, Qalpha_l: High Medium Low ________ _______ _______ Membership 0.084507 0.35211 0.56338
Compute the quality-of-life state after radiation .
Qbeta_l = findNextState(qo_l,beta_l); showStateVector(Qbeta_l,qualityStateNames,"Qbeta_l","Membership")
State vector, Qbeta_l: High Medium Low ________ _______ _______ Membership 0.086022 0.48387 0.43011
To assess the expected quality of life, compute crisp quality-of-life index values by defuzzifying the corresponding fuzzy state vectors.
and represent the following crisp index values, , respectively, for quality of life.
yalpha_l = defuzz(yPeak,Qalpha_l,'centroid')
yalpha_l = 1.5211
ybeta_l = defuzz(yPeak,Qbeta_l,'centroid')
ybeta_l = 1.6559
The post-surgery index value is lower than the post-radiation index value . Therefore, the radiation treatment provides a better expected long-term quality of life for the patient.
Treatment Selection
The quantitative estimations obtained above show that the surgery is expected to deliver a better cancer control at the expense of possibly worse long-term health-related quality of life. The reverse is true for the radiation therapy.
Ultimately, the final decision on which treatment to use depends on the personal preference of the patient. For this example, represent the patient using weight factor in the range [0, 1]. A higher value of indicates a patient preference for disease control and a lower value indicates a preference for long-term health-related quality of life.
The following treatment preference functions provide a combined consideration of the two weighting factors.
A higher value of indicates patient preference for surgery and a higher value of indicates patient preference for radiation.
Plot the treatment preference functions for all values of .
theta = 0:0.01:1; F_alpha = theta*xalpha_c + (1-theta)*yalpha_l; F_beta = theta*xbeta_c + (1-theta)*ybeta_l; plot(theta,F_alpha,theta,F_beta) title("Treatment Selection") xlabel("Patient Weighting Factor, theta") legend("Surgery Preference","Radiation Preference",... Location="northwest") grid on
In this case, for greater than about 0.25, surgery is the preferred choice of treatment.
Online Supervised Learning of FDES
You can learn the event-transition matrices of an FDES online as new data becomes available. In the case of a clinical decision-making system, you can use the results from new patients to gradually improve the FDES model through supervised learning. Over time, the resulting model would cover a more diverse patient population, which can improve prediction accuracy for individual patients in the future.
This example demonstrates the learning process for a single patient.
Generally, an event transition matrix at the instant is updated with its previous value ,the current pre-event state , and current expected post-event state [3].
Let:
, where
Each element of the event matrix is learned as follows:
Here, is a learning rate whose value is determined by the model.
is an actual state at the instant obtained from and using max-product fuzzy inference ().
For this example, update the surgery event-transition matrix using the results for a single patient.
Suppose that the target state corresponding to is determined using a physical diagnosis after the treatment.
Assume the patient represented by the pair is the only sample available for learning.
Iteratively update event matrix with learning rate for a preset root-mean-square-error (RMSE) goal of 0.02.
N = 4;
lambda = 0.2;
alphak_1 = alpha_c;
Qk_1 = qo_c;
Qhat = Qalpha_c;
Qk = [0.2 0.6 0.15 0.1];
alphak = zeros(N,N);
rmse = sqrt(mean((Qhat-Qk).^2));
fprintf("Initial RMSE = %g\n",rmse);
Initial RMSE = 0.089908
errorGoal = 0.02; iteration = 0; while rmse>errorGoal iteration = iteration + 1; for i = 1:N for j = 1:N alphak(i,j) = alphak_1(i,j)-lambda*Qk_1(i)*(Qhat(j)-Qk(j)); end end alphak_1 = alphak; Qhat = findNextState(Qk_1,alphak_1); rmse = sqrt(mean((Qhat-Qk).^2)); fprintf("Iteration %d: RMSE = %g\n",iteration,rmse); end
Iteration 1: RMSE = 0.0812763 Iteration 2: RMSE = 0.0736111 Iteration 3: RMSE = 0.0668027 Iteration 4: RMSE = 0.0607548 Iteration 5: RMSE = 0.055383 Iteration 6: RMSE = 0.0506125 Iteration 7: RMSE = 0.0463777 Iteration 8: RMSE = 0.0426206 Iteration 9: RMSE = 0.0392899 Iteration 10: RMSE = 0.03634 Iteration 11: RMSE = 0.0337306 Iteration 12: RMSE = 0.0314255 Iteration 13: RMSE = 0.0293927 Iteration 14: RMSE = 0.0276031 Iteration 15: RMSE = 0.0260309 Iteration 16: RMSE = 0.0246527 Iteration 17: RMSE = 0.0234472 Iteration 18: RMSE = 0.0223954 Iteration 19: RMSE = 0.02148 Iteration 20: RMSE = 0.0206853 Iteration 21: RMSE = 0.0199972
You can follow a similar approach for online supervised learning of other event transition matrices.
References
Feng Lin and Hao Ying. “Modeling and Control of Fuzzy Discrete Event Systems.” IEEE Transactions on Systems, Man and Cybernetics, Part B (Cybernetics) 32, no. 4 (August 2002): 408–15. https://doi.org/10.1109/TSMCB.2002.1018761.
Ying, H., F. Lin, R.D. Macarthur, J.A. Cohn, D.C. Barth-Jones, H. Ye, and L.R. Crane. “A Fuzzy Discrete Event System Approach to Determining Optimal HIV/AIDS Treatment Regimens.” IEEE Transactions on Information Technology in Biomedicine 10, no. 4 (October 2006): 663–76. https://doi.org/10.1109/TITB.2006.874200.
Ying, Hao, and Feng Lin. “Online Self-Learning Fuzzy Discrete Event Systems.” IEEE Transactions on Fuzzy Systems 28, no. 9 (September 2020): 2185–94. https://doi.org/10.1109/TFUZZ.2019.2931254.
Helper Functions
Calculate the next state using the current state and event, normalizing the next-state values.
function nextState = findNextState(currentState,event) nextState = zeros(size(currentState)); stateSum = 0; for col=1:size(event,2) stateValue = max(currentState.*event(:,col)'); nextState(col) = stateValue; stateSum = stateSum + stateValue; end if stateSum~=0 nextState = nextState/stateSum; end end
Display a fuzzy event matrix.
function showEventMatrix(eventMatrix,stateNames,varName) description = sprintf("Event matrix, %s",varName); showMatrix(eventMatrix,stateNames,stateNames,description) end
Display a fuzzy state vector.
function showStateVector(stateVector,stateNames,varName,label) description = sprintf("State vector, %s",varName); showMatrix(stateVector,label,stateNames,description) end
Display a matrix.
function showMatrix(mat,rowNames,colNames,description) vars = mat2cell(mat,size(mat,1),ones(1,size(mat,2))); t = table(vars{:},VariableNames=colNames,RowNames=rowNames); fprintf("%s:\n\n",description); disp(t) end