随机指示变量(Indicator Random Variables)

数据填充不是填空游戏:缺失机制诊断与工业级填充策略 数据填充是机器学习流程中隐含建模假设的关键环节,其本质是基于缺失机制(MCAR/MAR/MNAR)对未知值进行有依据的推断。理解缺失类型决定技术选型:均值/中位数适用于MCAR假设下的快速基线,KNN依赖特征相似性适合MAR场景,而MICE和模型化填充则能捕捉变量交互、支撑复杂模型。在医疗、金融、IoT等真实产线中,填充效果直接影响AUC、故障检出率与临床合理性。本文聚焦可落地的填充决策逻辑——从热力图诊断缺失模式、到六大策略压测对比、再到混合类型Pipeline封装,覆盖pandas与scikit-lea 阅读详情

http://blog.sina.com.cn/s/blog_5016ee390102eerb.html

Probabilistic Analysis
 
很好的内容,请耐心看完!!

Up to this point we have been considering algorithms deterministically, i.e. best and worst case behavior. We have occasionally looked at average case behavior, but assumed that all inputs are equally likely to occur. Sometimes the exact inputs for an algorithm are unknown, but an input distribution can be approximated to provide the probability that certain inputs will occur. Using input probability distributions to analyze algorithms is known as amortized analysis and is beyond the scope of this course. However we will investigate a useful technique for probabilistic analysis known as indicator random variables in the context of two common counting problems.

Hiring Problem

Consider that you are in charge of hiring and are looking to fill an office position. The prospective candidates are sent by an employment agency and are assumed to be numbered 1..n. Your hiring strategy is to interview each candidate and hire them if they are better qualified than the current employee (a rather cut throat approach).

The cost to interview a candidate is c1, and the cost to hire a candidate is c2 (it is assumed that c2 >> c1).

The question the CFO of the company wants answered is - What is the expected cost of this hiring strategy?

We know that we will have to interview all the candidates for a total interview cost c1n, and if we only hire m of the candidates there will be a total hiring cost of c2m. Thus the total cost will be O(c1n + c2m). Since the interview cost is fixed for all strategies, we only focus on the hiring cost for the analysis. Thus the question becomes - what fraction of the candidates are hired on average.

Worst Case

The worst case is if the candidates arrive in increasing order of skill in which case all of them would be hired (and each previous one fired) giving a hiring cost of O(c2n).

Best Case

The best case is if the first candidate is the best one in which case they are the only one that is hired for a total hiring cost of O(c2).

Average Case

A first intuitive guess for the average case would be O(c2(n/2)), i.e. half of the candidates are hired. However the actual average case will depend on the distribution of the n! possible permutations. In order to mitigate the possibility of the employment agency maliciously sending the candidates in order of increasing skill (so that they get the most money),we will take control by randomizing the inputs before processing (which could be done by providing them the random order to send candidates). Thus the worst case occurs only if we are unlucky and unfortunately select (by random chance) the poor permutation.

Each input sequence will have an individual hiring cost, but since the sequence itself is a random variable the average hiring cost will be the expected value of the hiring costs. Recall from discrete math or probability and statistics that the expected value of a random variableX that can take on n different values {x1,x2,...,xn} that occur with probabilities {p1,p2,...,pn} (note that p1 + p2 + ... + pn = 1) is given by the formula 

随机指示变量(Indicator <wbr>Random <wbr>Variables)

Thus if we assume that each of the n! permutations is equally likely to occur (with probability 1/n!), we could compute the expected value using the formula by simply computing the hiring cost for each permutation. Unfortunately this is not feasible for even small values of n. Thus we will employ another technique to find the expected value known as indicator random variables.

Indicator Random Variables

The technique of indicator random variables is based upon the concept of an event either occuring or not occuring. Thus for an event A (which is a random event), we will define anindicator variable as

随机指示变量(Indicator <wbr>Random <wbr>Variables)

Thus I simply indicates whether or not a random event occurs. For example, consider the event for a coin toss being that the result is heads. The indicator random variable would then be 1 (true) if the coin lands on heads and 0 (false) otherwise (which in this case would be landing on tails). Since A is a random event, I is a random value, and we will define a random variable

随机指示变量(Indicator <wbr>Random <wbr>Variables)

We can then easily find the expected value of XA as

随机指示变量(Indicator <wbr>Random <wbr>Variables)

Thus the expected value of an indicator random variable is simply the probability that theevent occurs.

Hiring Problem

Applying indicator random variables to the hiring problem, we will define the event A as the event that "candidate i is hired". Thus we can define the indicator random variable for this event as

随机指示变量(Indicator <wbr>Random <wbr>Variables)

The expected value of this random variable is

