同
library(GGally)
data(diamonds, package="ggplot2")
diamonds.samp <- diamonds[sample(1:dim(diamonds)[1],200),]
# Custom Example
ggpairs(
diamonds.samp[,1:5],
mapping = ggplot2::aes(color = cut),
upper = list(continuous = wrap("density", alpha = 0.5), combo = "box"),
lower = list(continuous = wrap("points", alpha = 0.3), combo = wrap("dot", alpha = 0.4)),
diag = list(continuous = wrap("densityDiag")),
title = "Diamonds"
)
Run Code Online (Sandbox Code Playgroud)
我明白了
如何使对角线密度图不被填充,仅显示线条?
这在代码方面真的太丑了 - 因为它对我来说没有任何意义.此外,它在这里不起作用,因为它也改变了直方图.
ggpairs(
diamonds.samp[,1:5],
mapping = ggplot2::aes(color = cut),
upper = list(continuous = wrap("density", alpha = 0.5), combo = "box"),
lower = list(continuous = wrap("points", …Run Code Online (Sandbox Code Playgroud) 我想增加标签名称的字体大小。我试过geom_label_repel(aes(label = names, label.size = 5), box.padding = unit(0.5, "lines"))。但大小不影响标签。
ggplot(df, aes(x,y,label=names)) +
geom_point(colour = "red", size = 3) +
geom_smooth(method=lm, se=FALSE, colour = "blue") +
geom_label_repel(aes(label = names, label.size = 5),
box.padding = unit(0.5, "lines")) +
xlim(0,2.5) +
ylim(0,2.5) +
theme( plot.title=element_text(size=16,face="bold"),
axis.text=element_text(size=18),
axis.title=element_text(size=20,face="bold"))
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个最小的工作示例,repartitionAndSortWithinPartitions以便了解该功能.到目前为止我没有工作(不工作,明显抛出值,以便它们失序)
def partval(partID:Int, iter: Iterator[Int]): Iterator[Tuple2[Int, Int]] = {
iter.map( x => (partID, x)).toList.iterator
}
val part20to3_chaos = sc.parallelize(1 to 20, 3).distinct
val part20to2_sorted = part20to3_chaos.repartitionAndSortWithinPartitions(2)
part20to2_sorted.mapPartitionsWithIndex(partval).collect
Run Code Online (Sandbox Code Playgroud)
但得到错误
Name: Compile Error
Message: <console>:22: error: value repartitionAndSortWithinPartitions is not a member of org.apache.spark.rdd.RDD[Int]
val part20to2_sorted = part20to3_chaos.repartitionAndSortWithinPartitions(2)
Run Code Online (Sandbox Code Playgroud)
我尝试使用scaladoc,但无法找到哪个类提供repartitionAndSortWithinPartitions.(顺便说一下:这个scaladoc并不令人印象深刻:为什么会MapPartitionsRDD丢失?我如何搜索方法?)
意识到我需要一个分区器对象,接下来我尝试了
val rangePartitioner = new org.apache.spark.RangePartitioner(2, part20to3_chaos)
val part20to2_sorted = part20to3_chaos.repartitionAndSortWithinPartitions(rangePartitioner)
part20to2_sorted.mapPartitionsWithIndex(partval).collect
Run Code Online (Sandbox Code Playgroud)
但得到了
Name: Compile Error
Message: <console>:22: error: type mismatch;
found : org.apache.spark.rdd.RDD[Int]
required: …Run Code Online (Sandbox Code Playgroud) Apache Ignite的索引如何工作?我没有在文档中找到这些技术细节.
我正在使用Kubuntu 14.4,我安装了Scala 2.9.2,IntelliJ 2016.1和版本3.0.2中的Scala插件.当我创建一个新的Scala项目(而不是sbt项目),然后右键单击src然后new,我希望选项创建一个新的Scala工作表.但是,我没有这个选择.我需要做什么才能获得选项?
PS:事实上,我没有得到任何与创建Scala相关的选项.
我使用breeze的集合(即DenseVector),其中我有整数和双精度等,并使用它们有点像你可能使用numpy的数组.我偶然发现了https://github.com/non/spire.我的印象是,它在收藏方面不是那么强大,但是我可能想要收藏的类型更强 - 例如Interval听起来很棒.我的印象是否合适并将他们结合起来是一个好主意?
从/sf/answers/2833244011/我了解到Breeze使用netlib-java非常快.如果我将AnyRef(在这种情况下来自Spire)DenseVector的后代放入后端数组而不是后代中,我会破坏这种速度AnyVal吗?
这个问题可能看起来有点基础,但无法找到我在互联网上理解的任何内容.如何储存我用莳萝腌制的东西?
我来这里是为了保存我的构造(pandas DataFrame,它也包含自定义类):
import dill
dill_file = open("data/2017-02-10_21:43_resultstatsDF", "wb")
dill_file.write(dill.dumps(resultstatsDF))
dill_file.close()
Run Code Online (Sandbox Code Playgroud)
和阅读
dill_file = open("data/2017-02-10_21:43_resultstatsDF", "rb")
resultstatsDF_out = dill.load(dill_file.read())
dill_file.close()
Run Code Online (Sandbox Code Playgroud)
但我在阅读时得到了错误
TypeError: file must have 'read' and 'readline' attributes
Run Code Online (Sandbox Code Playgroud)
我该怎么做呢?
在https://math.stackexchange.com/a/2233298/340174中提到,如果通过 LU 分解完成,求解线性方程“M\xc2\xb7x = b”(矩阵 M 是方)会很慢(但甚至更慢)使用 QR 分解)。现在我注意到这numpy.linalg.solve实际上是使用 LU 分解。事实上,我想求解“V\xc2\xb7x = b”以获得最小二乘的非平方范德蒙设计矩阵 V。我不想要正则化。我看到多种方法:
numpy.linalg.lstsq,它使用基于 SVD 的 Fortran“xGELSD”。SVD 应该比 LU 分解更慢,但我不需要计算“(V^T\xc2\xb7V)”。numpy.linalg.solve,它使用 LU 分解。numpy.linalg.solve,它使用LU分解,但直接根据https://math.stackexchange.com/a/3155891/340174计算“A=xV^T\xc2\xb7V”或者,我可以使用 scipy 的最新版本solve(https://docs.scipy.org/doc/scipy-1.2.1/reference/ generated/scipy.linalg.solve.html),它可以对对称矩阵“A”使用对角旋转“(我猜这比使用 LU 分解更快),但我的 scipy 停留在 1.1.0 上,所以我无法访问它。
从/sf/answers/3187486641/看来,它solve比 更快lstsq,包括计算“V^T\xc2\xb7V”,但当我尝试时,lstsq速度更快。也许我做错了什么?
解决线性问题的最快方法是什么?
\n\n前几天我读了https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow,我有一个问题.
如果在项目中使用功能分支或Gitflow分支工作流:是否存在用户将功能分支作为跟踪功能分支推送到源的选项发出拉取请求,并且只有项目的维护者才能合并跟踪功能分支进入主(功能分支工作流)或开发(Gitlow分支工作流)?
换句话说:是否可以将分支分配给用户,以便如果不想让事情过于复杂但仍然保证代码审查能够保证master/develop分支免受新手的影响,那么人们就不会立即需要分岔工作流程?
这与R和ggpairs中用户定义的调色板中的问题相同 ,或者有没有办法使用ggplot更改GGally :: ggpairs的调色板?
只有那里的解决方案不再有效.
我也想更改调色板,但有没有办法使用ggplot更改GGally :: ggpairs的调色板?不再起作用了.该怎么办?
MWE:
library(GGally)
library(ggplot2)
data(diamonds, package="ggplot2")
diamonds.samp <- diamonds[sample(1:dim(diamonds)[1],200),]
ggpairs(
diamonds.samp[,1:2],
mapping = ggplot2::aes(color = cut),
upper = list(continuous = wrap("density", alpha = 0.5), combo = "box"),
lower = list(continuous = wrap("points", alpha = 0.3), combo = wrap("dot", alpha = 0.4)),
diag = list(continuous = wrap("densityDiag")),
title = "Diamonds"
)
Run Code Online (Sandbox Code Playgroud)
我想补充一下
scale_colour_manual(values=c('red','blue','green','red','blue'))
Run Code Online (Sandbox Code Playgroud)
(显然这只是虚拟代码)并得到类似的东西(我没有绘制所有的点):