问题标签 [discretization]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
622 浏览

r - 离散化数据数字并转换为整数矩阵?

我在 R 中使用RWeka对数据集进行离散化。

但我希望输出为整数矩阵。

例如: R中离散化包的所有输出都是整数矩阵。

0 投票
2 回答
84 浏览

matlab - 方波图不正确

我很尴尬地问这个问题,因为我相信我可能遗漏了一些明显的东西,但我就是看不出我哪里出错了。作为一个更大项目的一部分,我正在研究应用离散化方法来近似方波上的对流方程。但是,我注意到在某些情况下,我的方波的边界被错误地应用了。当 10.25<=X<=10.5 时,它的初始条件应该是 1,其他地方应该是 0。这是该问题的一个示例:

在这种情况下,波形显示不正确,x=10.5 取值为 0 而不是 1,如下所示:

https://dl.dropboxusercontent.com/u/8037738/project/square_wave.png

奇怪的是,如果我将域长度更改为不同的值,它有时会正确显示。这是当域长度设置为 30 并且正确显示时:

https://dl.dropboxusercontent.com/u/8037738/project/square_wave_correct.png

我真的不明白,因为我的 x 数组总是以 0.01 的间隔离散,所以它在循环时永远不会“错过”10.5。我希望我已经充分解释了这个问题,如果这是我的愚蠢错误,我提前道歉。

0 投票
2 回答
2510 浏览

numerical-methods - 2nd order centered finite-difference approximation

This question may sound mathematical, but it's more of a programming question related to discretization, so I decided to ask it here.

The problem is to find a 2nd order finite difference approximation of the partial derivative uxy, where u is a function of x and y.

Page 5 of this pdf I found does a centered difference approximation it in two steps. It first does the 2nd order centered finite-difference approximation of one of the partials, and then inserts the approximation of the second partial into it (using the same formula):

enter image description here

Inserting lines 2 and 3 into 1 gives (according to the pdf) the following:

enter image description here

The last O[(Δx)2,(Δy)2] is what I have a problem with. Notice that when the O(Δy)2 terms of lines 2 and 3 go into the numerator of 1, they are being divided by the Δx in the denominator. So how come the residual terms in line 3 are of O(Δy)2 instead of O(Δy2/Δx)? Would this be a '2nd order' approximation any more? (If, say, grid-spacing along both axes are the same (Δx=Δy=h), the term is of order h2/h =h, not h2.)

My suggestion would be to use a higher order approximation (3rd or more) in lines 2 and 3 in order to survive the division by Δx and still have the final expression in 2nd order. But I may be missing something here.

0 投票
1 回答
105 浏览

c++ - 函数在主库和库中调用不同的行为

我遇到了一件很奇怪的事情,前两天我尝试调试代码。我在 Windows 7 64 位操作系统上运行代码。我主要通过知道输入信号来计算数学模型,该模型将应用于控制算法SOOP。主要计算是可以的,但是在soop函数中做同样的事情时我得到了接近但不完全相同的结果。为什么?我也厌倦float了,我得到了同样的结果。

如果我在一个不在主函数中计算的函数会double​​被四舍五入吗?

主要的:

模型库:

控制器库使用模型库:

这两个文本文件应该显示相同的结果modelTest.txtsoop Test.txt因为我在主函数和 soop 函数中应用了相同的输入参数(s0 和 [-10,0,10])。但是我在文本文件中得到了不同的结果。 soop Test文件:

modelTest文件:

0 投票
1 回答
547 浏览

machine-learning - 连续/数字特征的相互信息

我必须计算连续/数字特征的互信息。我想基于此应用特征选择。功能集描述如下

特征1:可以假设1 - 10000之间的任何值特征2:测量花费在某事上的时间-因此可以假设除整数(大)之外的任何值....我有这些特征。

我对此应用互信息公式感到困惑。维基百科说集成是必需的连续变量。

在应用 MI 之前我需要离散化特征吗?

0 投票
5 回答
20917 浏览

scikit-learn - 如何在sklearn中对连续属性进行离散化?

我的数据包含连续和分类特征的组合。下面是我的数据在 csv 格式中的样子的小片段(将其视为由在不同城市经营商店的超级连锁店收集的数据)

你可以看到 avg_income_in_city、square_feet_of_store_area 和 avg_revenue 是连续值,其中 city、store_type 等是分类类别(为了保持数据的简洁性,我没有在这里展示更多的类别)。

我希望对数据进行建模以预测收入。问题是如何使用sklearn“离散化”连续值?sklearn 是否提供任何“现成的”类/方法来离散连续值?(就像我们在 Orange 例如 Orange.Preprocessor_discretize(data, method=orange.EntropyDiscretization())

谢谢 !

0 投票
1 回答
246 浏览

parsing - 使用 Python 从文本文件中解析数值数据

我正在尝试从数字模型输出文本文件构建数据库。文本文件有四 (4) 行标题块数据,后跟多行 (41,149) 数据块,每行由单词“INTERNAL”隔开,后跟一些数字数据,如下所示:

数据块的大小不一致(即,某些数据块的数据行数比其他数据块多)。感谢这个站点的大量帮助,我已经能够获取 41,149 行数据并将每个数据块组织成单独的列表,我可以从中解析和构建数据库。我的问题是这个操作需要很长时间。我希望有人可以查看我下面的代码,并就如何更有效地运行它给我建议。如果需要,我可以附加模型输出文件。谢谢!

0 投票
1 回答
971 浏览

r - R-疯狂值中的数据离散化

你好,stackoverflow-ers!希望你一切都好

我正在做一个项目,基本上是在尝试创建一个决策树。该数据是银行活动的数据,涉及该活动如何激励客户开设定期存款。

无论如何,我在在线资源的帮助下完成了编码等工作,并且在某一方面遇到了困难。

其中一列是所有客户的定期存款金额数字,当我绘制数据以将其可视化时(请参见附图)在此处输入图像描述

由于数据如此分散,我想对其进行离散化。我使用了以下代码:

这里

Y 轴是观察次数,X 轴是定期存款的美元金额。

但是,在此步骤之后查看该列,我看到:

现在,显然这不好。一旦创建了决策树,它就会显示这些我无法解释的奇怪类别。

在此处输入图像描述

有人可以阐明这个问题吗?非常感谢您的帮助。

0 投票
1 回答
748 浏览

data-mining - selected column discretize in weka

Is it possible to discretize selected column in weka ? I have 42 columns in my data set and I want to discretize (divide in intervals) only longitude and latitude but all columns are discretizing.

0 投票
1 回答
583 浏览

entropy - fayad 和 irani 离散化的实施

是否有实现 Fayad 和 Irani 的基于熵的离散化的 java 代码?我试过阅读文件,然后计算熵和信息增益。如何获得边界点?

我必须实现 Fayad 和 Irani 的离散化算法,该算法基于熵和信息增益([Fayad and Irani,1993]