随机指示变量(Indicator <wbr>Random <wbr>Variables)

One way to see this is to consider that candidate i is hired only if they are the most qualified of the first i candidates. Thus this is equivalent to given a sequence of distinct values, that the last value is the largest. However the probability of this happening is equivalent to asking what is the probability that the last slot has a particular value (in this case the largest) out of i possible values which clearly has probability 1/i.

Thus the total number of hires X for a permutation can be written as

随机指示变量(Indicator <wbr>Random <wbr>Variables)

which is simply a sum of the individual hires. X will be a random variable dependent on which particular permutation is selected. Thus the average number of hires will be equal to theexpected value of this random variable which can be computed (using the fact that expected value is a linear operator) as

随机指示变量(Indicator <wbr>Random <wbr>Variables)

Thus on average only lg n candidates (quite a bit fewer than n/2) will be hired giving an expected hiring cost of O(c2 lg n).

Birthday Paradox

Another interesting problem that can be solved with indicator random variables is the well known birthday paradox problem. The problem is - "How many people do you need in a room to have at least 2 with the same birthday?" (We assume that birthdays are distributed equally among all days of the year and neglect leap years.)

If there are k people in the room, we willdefine an indicator random variable Xij for the event that person i and person j have the same birthday as

随机指示变量(Indicator <wbr>Random <wbr>Variables)

Then the total pairs that have common birthdays X is simply

随机指示变量(Indicator <wbr>Random <wbr>Variables) (本质是从k个数里选两个数C(k,2))
i=1j=2~k
1=2j=3~k
......
i=k-1j=k

We compute the expected value of X similarly to before

 随机指示变量(Indicator <wbr>Random <wbr>Variables)

Now we note that the probability that i and j have the same birthday is 1/n where n is the number of days in the year. This is easily seen because person i will have birthday on a fixed day r, so the problem reduces to determining the probability of selecting a particular value (r) from n possible numbers at random. This probability is clearly 1/n.

Thus the expected value reduces to

随机指示变量(Indicator <wbr>Random <wbr>Variables)

So if we wish to have E[X] = 1 ⇒ k(k-1) ≥ 2n we can expect at least one pair of people to have the same birthday. Solving for k gives

Setting n = 365 gives k ≈ 28.


线性估计器实战指南:从偏差-方差权衡到产线七道关卡 线性估计器是统计推断与工程落地交汇的基础工具,其核心在于用可加性、同方差性与低共线性约束,在不确定性中提取稳定因果信号。它并非简单拟合函数,而是通过最小二乘及其变体(如Ridge、WLS)实现点估计与标准误协同输出,支撑置信区间与假设检验——这正是偏差-方差权衡的技术具象:牺牲部分拟合灵活性以换取鲁棒性与可解释性。广泛应用于用户留存预测、设备寿命估算、信贷风险评估等高可靠性场景,尤其适合高频更新、低信噪比及需快速归因的业务系统。本文聚焦真实产线中的残差诊断、特征工程和部署一致性,直击过拟合与偏差-方差权衡失 阅读详情

相关推荐

R语言之IndVal(指示)

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34198881的博客 3993

指示随机变量

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33845881的博客 719

【信息科学与工程学】计算机科学与自动化——第六十三篇 人机交互之前端交互参数知识库01

此方案可满足千万级并发需求,同时支持时序数据、知识图谱和文档数据库的高效处理,通过云原生架构实现极致弹性。​:每月约$15-20万(100节点K8s集群+数据库集群+CDN流量)1. 宠物上架/下架流程。

weixin_49199313的博客 1418

第五章-5.2-指示随机变量

本文为《算法导论》5.2指示随机变量的笔记,欢迎参考。

Toby的博客 987

第19章 随机变量

还有另一种定义期望的标准方法。定理19.4.3对任意的随机变量R,证明.设R定义在样本空间S中,那么。

houyiming 1608

Indicator random variables --Hat check problem

Indicator random variablesHat check problem N个顾客进入一家酒店,把帽子给保管员。走的时候保管员随机把帽子还给顾客,请问多少个顾客可以拿回自己的帽子? 假设XX为拿回自己帽子的顾客的数目。XiX_i为第ii个顾客拿回自己帽子的数目(等于概率)。有, X=X1+X2+...+XnX=X_1+X_2+...+X_n 关键在于,如何计算每个顾客拿回自己帽

骚铭科技SM-Tech! 976

All roads lead to Rome, some smooth, some rough.

算法导论习题5.2.4介绍了一个帽子保管问题(hat-check problem):有n位顾客,他们每个人给餐厅负责保管帽子的服务生一顶帽子。服务生以随机的顺序将帽子归还给顾客。请问拿到自己帽子的顾客的期望数目是多少? 解法一:利用算法导论一书中介绍的indicator random variables,假设随机变量Xi满足(1<=i<=n): 那么总的随机变...

