首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏生物信息学、python、R、linux

    分位数(quantile

    以分位数中一个常见例子四分位数(quartile)为例(这个已经排序好了): 1,1,3,6,7,12,14,17,25,28,29 其中第一四分位数: Q1 = (11 + 1)* 1 / 4 = 3 R中可以调用quantile ()函数: a <- c(2,3,1,4,5,6,7,9,2) #四分之一位数 quantile(a, 0.25) # 其结果等同于 sort(a)[2] 百分分数是把数据分成100等份后所获得的数。

    3.1K10发布于 2020-04-01
  • 来自专栏DeepHub IMBA

    分位数回归(quantile regression)简介和代码实现

    分位数(Quantile),亦称分位点,是指将一个随机变量的概率分布范围分为几个等份的数值点,常用的有中位数(即二分位数)、四分位由3个部分组成(第25、50和75个百分位,常用于箱形图)和百分位数等。 .data mod = smf.quantreg("foodexp ~ income", data) res = mod.fit(q=0.5) print(res.summary()) 我们可以看看quantile /score return score @staticmethod def quantile_loss(y_true,y_pred,alpha,delta,threshold (y_true, y_pred, alpha): score = XGBQuantile.quantile_cost(x=y_true-y_pred,alpha=alpha) score = np.sum(score) return score @staticmethod def quantile_cost(x, alpha): return (alpha

    7.7K30发布于 2021-11-08
  • 来自专栏PingCAP的专栏

    Prometheus 常用函数 histogram_quantile 的若干“反直觉”问题

    作者:disksing histogram_quantile 是 Prometheus 特别常用的一个函数,比如经常把某个服务的 P99 响应时间来衡量服务质量。 histogram 场景下的 quantile 前面的内容都是从 quantile 的定义出发的,并不限于 Prometheus 平台。 具体针对 Prometheus 里的 histogram_quantile,还有一些要注意的点。 如果 bucket 设置的不合理,会产生不符合预期的 quantile 结果。 因此如果观察到 histogram_quantile 曲线是笔直的水平线,很可能就是 bucket 设置不合理了。

    7.8K11发布于 2020-02-02
  • 来自专栏拓端tecdat

    R语言分位数回归Quantile Regression分析租房价格

    r = lp("min", c(rep(1,2*n),0), tail(r$solution,1) [1] 1.01523 分位数 当然,我们可以将之前的代码改编为分位数 tau = .3 quantile

    1K20发布于 2020-12-30
  • 来自专栏钱塘小甲子的博客

    alphalens教程4--Turnover Analysis

    def quantile_turnover(quantile_factor, quantile, period=1):         我们来看一下这个计算出来的是什么:某一层因子中,某个股票之前不在这个层 参数解释: quantile_factor : pd.Series 日期、股票名为index,因子层序号为value的series,也就是factor_data['factor_quantile'] ,所以,我们先把quantile_factor = factor_data['factor_quantile']定义好。 quantile_turnover = pd.concat([alphalens.performance.quantile_turnover(quantile_factor, q, turnover_period def plot_top_bottom_quantile_turnover(quantile_turnover, period=1, ax=None): top和bottom层的换手率图。

    1.8K20发布于 2019-01-28
  • 来自专栏容器计算

    prometheus-nginxlog-exporter构建Nginx日志监控

    ="0.5"} NaN nginx_http_response_time_seconds{app="default",bucket="",method="GET",status="200",quantile ="0.9"} NaN nginx_http_response_time_seconds{app="default",bucket="",method="GET",status="200",quantile 2 nginx_http_response_time_seconds{app="default",bucket="general__lingqu",method="GET",status="200",quantile nginx_http_response_time_seconds{app="default",bucket="general__lingqu",method="HEAD",status="200",quantile nginx_http_response_time_seconds{app="default",bucket="general__lingqu",method="HEAD",status="200",quantile

    3.6K51发布于 2020-08-06
  • 来自专栏python3

    Python解释数学系列——分位数Qua

    (data, 0.25) print("Q1:", Q1) Q2 = quantile_p(data, 0.5) print("Q2:", Q2) Q3 = quantile_p(data, 0.75) (data, 0.25) print("Q1:", Q1) Q2 = quantile_p(data, 0.5) print("Q2:", Q2) Q3 = quantile_p(data, 0.75) (data, 0.25) print("Q1:", Q1) Q2 = quantile_p(data, 0.5) print("Q2:", Q2) Q3 = quantile_p(data, 0.75) (.25)) print('Q2:', df.quantile(.5)) print('Q3:', df.quantile(.75)) 计算结果 Q1: 25.5 Q2: 40.0 Q3: 42.5 分位数概念 2. pandas中的quantile

    1.9K70发布于 2020-01-19
  • 来自专栏智能算法

    到底该如何选择损失函数?

    这时,Quantile Loss就派上用场了。因为基于Quantile Loss的回归模型可以提供合理的预测区间,即使是对于具有非常数方差或非正态分布的残差亦是如此。 Quantile回归:虚线表示基于0.05和0.95 分位数损失函数的回归估计 如上所示的Quantile回归代码在下面这个notebook中。 Quantile Loss函数 基于Quantile回归的目的是,在给定预测变量的某些值时,估计因变量的条件“分位数”。 Quantile Loss实际上只是MAE的扩展形式(当分位数是第50个百分位时,Quantile Loss退化为MAE)。 Quantile Loss的思想是根据我们是打算给正误差还是负误差更多的值来选择分位数数值。损失函数根据所选quantile (γ)的值对高估和低估的预测值给予不同的惩罚值。

    2.6K50发布于 2018-07-30
  • 来自专栏计算机工具

    如何选择合适的损失函数

    这时,Quantile Loss就派上用场了。因为基于Quantile Loss的回归模型可以提供合理的预测区间,即使是对于具有非常数方差或非正态分布的残差亦是如此。 橙线表示两种情况下的OLS估计 Quantile回归:虚线表示基于0.05和0.95 分位数损失函数的回归估计 如上所示的Quantile回归代码在下面这个notebook中。 了解Quantile Loss函数 基于Quantile回归的目的是,在给定预测变量的某些值时,估计因变量的条件“分位数”。 Quantile Loss实际上只是MAE的扩展形式(当分位数是第50个百分位时,Quantile Loss退化为MAE)。 Quantile Loss的思想是根据我们是打算给正误差还是负误差更多的值来选择分位数数值。损失函数根据所选quantile (γ)的值对高估和低估的预测值给予不同的惩罚值。

    95310编辑于 2024-12-14
  • 来自专栏优雅R

    「R」数据汇总时自动生成多列

    > probs <- c(0.25, 0.5, 0.75) > > Z %>% + summarize(x = mean(x), + quantile = list( quantile(y, probs)), + prob = list(probs)) %>% + unnest(cols = c("quantile", "prob" > Z %>% + summarize(x = mean(x), + quantile = list(quantile(y, probs)), + > Z %>% + summarize(x = mean(x), + quantile = list(quantile(y, probs)), + prob = list(probs)) %>% + unnest(cols = c("quantile", "prob")) %>% + pivot_wider(names_from = "prob",

    1.4K20发布于 2020-07-03
  • 来自专栏拓端tecdat

    R语言在不同样本量下的Littles MCAR检验

    geom_crossbar(aes(ymin = q025, y = q05, ymax = q075), data = summarise( group_by(little.mcar.p, n), q025 = quantile (p, .025, na.rm = TRUE), q05 = quantile(p, .05, na.rm = TRUE), q075 = quantile(p, .075, na.rm = TRUE aes(ymin = q925, y = q95, ymax = q975), data = summarise( group_by(little.mcar.p.mar, n), q925 = quantile (p, .925, na.rm = TRUE), q95 = quantile(p, .95, na.rm = TRUE), q975 = quantile(p, .975, na.rm = TRUE

    1.3K20发布于 2020-08-14
  • 来自专栏AI科技大本营的专栏

    如何选择合适的损失函数,请看......

    这时,Quantile Loss就派上用场了。因为基于Quantile Loss的回归模型可以提供合理的预测区间,即使是对于具有非常数方差或非正态分布的残差亦是如此。 Quantile回归:虚线表示基于0.05和0.95 分位数损失函数的回归估计 如上所示的Quantile回归代码在下面这个notebook中。 Quantile Loss函数 基于Quantile回归的目的是,在给定预测变量的某些值时,估计因变量的条件“分位数”。 Quantile Loss实际上只是MAE的扩展形式(当分位数是第50个百分位时,Quantile Loss退化为MAE)。 Quantile Loss的思想是根据我们是打算给正误差还是负误差更多的值来选择分位数数值。损失函数根据所选quantile (γ)的值对高估和低估的预测值给予不同的惩罚值。

    1.5K20发布于 2018-07-23
  • 来自专栏小明的数据分析笔记本

    eQTL分析中对转录组表达量的值进行分位数标准化和反正则转换

    /quantile-normalization-and-inverse-normal-transform/ 也没看太明白,基本上做eQTL分析的论文里方法部分都会写这个,比如开头提到的论文,方法不部分写到 Finally, TPM values were quantile normalized and inverse normal transformed across samples per gene distribution of expression values for each gene, FPKM values of each gene were further normalized using the quantile-quantile Raw expression levels were normalized with quantilequantile normalization 这篇文章里提供的代码链接 https://github.com """ M = df.values.copy() Q = M.argsort(axis=0) m,n = M.shape # compute quantile

    65110编辑于 2023-12-26
  • 来自专栏LN生物笔记

    R语言 | GEO单通道芯片表达矩阵标准化

    quantile normalization(分位数标准化) 这是一个比较常见的数据标准化处理方法,对于这个方法我画了一张图便于大家理解。 quantile normalizatio总共有三步: 按照数值从大到小的顺序,在每一列里从上到下重新排列每一列中的表达量。 quantile normalization将数据的分位数统一,即把不同样本的数据的分位数对应到相同的值上。 那么实际应用到我们今天的示例数据GSE97508上,quantile normalization后的箱型图是这样的: quantile normalization 可以看到quantile normalization 但是呢,也有研究表明,quantile normalization之后的数据会改变原始数据的分布,造成有些差异基因不显著。

    1.5K21编辑于 2023-02-23
  • 来自专栏小明的数据分析笔记本

    跟着Nature学数据分析:R语言peer包处理RNAseq分析的批次效应

    Raw expression levels were normalized with quantilequantile normalization. 论文里提供了 quantilequantile normalization 的代码 https://github.com/YaoZhou89/TGG/blob/main/5.Genetic_analysis /scripts/prepare_gene_expression.R quantile_normalisation <- function(df){ df_rank <- apply(df,2,rank distribution of expression values for each gene, FPKM values of each gene were further normalized using the quantile-quantile The top 20 hidden and confounding factors in the expression data, the normal quantile transformed expression

    2K30编辑于 2023-08-23
  • 来自专栏天意生信俱乐部

    Nature | 5月14日新发表:空间转录组文章复现(三)

    (j,0.75)-np.quantile(j,0.25) for j in dist_all]).argsort()[:40]]   genes = adata1.var.index[np.array( [np.quantile(i,0.75)-np.quantile(i,0.25) for i in dist_all]).argsort()[:40]]   dict1 = dict(zip(genes (j,0.75)-np.quantile(j,0.25) for j in dist_all]).argsort()[:40]]   #genes = adata1.var.index[np.array ([np.quantile(i,0.75)-np.quantile(i,0.25) for i in dist_all]).argsort()[:40]]   dict1 = dict(zip(genes .obs.H3_annotation==layer_types[1]].cortical_depth, 0.75))/2   l3_4 = (np.quantile(adata1.obs[adata1.

    17900编辑于 2025-06-08
  • 来自专栏量化投资与机器学习

    市场波动加剧:动量策略参数是否应该更敏感?

    = [get_historic_quantile_for_norm_vol(normalised_vol, quantile) for quantile in quantiles] stacked_quantiles_and_vol = pd.concat(quantile_points+[normalised_vol], axis=1) quantile_groups = stacked_quantiles_and_vol.apply (calculate_group_for_row, axis=1) return quantile_groups def get_historic_quantile_for_norm_vol (normalised_vol, quantile_point): return normalised_vol.rolling(99999, min_periods=4).quantile(quantile_point ): if np.isnan(vol_quantile): return 1.0 return 2 - 1.5*vol_quantile 下面是基于连续的市场波动变化的交易系统

    86810发布于 2021-04-16
  • 来自专栏拓端tecdat

    R语言在不同样本量下的Littles MCAR检验

    geom_crossbar(aes(ymin = q025, y = q05, ymax = q075), data = summarise( group_by(little.mcar.p, n), q025 = quantile (p, .025, na.rm = TRUE), q05 = quantile(p, .05, na.rm = TRUE), q075 = quantile(p, .075, na.rm = TRUE aes(ymin = q925, y = q95, ymax = q975), data = summarise( group_by(little.mcar.p.mar, n), q925 = quantile (p, .925, na.rm = TRUE), q95 = quantile(p, .95, na.rm = TRUE), q975 = quantile(p, .975, na.rm = TRUE

    82100发布于 2020-08-22
  • 来自专栏深度学习和计算机视觉

    如何选择合适的损失函数,请看......

    这时,Quantile Loss就派上用场了。因为基于Quantile Loss的回归模型可以提供合理的预测区间,即使是对于具有非常数方差或非正态分布的残差亦是如此。 橙线表示两种情况下的OLS估计 Quantile回归:虚线表示基于0.05和0.95 分位数损失函数的回归估计 如上所示的Quantile回归代码在下面这个notebook中。 Quantile Loss函数 基于Quantile回归的目的是,在给定预测变量的某些值时,估计因变量的条件“分位数”。 Quantile Loss实际上只是MAE的扩展形式(当分位数是第50个百分位时,Quantile Loss退化为MAE)。 Quantile Loss的思想是根据我们是打算给正误差还是负误差更多的值来选择分位数数值。损失函数根据所选quantile (γ)的值对高估和低估的预测值给予不同的惩罚值。

    1.6K10编辑于 2022-09-28
  • 来自专栏钱塘小甲子的博客

    alphalens教程2--基于return的因子分析

    1.获得因子平均收益率数据 因子收益率分析的第一个函数定义如下: def mean_return_by_quantile(factor_data, mean_return_by_q_group, std_err = alphalens.performance.mean_return_by_quantile(factor_data, by_group 上面的按日期算均值的mean_ret有一个美丽的用法,就是结合alphalens.plotting.plot_quantile_returns_violin绘制提琴图。 alphalens.plotting.plot_quantile_returns_violin(mean_return_by_q_daily) ?   def plot_cumulative_returns_by_quantile(quantile_returns, period=1, ax=None):   参数解释:     quantile_returns

    5.1K31发布于 2019-01-28
领券