- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
关于 R/中的 HIST/hist() 函数 谁能帮我找到:
一个非常简单的定义来解释“breaks”的指定值与直方图中产生的 bin 数量之间的关系?
例如,我使用 R 工具提供的基本数据集:
data(mtcars)
hist(mtcars$mpg, break=3) --> will draw 3 bins (really??? weird!)
hist(mtcars$mpg, break=4) --> will draw 5 bins
hist(mtcars$mpg, break=5) --> will draw 5 bins no change, same as breaks=4
hist(mtcars$mpg, break=6) --> will draw 5 bins no change, same as breaks=4
hist(mtcars$mpg, break=7) --> will draw 5 bins no change, same as breaks=4
hist(mtcars$mpg, break=8) --> will draw 5 bins no change, same as breaks=4
hist(mtcars$mpg, break=9) --> will draw 11 bins (why???)
最佳答案
hist
的文档说当您将中断指定为单个数字时(就像您所做的那样)然后
the number is a suggestion only; as the breakpoints will be set to pretty values
pretty
的文档链接它说
The values are chosen so that they are 1, 2 or 5 times a power of 10.
hist(mtcars$mpg, seq(10,35, length.out=5))
hist
中去掉轴。并自己添加它们。
H = hist(mtcars$mpg, seq(10,35, length.out=5), axes=FALSE, ylim=c(0,14))
axis(side=1, at=seq(10,35, length.out=5))
axis(side=2, pretty(0:14))
breaks
的进一步说明
?hist
在休息时说有 5 种类型的值可以用于休息。您正在使用的是:
a single number giving the number of cells for the histogram
the number is a suggestion only; the breakpoints will be set to pretty values.
hist
参数
breaks=4
,它知道你想要 4 个 bin,但它也会坚持使用“漂亮”的边界值,即均匀间隔的 1,2 的倍数,10 的幂的 5 倍。端点上也可能存在限制。
hist
是通过保存返回值来做的。我还将抑制直方图的实际绘制,因为现在我只对值感兴趣。
HV = hist(mtcars$mpg, 4, plot=FALSE)
breaks
中.
HV$breaks
[1] 10 15 20 25 30 35
hist
使用
pretty
函数来为边界找到更好的值,但这意味着它必须放弃使用 4 个 bin。
sapply(2:20, function(n)
length(hist(mtcars$mpg, n, plot=FALSE)$breaks))
[1] 4 4 6 6 6 6 6 13 13 13 13 13 13 13 13 25 25 25 25
unique(lapply(2:20, function(n) hist(mtcars$mpg, n, plot=FALSE)$breaks))
[[1]]
[1] 10 20 30 40
[[2]]
[1] 10 15 20 25 30 35
[[3]]
[1] 10 12 14 16 18 20 22 24 26 28 30 32 34
[[4]]
[1] 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
breaks
的其他选项之一是:
a vector giving the breakpoints between histogram cells
seq(10,35, length.out=5)
.
seq(10,35, length.out=5)
[1] 10.00 16.25 22.50 28.75 35.00
关于R 历史 : relationship between 'breaks' value and number/size of bins,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50125752/
ValueError Traceback (most recent call last) in 23 out
在 CSS 中,我从来没有真正理解为什么会发生这种情况,但每当我为某物分配 margin-top:50% 时,该元素就会被推到页面底部,几乎完全消失这一页。我假设 50% 时,该元素将位于页面的中间位
我正在尝试在 pyTorch 中训练我的第一个神经网络(我不是程序员,只是一个困惑的化学家)。 网络本身应该采用 1064 个元素向量并用 float 对它们进行评级。 到目前为止,我遇到了各种各样的
我有一个简单的问题。如何在 3 个维度上移动线性阵列?这似乎太有效了,但在 X 和 Y 轴上我遇到了索引问题。我想这样做的原因很简单。我想创建一个带有 block 缓冲区的体积地形,所以我只需要在视口
我正在尝试运行我购买的一本关于 Pytorch 强化学习的书中的代码。 代码应该按照本书工作,但对我来说,模型没有收敛,奖励仍然为负。它还会收到以下用户警告: /home/user/.local/li
我目前正在使用 this repo使用我自己的数据集执行 NLP 并了解有关 CNN 的更多信息,但我一直遇到有关形状不匹配的错误: ValueError: Target size (torch.Si
UIScrollView 以编程方式设置,请不要使用 .xib 文件发布答案。 我的 UIScrollView 位于我的模型类中,所以我希望代码能够轻松导入到另一个项目中,例如。适用于 iPad 或旋
我在我的 Ruby on Rails 应用程序(版本 4.3.1)中使用 Bootstrap gem。我最近发现了响应式字体大小功能 (rfs)。根据 Bootstrap 文档,它刚刚在 4.3 版中
这个问题不太可能帮助任何 future 的访客;它仅与一个小地理区域、一个特定时刻或一个非常狭窄的情况相关,而这些情况通常不适用于互联网的全局受众。如需帮助使这个问题更广泛地适用,visit the
size 之间的语义区别是什么?和 sizeIs ?例如, List(1,2,3).sizeIs > 1 // true List(1,2,3).size > 1 // true Luis 在 c
我想从 div 中删除一些元素属性。我的 div 是自动生成的。我想遍历每个 div 和子 div,并想删除所有 font-size (font-size: Xpx)和 size里面font tag
super ,对 Python 和一般编程 super 新手。我有一个问题应该很简单。我正在使用一本使用 Python 3.1 版的 python 初学者编程书。 我目前正在写书中的一个程序,我正在学
我无法从 NativeBase 更改缩略图的默认大小。我可以显示默认圆圈,即小圆圈和大圆圈,但我想显示比默认大小更大的圆圈。这是我的缩略图代码: Prop 大小不起作用,缩略图仍然很小。 我的 Na
我是pytorch的新手。在玩张量时,我观察到了两种类型的张量- tensor(58) tensor([57.3895]) 我打印了它们的形状,输出分别是 - torch.Size([]) torch
这是我的 docker images 命令的输出: $ docker images REPOSITORY TAG IMAGE ID CREATED
来自 PriorityQueue 的代码: private E removeAt(int i) { assert i >= 0 && i < size; modCount++;
首先,在我的系统上保留以下内容:sizeof(char) == 1 和 sizeof(char*) == 4。很简单,当我们计算下面类的总大小时: class SampleClass { char c
我正在编写一个游戏来查找 2 个图像之间的差异。我创建了 CCSprite 的子类 Spot。首先我尝试创建小图像并根据其位置添加自身,但后来我发现位置很难确定,因为很难避免 1 或 2 个像素的偏移
我有一个 Tumblr Site每个帖子的宽度由标签决定。 如果一篇文章被标记为 #width200,CSS 类 .width200 被分配。 问题是,虽然帖子的宽度不同,但它们都使用主题运算符加载相
这个问题在这里已经有了答案: What is the ideal growth rate for a dynamically allocated array? (12 个答案) 关闭 8 年前。 我
我是一名优秀的程序员,十分优秀!