weixin_33860737的博客 99

缺失值处理实战:MCAR/MAR/MNAR判别与鲁棒填充方案

缺失值是数据预处理中最易被低估的关键环节,其本质并非技术缺陷,而是数据生成机制(MCAR/MAR/MNAR)的客观反映。理解缺失机制决定填充策略的合理性:MCAR可接受均值/中位数填充,MAR需依赖多变量建模(如MICE、KNN),而MNAR则要求保留缺失本身作为强特征。忽视机制差异将导致分布失真、偏差传导与模型泛化失败。本文聚焦金融、电商、医疗等真实场景,结合分布保真度评估、偏差传导路径分析与实操鲁棒性验证,提供从诊断、判别到工业级Pipeline落地的完整方法论,助力数据工程师在无上帝视角下做出可解释、

weixin_34060741的博客 319

缺失数据机制诊断:MCAR、MAR与MNAR的实战识别与处理

缺失数据不是技术噪声,而是数据生成过程的结构性信号。其背后隐藏着MCAR(完全随机缺失)、MAR(随机缺失)和MNAR(非随机缺失)三类统计机制,分别对应不同因果逻辑与建模风险。理解这些机制,是避免选择性偏倚、虚假显著性和临床结论失真的前提。在医疗、金融、教育等真实世界研究中,缺失常与患者病情严重程度、用户隐私顾虑或系统采集逻辑强相关——这正是MAR与MNAR的典型场景。正确识别机制需融合可视化模式分析、Little’s检验与领域知识深挖,而非依赖单一统计判据。本文聚焦从缺失热力图、分箱缺失率到缺失指示变量

weixin_30546189的博客 334

【信息科学与工程学】【数据科学】数据科学领域——第三篇 数学08 几何学00总篇

编号英文名称中文名称简要说明/归属1Foundations of Geometry几何基础公理化方法, Hilbert《几何基础》2Euclidean Geometry (Synthetic)欧几里得几何(综合法)《几何原本》传统3Analytic Geometry解析几何坐标方法, Descartes, Fermat4Plane Geometry平面几何三角形、圆、共点共线等经典问题5Solid Geometry立体几何三维空间中的图形与度量6Non-Euclidean Geometry非欧几何平行公设不

weixin_49199313的博客 85

【信息科学与工程学】计算机科学与自动化-——第十五篇云计算 12 公有云里的“多Region + 多AZ“ 02 运营算法01

算法逐步思考推理思考(含数学方程式、对象、资源、任务、进程/协程/线程及对应的代数、约束、目标函数/传递函数/依赖函数、参数及参数的数值范围及边界条件、逐步推理的数学方程式列表、上下文切换、并发/串行/随机/乱序/顺序)算法逐步思考推理思考(含数学方程式、对象、资源、任务、进程/协程/线程及对应的代数、约束、目标函数/传递函数/依赖函数、参数及参数的数值范围及边界条件、逐步推理的数学方程式列表、上下文切换、并发/串行/随机/乱序/顺序)云厂商提高闲置资源利用率。算法复杂度为O(N),N为实例数量。

weixin_49199313的博客 208

Indicator Variables

 Indicator Variables1.       Function: Processing NULL Data2.       The value of Indicator Variable (SMALLINT)l         >=0 (usually 0), indicate that the column is not NULLl         l    

Mainframer的专栏 2241

算法导论第三版 第5章习题答案

2020/11/04 初稿,主要加了Python实现。

DavidWang9527的专栏 5138

Proc *C/C++入门之指示变量

用户能够将任何一个宿主变量同一个指示变量进行关联。指示变量必须被定义为 2 个字 节的整数类型( short),在 SQL 语句中,如果没有指定 INDICATOR 关键字,指示变量必须 紧跟在与其关联的宿主变量后。如果使用 DECLARE SECTION 声明宿主变量,则相关指示 变量也必须采用 DECLARE SECTION 进行声明。 短整型变量,用于处理数据库的NULL值,监督和管理

lzjsqn的专栏 1553

数学建模中的辅助变量、中间变量指示变量

在数学建模中,除了决策变量外,还有一些其他类型的变量,如中间变量、辅助变量指示变量。每种变量在模型中都有特定的用途和意义。

博客简介 5492

根据相同条件将多个list中的元素拼接成新的类

多个list根据相同条件拼接

summer07071126的博客 604
上一篇: Iterated Logarithm Function 多重对数函数
下一篇: 归并排序(Merge Sort)
winbobob
博客等级 码龄14年 37粉丝 14原创
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值