Algorithm 1. Enhanced Reactive Drift Detection Method |
Input: stream, n, αw, αd, max, min, warnLimit storedPredictions ← NEW byte [min] reset m_n,m_p,m_s,m_pmin,m_smin,m_psmin rddmDrift ← ddmDrift ← false numInstConcept ← numWarnings ← 0 m_t_array ← [ ] Output: 1. foreach instance in stream do 2. pred prediction (instance) 3. If rddmDrift Then 4. reset m_n,m_p,m_s,m_pmin,m_smin,m_psmin 5. Calculate DDM statistics using the element of storedPrediction 6. rddmDrift ← ddmDrift ← false 7. numInstConcept ← numWarning ← 0 8. End If 9. Inserts pred into array storedPredictions forgetting oldest value if it is already full 10. m_p ← m_p + (pred – m_p)/m_n 11. m_s ← sqrt (m p × (1 – m_p)/m_n) 12. m_n ← m_n + 1 13. numInstConcept ← numInstConcept + 1 14. warningLevel ← false 15. If numInstConcept _ n Then 16. x_avg ← (1/m_n) x m_p 17. m_t ← (m_s - x_avg) + n 18. m_t_array.add(m_t) 19. M_t = min (m_t_array) 20. If M_t – m_t < m_psmin Then 21. m_pmin ← m_p; m_smin ← m_s 22. m_psmin m_p + m_s End If 23. If M_t – m_t > m_pmin + αd × m_smin Then 24. rddmDrift ← ddmDrift ← true 25. If numWarnings ← 0 Then 26. storedPredictions ← pred 27. End If 28. else If M_t – m_t > m_pmin +αw x s_min Then 29. If numWarning >= warnLimit Then 30. rddmDrift ← ddmDrift ← true 31. storedPredictions ← pred 32. else 33. warningLevel ← true 34. numWarnings ← numWarnings + 1 35. End If 36. else numWarnings ← 0 37. End If 38. If numInstConcept >= max and not warningLevel Then 39. rddmDrift ← true 40. End If 41. End For |