摘要: netcat (windows) nc L p 9999 Result: 窗口移动5秒,窗口宽度10秒。 聚合维度: window, {world} http://asyncified.io/2017/07/30/exploring stateful streaming with spark str 阅读全文
posted @ 2017-10-24 15:58 wlu 阅读(753) 评论(0) 推荐(0)
摘要: 调用Nndl实现的神经网络code,用ANN拟合二次方程。 ref: https://github.com/mnielsen/neural networks and deep learning 准备训练数据 训练网络 a=[] f=[] for xi in np.array(xrange(0,100 阅读全文
posted @ 2017-10-20 13:36 wlu 阅读(2719) 评论(0) 推荐(0)
摘要: 引言 本文基于Spark (1.5.0) ml库提供的pipeline完整地实践一次文本分类。pipeline将串联单词分割(tokenize)、单词频数统计(TF),特征向量计算(TF IDF),朴素贝叶斯(Naive Bayes)模型训练等。 本文将基于 "“20 NewsGroups”" 数据 阅读全文
posted @ 2017-10-20 13:19 wlu 阅读(326) 评论(0) 推荐(0)
摘要: In this article, we discuss the necessity of segregate data model for read and write and use event sourcing for capture detailed data changing. These 阅读全文
posted @ 2017-10-20 13:18 wlu 阅读(3842) 评论(0) 推荐(0)
摘要: 在一些特定场景,例如streamingRDD需要和历史数据进行join从而获得一些profile信息,此时形成较小的新数据RDD和很大的历史RDD的join。 Spark中直接join实际上效率不高: RDD没有索引,join操作实际上是相互join的RDD进行hash然后shuffle到一起; 实 阅读全文
posted @ 2017-10-20 13:13 wlu 阅读(555) 评论(1) 推荐(0)
摘要: 问题背景:我们有一些观测数据X,这些数据假设是取值为1,...,m;我们还知道每个数据观测到的频数为: 但是我们现在无法计算B的大小。(这是一个假设,毕竟计算一串数字的和不是难事)问题: 我们需要通过仿真产生一串随机变量,并且它们的概率分布函数为:分析:如果B是可以计算的,那么(j)自然也是可以计算的。然后自然很容易随机生成服从这个概率分布的一串随机数。但是B不能计算。。。我们可以采用一个曲线救国的方案。 直观上来考虑这个问题,产生随机数时是一个一个地产生随机数,每个随机数取值为1,...,m中某一个。我们可以:1)把一个随机数看成一个状态;2)一个随机数的产生取决于前一个随机数,那么每个.. 阅读全文
posted @ 2013-07-21 16:59 wlu 阅读(2765) 评论(0) 推荐(0)
摘要: stackoverflow: http://stackoverflow.com/questions/1838304/call-the-llvm-jit-from-c-programAnother trial under llvm 3.2;In prepared IR "tst.ll", code:; ModuleID = 'tst.bc' define i32 @add1(i32 %AnArg) { EntryBlock: %0 = add ... 阅读全文
posted @ 2013-06-28 16:33 wlu 阅读(1032) 评论(0) 推荐(0)
摘要: Binary Tree Maximum Path SumGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tree. For example: Given the below binary tree, 1 / \ 2 3Return 6.递归求解。maxPathSum(root)跟maxPathSum(root.left)和maxPathSum(root.right)之间的关系:root左子树的maxPath,右子树的maxP... 阅读全文
posted @ 2013-06-21 23:47 wlu 阅读(2360) 评论(0) 推荐(0)
摘要: LeetCode 跟树结构相关的题目的测试用例中大多是通过String数组来构造树。例如{2,#,3,#,4,#,5,#,6},可以构造出如下的树(将树结构逆时针选择90度显示): 6 5 4 32很直观地可以理解,输入的String数组是对树结构进行“层序”遍历得到的结果。以下代码用于构造树结构,并提供printTree用于打印树结构。package util;import java.util.LinkedList;import java.util.Queue;public class util { public static class TreeNode { int val;... 阅读全文
posted @ 2013-06-18 22:35 wlu 阅读(2778) 评论(0) 推荐(0)
摘要: Path Sum IIGiven a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example: Given the below binary tree and sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ / \ 7 2 5 1return[... 阅读全文
posted @ 2013-06-18 20:46 wlu 阅读(253) 评论(0) 推荐(0)