数据流基本问题--确定频繁元素(二)lossy counting和sticky sampling

热点检测中的算法介绍 Lossy Counting、Count-Min Sketch 、HeavyKeeper以及HeavyKeeper的java实现 【热点数据检测算法分析】本文对比了三种热点数据检测算法:Lossy Counting适用于频率大于阈值的数据挖掘,通过bucket划分和误差控制实现;Count-Min Sketch采用二维数组和哈希映射估算频率上界;HeavyKeeper则通过概率性替换机制和最小堆维护实时Top-K结果,更适合流式数据处理。重点解析了HeavyKeeper的Java实现,包含多层哈希表、衰减机制和最小堆等核心组件,适用于热点Key检测、流量分析等实时场景。 阅读详情

我们之前在数据流基本问题--确定频繁元素(一)中提到了频繁元素的一个计算问题(找出出现次数超过m/k的元素),里面的算法返回的结果里肯定包含出现次数超过m/k的元素,但是也可能包含不超过m/k的元素(false positive)。对于这个缺点,必须得进行额外一次的重新扫描,以确定最终答案。我们只允许进行一次的扫描,那么该怎么去做呢?这里我们简单讨论下lossy counting算法和sticky sampling算法。

一、lossy counting算法

其实问题是一样的,这里换个说法来叙述。我们定义两个参数,一个是支持度阈值s,一个是允许错误范围参数()。如果我们想要找出出现频率超过0.1%的元素,则s=0.1%。我们要找到出现次数超过s*m的元素。算法返回的结果里面允许一定的错误,但是允许的范围是*m,也就是说结果中不会出现次数少于(s-)*m的元素。我们一般设

大数据流的在线Heavy Hitters算法(上篇):基于计数器的方法 Question! 有海量(e.g. 日均千亿级别)的访问日志流,如何在不要求结果100%精确的前提下,尽量快速地统计出被访问次数最多的一些域名,以及它们的访问频率? Heavy Hitters(频繁项)以及它衍生出来的Top-K(前K最高频项)是大数据和流式计算领域非常经典的问题,并且在海量数据+内存有限+在线计算的前提下,传统的HashMap + Heap-Sort方式几乎不可行,需要利用... 阅读详情

相关推荐

数据流基本问题--确定频繁元素(一)

下面可以谈论下如何求频繁元素的一个问题。 一、问题定义 如果一个数据流,其中m为数据流的大小,。我们可以定义每个元素出现的次数为,其中为第i个元素出现的次数。容易得出:。 如果给定参数k,我们想求出所有出现次数超过m/k的元素。也就是输出集合:。下面我们先从一个简单特例入手,对这个问题进行分析和解决。 二.简单情况 有个经典的过半元素查找问题,在编程之美里面也有分析(寻找发帖水王)。就是

dm_ustc的博客 5645

数据流基本问题--基于sketch进行Frequency Estimation

如果一个数据流,其中m为数据流的大小,。我们可以定义每个元素出现 的次数为,其中为第i个元素出现的次数。这篇博客就是讲下的估计问题(Frequency Estimation)。 在数据流基本问题--确定频繁元素里面的方法也可以对元素出现次数进行估计。但是这个方法如果该这种方法处理了两 个数据流,无法对处理的结果进行汇总得到两个数据流合并后的结果进行估计。而且该方法只能针对vanilla

dm_ustc的博客 1万+

数据流基本问题---采样问题

在数据流处理中的一个常见问题就是数据采样问题。我们希望从流中选择一个子集,以便能够对它进行查询并给出统计性上对整个流具有代表性的结果。 一、蓄水池采样 具体问题是我们要从数据流中随机抽取k个元素。如果数据流长度m事先已经知道,那这个问题就非常简单,每个元素以k/m的概率选取即可。但这个问题要求m未知,那就不太好搞了。这个问题的解法是保存一个k大小的窗口。数据流的前k个元素依次加入到窗口。对于数

dm_ustc的博客 6887

26、数据流中的决策树挖掘与频繁项集挖掘技术解析

本文深入解析了数据流环境下的决策树挖掘与频繁项集挖掘技术。对比了VFDT与C4.5等决策树算法的性能,强调了VFDT在处理大规模数据流时的优势。同时,介绍了MISRA–GRIES、LOSSY COUNTING和STICKY SAMPLING三种单遍算法在频繁元素计算中的应用,并讨论了如何通过修改LOSSY COUNTING算法来实现数据流中的频繁项集挖掘。文章提供了不同算法的空间复杂度、适用场景及优劣势对比,帮助读者根据实际需求选择最适合的算法。

h9j8k7l6m5n的博客 67

基于权重的流数据频繁项挖掘算法的应用

