Adaptive estimation of categorical data streams with applications in change detection and density estimation