gpt4 book ai didi

r - 相对于前两个值绘制第三个值

转载 作者:行者123 更新时间:2023-11-30 09:30:21 25 4
gpt4 key购买 nike

我有以下数据:

kNN,               kMeans,           expected
1.1048387096774193,2.019927536231884,0.0
1.521505376344086,2.0120481927710845,0.0
1.271505376344086,2.019927536231884,0.0
2.020833333333333,2.019927536231884,0.0
0.7708333333333334,2.019927536231884,0.0
4.020408163265306,2.0120481927710845,0.0
0.6210526315789474,2.019927536231884,0.0
0.7708333333333334,2.019927536231884,0.0
3.354166666666667,2.019927536231884,0.0
2.020833333333333,2.019927536231884,1.0
1.450310559006211,2.0120481927710845,0.0
0.8719780219780221,2.019927536231884,-1.0
4.020408163265306,2.019927536231884,-1.0
3.520618556701031,2.019927536231884,1.0
1.521505376344086,2.019927536231884,0.0

我想根据 kNNkMeans 中的值绘制预期?我尝试阅读有关 R 中绘图的散点图,但无法确定哪个图有用。任何帮助,将不胜感激。我尝试了散点图,但它没有给我太多信息

我的目标是探索数据,看看我是否可以训练单层感知以接近预期。如果数据是线性可分的(多类,因此是针对剩余方法的)。

谢谢。

最佳答案

这是我能想到的:

dat <-
structure(list(kNN = c(1.10483870967742, 1.52150537634409, 1.27150537634409,
2.02083333333333, 0.770833333333333, 4.02040816326531, 0.621052631578947,
0.770833333333333, 3.35416666666667, 2.02083333333333, 1.45031055900621,
0.871978021978022, 4.02040816326531, 3.52061855670103, 1.52150537634409
), kMeans = c(2.01992753623188, 2.01204819277108, 2.01992753623188,
2.01992753623188, 2.01992753623188, 2.01204819277108, 2.01992753623188,
2.01992753623188, 2.01992753623188, 2.01992753623188, 2.01204819277108,
2.01992753623188, 2.01992753623188, 2.01992753623188, 2.01992753623188
), expected = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, -1, -1, 1, 0
)), .Names = c("kNN", "kMeans", "expected"), class = "data.frame", row.names = c(NA,
-15L))

plot(dat$kNN, dat$kMeans, col=dat$expected+2)

关于r - 相对于前两个值绘制第三个值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8683830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com