针对Lossy Counting算法,即一个基于计数的确定性方案,提出一种新的基于权重的流数据频繁项挖掘算法(Lossy Weight),扩展了流数据频繁项的作用域。Lossy Weight算法不仅可用于传统的基于计数的频繁项挖掘,还可以挖掘出在整个流数据中所占权重比重大于门槛值的数据。实验数据分析证明该方案是有效的。

低功耗模式下的看门狗使用

最近用国产芯片AT32在做一个低功耗的项目,为了实现低功耗模式下的定时唤醒,我选择的是使用相对比较简单的看门狗来做,下面就分享一下使用过程~ 为了最大限度的降低功耗,我用的是待机模式,先看看几种低功耗模式以及唤醒的区别: 而看门狗AT32提供了两种,分别是独立看门狗(IWDG)和窗口看门狗(WWDG),其区别大概有以下几点: 1、独立看门狗(IWDG)由专用的低速时钟(LSI)驱动,即使主时钟发生故障它也仍然有效;窗口看门狗由从 APB1 时钟分频后得到的时钟驱动,通过可配置的时间窗口来检测应用程序非正常

dc18883988396的博客 3034

Fastwhisper + Pyannote 实现 ASR + 说话者识别

最近在研究ASR相关的业务,也是调研了不少模型,踩了不少坑,ASR这块,目前中文普通话效果最好的应该是阿里的modelscope上的中文模型了,英文的话,还是非whisper莫属了,而且whisper很变态,粤语效果也还不错,因此,如果实际业务中需要涉及到不同的语言,还是更推荐whisper多一点faster-whisper是使用CTranslate2对OpenAI的Whisper模型的重新实现,CTranslate2是一个用于Transformer模型的快速推理引擎。

qq_44193969的博客 1万+

plotly包安装_Plotly(一)安装指南

plotly,是一个快速完善并崛起的交互式的、开源的绘图库库,Python库则是它的一个重要分支。现已支持超过40种独特的图表类型,涵盖了广泛的统计、金融、地理、科学和三维用例。Plotly 通过JavaScript构建,能基于Web显示实现交互式的可视化效果(Plotly最强大之处之一)。所以它的图形呈现可以方便的显示于Jupyter notebook(基于html)、独立的html中(直接显示...

weixin_35907189的博客 3484

CANopen中SDO、PDO字典以及COB-ID理解

CANopen SDO PDO

sunarmy的专栏 2万+

利用按键精灵实现批量截图与智能命名的高效工作流

本文详细介绍了如何利用按键精灵软件构建高效的批量截图与智能命名自动化工作流。通过基础脚本编写、循环逻辑实现及高级命名策略,解决手动操作耗时易错的问题,帮助用户实现一键自动截图、智能保存与文件重命名,大幅提升软件测试、教程制作及数据报告等场景的工作效率。

weixin_29268267的博客 572

基于分段线性近似的Softmax硬件加速器设计

本文深入探讨了基于分段线性近似的Softmax硬件加速器设计。针对深度学习模型中Softmax函数在硬件实现时指数运算成本高昂的问题,提出用分段线性拟合替代传统泰勒展开,通过一次乘加操作高效完成计算,并详细分析了输入范围压缩、精度与硬件资源权衡、以及包含地址生成、参数查找、乘加计算和归一化的完整硬件架构。该方法在保证精度的同时,显著提升了AI边缘芯片的推理速度和能效。

weixin_28278377的博客 322

SCTPPortScan SCTP协议端口扫描、关联地址识别、传输状态检测

Windows:Winsock2+SCTP扩展)。- **SCTP API封装**:Linux下直接调用`socket()`、`connect()`、`getsockopt()`等系统函数,解析`struct sctp_status`和`struct sctp_paddrinfo`获取状态和关联地址。qDebug() << "开始SCTP扫描:" << ipList.size() << "个IP," << ports.size() << "个端口,共" << m_totalTasks << "个任务";

寒寒豆豆软件公司的博客 97

uniapp - 实现手机端H5网页直播功能效果,拿到后端推流地址或播放资源后进行前端的流畅播放和画面展示功能,uniapp实时推流/拉流直播系统详细教程(提供完整示例代码,一键复制开箱即用!)

uniapp,h5网页,手机端H5网页,uniapp h5直播功能页面,uniapp直播实时推送显示,uniapp h5直播怎么做,怎么使用uniapp去实现移动端手机H5直播,h5 vue+uniapp怎么做直播,uniapp中使用videojs构建H5直播播放器,uniappH5端怎么实现直播推流,uniapp如何实现直播,直播聊天功能,h5平台端直播用什么插件,uniapp手机网页直播用什么组件插件播放器,uniapp手机H5直播播放器详细教程,直播项目,怎么使用vue+uniapp怎么做H5实时直播

✅ 精选推荐文章 8800

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: 数据流基本问题--矩估计(一)
下一篇: 数据流小问题--find the missing elements
dm_ustc
博客等级 码龄12年 60粉丝 16原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址