用于工作负载预测的朴素贝叶斯分类器

发布于 2024-12-13 00:30:14 字数 336 浏览 0 评论 0原文

我想使用朴素贝叶斯分类器来预测设备(例如网卡)的工作负载。我有一系列代表请求的到达间隔时间的观察结果。数据系列表示为 0,1,1,1,0,0,1, ...,其中 1 表示比收支平衡时间长的到达间隔时间,0 表示表示比收支平衡时间短的到达间隔时间。我想预测下一个到达时间是(短于收支平衡时间,或更长)。因此,我有两门课,即短课和长课。我已经了解了朴素贝叶斯分类器的理论,但我对在 MATLAB 或 C++ 中实现它感到困惑。我不知道应该从多少个特征/数据开始学习过程,以及如何计算预测类别的最大可能性。在这方面的任何帮助将不胜感激。

I want to use Naive Bayesian Classifier for predicting the workload of a device (e.g., network card). I have a series of observations that represent the inter-arrival times of the requests. The series of the data is represented as 0,1,1,1,0,0,1, ... where 1 represent an inter-arrival time which is longer than a Break Even Time and 0 represent an inter-arrival time that is shorter than the Break Even Time. I want to predict the next inter-arrival time to be short or long (shorter than break even time, or longer). Therefore, I have two classes, i.e., short and long. I have gone through the theory of Naive Bayesian Classifier, but I have confusion about implementing it in MATLAB or C++. I don't know with how many features/data should I start the learning process and how do I calculate the maximum likelihood for a predicted class. Any help in this regard would be highly appreciated.

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

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

发布评论

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

评论(1

柒夜笙歌凉 2024-12-20 00:30:14

您可以从马尔可夫模型开始。在马尔可夫模型中,您假设每个状态的概率仅由前一个状态给出。例如,在像 000111100111 这样的系列中,您会得到以下转换发生次数:

           Xn=0   Xn=1
X(n-1)=0     3     2
X(n-1)=1     1     5

以概率形式编写:

           Xn=0   Xn=1
X(n-1)=0    0.6    0.4
X(n-1)=1    0.17   0.83

您可以将其用作特征:扫描所有训练系列并记录从 0->0、0->1 的转换频率, 1→0和1→1。对于分类,您可以查看查询字符串的最后一个状态,并在转换矩阵中查找下一个状态为 0 或 1 的概率。并在此基础上您选择更有可能的状态。

尽管这种方法很简单,但通常效果很好。

一旦你让它与前一个数字一起工作,你就可以开始查看前两个数字并将它们用作另一个功能。因此,该示例的转换矩阵可以如下所示:

                     Xn=0   Xn=1
X(n-2)=0, X(n-1)=0     1     2
X(n-2)=0, X(n-1)=1     0     2
X(n-2)=1, X(n-1)=0     1     0
X(n-2)=1, X(n-1)=1     1     3

您甚至可以将其扩展到最后三位数字,依此类推。

要将这些特征组合在一起,只需将所有特征中下一个状态为 0 的所有概率相乘即可:

p(next is 0)=p1(next is 0)*p2(next is 0)*p3(next is 0)*...*pn(next is 0)

并且您可以类似地计算下一个状态为 1 的概率:

p(next is 1)=p1(next is 1)*p2(next is 1)*p3(next is 1)*...*pn(next is 1)

并选择更有可能的状态。当然,您不必计算 p(next is 1),因为

p(next is 0)+p(next is 1)=1

只是为了说明这种方法如何有效地与计算机玩石头剪刀布,网址为 《纽约时报》 并点击“查看计算机在想什么”来查看马尔可夫模型的实际应用。

You can begin with Markov Model. In Markov Model you assume that probability of each state is given only by the previous state. For example in a series like 000111100111 you get following transition occurrences:

           Xn=0   Xn=1
X(n-1)=0     3     2
X(n-1)=1     1     5

Written in probability:

           Xn=0   Xn=1
X(n-1)=0    0.6    0.4
X(n-1)=1    0.17   0.83

And you can use it as a feature: you scan all the training series and note frequency of transitions from 0->0, 0->1, 1->0 and 1->1. For classification you look at the last state of your query string and look up the probability that the next state will be 0, or respectively 1, in the transition matrix. And based on that you choose the more likely state.

Even thought this approach is simple, it commonly works very well.

Once you make it work with the one previous digit you can begin to look at the two previous digits and use them as another feature. Hence the transition matrix for the example can look like:

                     Xn=0   Xn=1
X(n-2)=0, X(n-1)=0     1     2
X(n-2)=0, X(n-1)=1     0     2
X(n-2)=1, X(n-1)=0     1     0
X(n-2)=1, X(n-1)=1     1     3

And you can even expand it to the last three digits and so on.

To combine the features together you just multiply all the probabilities that the next state is 0 from all the features together:

p(next is 0)=p1(next is 0)*p2(next is 0)*p3(next is 0)*...*pn(next is 0)

and you can similarly calculate the probability that the next state will be 1:

p(next is 1)=p1(next is 1)*p2(next is 1)*p3(next is 1)*...*pn(next is 1)

and choose the more likely state. Of course you don't have to calculate p(next is 1) as

p(next is 0)+p(next is 1)=1

Just for illustration how this approach is effective play Rock-Paper-Scissors against the computer at The New York Times and click on "See What the Computer is Thinking" to see the Markov Model in action.

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