R 中随时间变化的聚类

发布于 2024-12-06 19:38:31 字数 412 浏览 0 评论 0原文

我有一系列数据,我将对其使用聚类,并且我想了解这些数据随着时间的推移如何聚类。

因此,基本上每个人都从一个小组开始,因为他们什么也没做,但随着时间的推移,当他们做不同的事情时,他们将根据他们的行为被分成不同的小组,我想跟踪这一点。

我一直在寻找一种在 R 中执行此操作的方法(在 Python 中对数据进行一些预处理),并以图形方式表示它。目前我能想到的唯一方法是将时间段分成三周,然后对这三周中的每一周进行聚类。唯一的问题是我真的不知道如何跟踪这三周内人群在集群之间的移动(例如,看看某人的行为是否将他们从 A 组移动到 B 组)。我可以把它放在一个表格中,但最好以某种方式以图形方式显示它(例如随着时间的推移集群之间的红线或其他东西)。

任何有关如何执行此操作的想法将不胜感激,或者如果有一种很好的方法可以随着时间的推移跟踪我一直缺少的集群,请指出我的方向。

I have a series of data that I'm going to use clustering on, and I want to see how this data clusters over time.

So essentially everyone starts in a single group, as they have done nothing, but over time as they do different things they will be put into different groups based on their behavior, and I want to track this.

I've been looking for a way to do this in R (with some preprocessing of data in Python), and represent it graphically. The only way I can currently think of doing this is breaking the time period into say, 3 weeks, and then clustering each of the 3 weeks. The only problem with this is I don't really know how to track movements of people between clusters over those 3 weeks (e.g. to see if someones actions moves them from group A to group B). I could put it in a table, but it would be nice to somehow show it graphically (like red lines between cluster over time or something).

Any ideas on how to do this would be much appreciated, or if there is a good way to track clusters over time that I've been missing please point me towards it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

芸娘子的小脾气 2024-12-13 19:38:31

我在 Mfuzz 中使用过="http://www.r-project.org/" rel="nofollow noreferrer">R 用于聚类时程微阵列数据集。 Mfuzz 使用“软聚类”。基本上,个体可以出现在多个群体中。这是一个包含一些模拟数据的示例:

library(Mfuzz)

tps = 6;cases = 90
d = rnorm(tps*cases, 1)  ##Poisson distribution with mean 1
m = matrix(d, ncol=tps, nrow=cases)

##First 30 individuals have increasing trends
m[1:30,] = t(apply(m[1:30,], 1, cumsum))

##Next 30 have decreasing trends
##A bit hacky, sorry
m[31:60,] = t(apply(t(apply(m[31:60,], 1, cumsum)), 1, rev))

##Last 30 individuals have random numbers from a Po(1)

##Create an expressionSet object
tmp_expr = new('ExpressionSet', exprs=m)

##Specify c=3 clusters
cl = mfuzz(tmp_expr, c=3, m=1.25)
mfuzz.plot(tmp_expr,cl=cl, mfrow=c(2, 2))

这给出了:

在此处输入图像描述

I've used the Mfuzz in R for clustering time-course microarray data sets. Mfuzz uses "soft-clustering". Basically, individuals can appear in more than one group. Here is an example with some simulated data:

library(Mfuzz)

tps = 6;cases = 90
d = rnorm(tps*cases, 1)  ##Poisson distribution with mean 1
m = matrix(d, ncol=tps, nrow=cases)

##First 30 individuals have increasing trends
m[1:30,] = t(apply(m[1:30,], 1, cumsum))

##Next 30 have decreasing trends
##A bit hacky, sorry
m[31:60,] = t(apply(t(apply(m[31:60,], 1, cumsum)), 1, rev))

##Last 30 individuals have random numbers from a Po(1)

##Create an expressionSet object
tmp_expr = new('ExpressionSet', exprs=m)

##Specify c=3 clusters
cl = mfuzz(tmp_expr, c=3, m=1.25)
mfuzz.plot(tmp_expr,cl=cl, mfrow=c(2, 2))

This gives:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文