由买买提看人间百态

topics

全部话题 - 话题: smote
1 (共1页)
E**********e
发帖数: 1736
1
这个我做过。你需要知道怎么计算category 变量的距离。好像有篇文章,就是原作者
的一篇介绍SMOTE文章谈到这个怎么处理categorical变量。
但是这个SMOTE对于实际问题也许效果不好。学校里做作也许能灌两篇文章。

:SMOTE只能处理continuous data, 对于categorical data 要用SMOTE-NC,google了很
:多就是没有找到相关可行的code。希望好心人能share 一下。

发帖数: 1
2
是machine learning的课程项目。
我们的数据是unbalanced,大部分是continuous, 只有少数几列是categorical的,因为
我们要用到logistic regression, svm, 所以把categorical都转化为dummy variable,
结果在用SMOTE的时候这些dummy cariable都变成0到1之间的数据。
现在两个问题:
1)原本的class组成是10700 class-1, 1450 class-0;用完SMOTE, 数据变成 5500
class-1, 4100 calss-0; 这些categorical的数据不能单独拿出来呀? 本身SMOTE用的
就是点到点之间的距离来cluster这些点的;
2)现在想死马当活马来用,想把 《0.5 的归于0;》=0.5的归为1。

了很

发帖数: 1
3
SMOTE只能处理continuous data, 对于categorical data 要用SMOTE-NC,google了很
多就是没有找到相关可行的code。希望好心人能share 一下。
谢谢!!
x***t
发帖数: 263
4
原paper里讲了一种实现:
Populate the synthetic sample: The continuous features of the new synthetic
minority
class sample are created using the same approach of SMOTE as described
earlier. The
nominal feature is given the value occurring in the majority of the k-
nearest neighbors
如果已经做了dummy variable,SMOTE之后出来0 到 1之间的值,那就应该把最大的变1
,其他全部归零。

variable,

发帖数: 1
5
我有一个州的变量,总共10个不同的州。
我后面有个回复,没有变成DUMMY VARIABLE的时候,SMOTE是变成具体的州了,这个是
我后面又尝试的方法。
一开始的问题是:变成DUMMY VARIABLE后用SMOTE,州出来的不是0,1而是0-1之间的数
据。

level,
m******r
发帖数: 1033
6
hi, 有答案了吗 ? 我以前碰到过一样的问题,一直没有合适的方法。具体说,就是美
国50个州,怎么把州变成数字,让机器算?
想不到smote这么牛b的算法,也束手无策 . 我以为这种问题早就解决了。
E**********e
发帖数: 1736
7
SMOTE 不复杂啊。你读原作者的文章,你可以CODE 出来的啊。当然原作者的终极版有
优化。
我同时用R 和 PYTHON code 了。但是最终实际效果在risk model 上表现不好。实际上
我也不看好这个方法。
至于CATEGORICAL 变量,可以算距离的,不需要处理成DUMMY 变量。然后用最近铃算法
,取majority vote.

:在没有把categorical data 变成 dummy variable的时候,用WEKA 能够生成出具体的
:哪一个州。但是WEKA,R studio 产生的结果不同。weka只是double minority class
, 保持majority class. 但是R studio 能够产生基本45%,55%的两个classes. 不知道
哪个是对的。
m******r
发帖数: 1033
8
思路有些乱, 说写具体的吧, 比如你的数据集有地区这个变量,该变量有四个level,
分别是东南西北。 你要建模型,甭管什么模型,能说说smote能把东南西北变成数字
吗??

,
E**********e
发帖数: 1736
9
你要了解smote,你必须去看原作者的文章。 原作者用 value distance metric 来算
noncontinuous variable的距离, 然后跟continuouvariable 以起算距离。 这个距离
是用来选出对应某个样品的最近的几个邻居, 然后算出fake的那个样品,么就是每个
变量都有一个新的值, 然后在用majority vote 来制定这个faked的样品是1还是0.
不需要非得把categorical variable 处理成 dummy varaible。 比如50个州, 你用49
个dummy variable? 不麻烦。 你可以group 一些。 然后用log of odds order them
, 如果可以的话。 要是不能order ,但是还是要放进去, 那这能dummy了。 但是如
果不能order 新的group, 那么这个variable 也就不重要, 或者没有预测力。
里边谈到怎么算categorical 变量的距离, 酵素

dataset
w**j
发帖数: 1032
10
来自主题: Military版 - Murder in the Bible (Evil Bible.com)
The act of murder is rampant in the Bible. In much of the Bible,
especially the Old Testament, there are laws that command that people be
killed for absurd reasons such as working on the Sabbath, being gay, cursing
your parents, or not being a virgin on your wedding night. In addition to
these crazy and immoral laws, there are plenty of examples of God's
irrationality by his direct killing of many people for reasons that defy any
rational explanation such as killing children who make fun of... 阅读全帖
a***k
发帖数: 1038
11
来自主题: Military版 - 红死病 by 杰克.伦敦 (转载)
【 以下文字转载自 paladin 讨论区 】
发信人: atack (小军号), 信区: paladin
标 题: 红死病 by 杰克.伦敦
发信站: BBS 未名空间站 (Sat Oct 11 07:40:15 2014, 美东)
I
The way led along upon what had once been the embankment of a railroad. But
no train had run upon it for many years. The forest on either side swelled
up the slopes of the embankment and crested across it in a green wave of
trees and bushes. The trail was as narrow as a man's body, and was no more
than a wild-animal runway.
Occasionally, a piece of rusty iron, showing through ... 阅读全帖
z********6
发帖数: 852
12
来自主题: Love版 - 我和穆斯林女孩的事情
古兰经有164处关于对异教徒发动圣战(jihad)的描述
The Koran's 164 Jihad Verses
K 2:178-179
Set 1, Count 1+2 [2.178] O you who believe! retaliation is prescribed for
you in the matter of the slain, the free for the free, and the slave for
the slave, and the female for the female, but if any remission is made to
any one by his (aggrieved) brother, then prosecution (for the bloodwit)
should be made according to usage, and payment should be made to him in a
good manner; this is an alleviation from your Lord and a mer... 阅读全帖
a***k
发帖数: 1038
13
来自主题: paladin版 - 红死病 by 杰克.伦敦
I
The way led along upon what had once been the embankment of a railroad. But
no train had run upon it for many years. The forest on either side swelled
up the slopes of the embankment and crested across it in a green wave of
trees and bushes. The trail was as narrow as a man's body, and was no more
than a wild-animal runway.
Occasionally, a piece of rusty iron, showing through the forest-mold,
advertised that the rail and the ties still remained. In one place, a ten-
inch tree, bursting through... 阅读全帖
l*****a
发帖数: 38403
14
来自主题: TrustInJesus版 - Listen to God! y'all
2) God's Murders for Stupid Reasons:
 
Kill Brats
    From there Elisha went up to Bethel.  While he was
on his way, some small boys came out of the city and jeered at him.  "
Go up baldhead," they shouted, "go up baldhead!"  The prophet turned
and saw them, and he cursed them in the name of the Lord.  Then two
shebears came out of the woods and tore forty two of the children to pieces.
 (2 Kings 2:23-24 NAB)
 
God Kills the Curious 
 &... 阅读全帖
C****i
发帖数: 1776
15
CHAPTER XXII
Of Lawful Oaths and Vows
I. A lawful oath is a part of religious worship,[443] wherein, upon just occ
asion, the person swearing solemnly calleth God to witness what he asserteth
, or promiseth, and to judge him according to the truth or falsehood of what
he sweareth.[444]
II. The name of God only is that by which men ought to swear, and therein it
is to be used with all holy fear and reverence.[445] Therefore, to swear va
inly, or rashly, by that glorious and dreadful Name; or, to ... 阅读全帖
x***t
发帖数: 263
16
来自主题: DataSciences版 - 请教一道面试题
尽管4M*2.5% 绝对数量很大,但是还是2.5% vs 97.5% 的imbalanced class problem。
一般策略是:
1)over sampling on minority class (缺点:overfitting,只是把decision
boundary 做细,没有genralize)
2) under sampling on majority class
3) synthesize data points
第三个参考SMOTE和ADASYN 两种方法。python有现成package:imbalanced-learn
SMOTE和ADASYN的papers:
https://www.jair.org/media/953/live-953-2037-jair.pdf
http://sci2s.ugr.es/keel/pdf/algorithm/congreso/2008-He-ieee.pdf

reasonable
t*****k
发帖数: 2547
17
FAREWELL, LEIGHTON STUART!
August 18, 1949
It is understandable that the date chosen for the publication of the U.S
. White Paper was August 5, a time when Leighton Stuart[1] had departed from
Nanking for Washington but had not yet arrived there, since Leighton Stuart
is a symbol of the complete defeat of the U.S. policy of aggression.
Leighton Stuart is an American born in China; he has fairly wide social
connections and spent many years running missionary schools in China; he
once sat in a... 阅读全帖
w*********g
发帖数: 30882
18
这是伟大的休战时间。所有国家都庄严承诺自己不与任何其他国家打仗。俄罗斯,德国
,奥地利,意大利,希腊和土耳其的军队开始逐步动员,第一波行动开始。力量集结后
开始向东移动。所有铁路上都充斥着到亚洲的部队的列车。中国是这一切行动的最终目
标。过了一段时间后,庞大的海上行动。来自各个国家的远洋军舰远征而出,舰队随后
,一直到中国沿海。国家清空了他们的海军码头。他们派出了预算官,工兵,和灯塔守
护者,他们派出了过去陈旧的巡洋舰和战舰。同时他们开始招募商船加入。统计表明,
共有58640艏商船,配备探照灯和速射火炮,由各国开往中国。
中国在微笑地等待着。在她的土地边,沿着她的国界,驻扎了以百万计的欧洲战士。她
动员了五倍于此的民兵等待入侵。这次看来与上次一样。但中国突然感到困惑。因为这
支庞大的队伍并没有开始入侵。她无法理解这一现象。广大的西伯利亚边境一切都归于
平静。她的海岸城镇和村庄甚至没有遭到炮轰。在世界历史上,从来没有过如此强大的
战争舰队的聚集。世界上所有的船队,百万吨的战舰聚集在她的海岸线上,却什么都没
有发生。没有任何尝试。他们想使她离开她的地盘吗?中国笑了。他们以为能够厌倦死
她... 阅读全帖
l****z
发帖数: 29846
19
来自主题: USANews版 - The American Pharisees of Madison
By Marvin Folkertsma
Americans looking for entertainment need only to observe controversies
surrounding the fiscal follies of February, which have metastasized from the
budget proposals of the nation's capital to a dozen or so state capitals.
At the center of the most interesting fracas stands Wisconsin's newly
elected Republican governor, whose position is depicted by his opponents as
comparable to the stance taken by the Bastille's luckless commander in 1789.
More sober heads might rather sear... 阅读全帖
d********w
发帖数: 363
20
来自主题: JobHunting版 - [算法] word ladder problem
amazon好像出过此题,简单的说,就是一个原始字符串,一个目标串,求最少的变换的
路径,要求每次变化后的词都在一个字典中。
有些人说bfs,还是dijkstra算法?
下面是原题
// http://www.cs.duke.edu/csed/newapt/allwordladder.html
A word ladder is a sequence of words in which each word can be transformed
into the next word by changing one letter. For example, the word ladder
below changes 'lot' to 'log'.
lot dot dog log
This is not the shortest word-ladder between 'lot' and 'log' since the
former can be immediately changed to the latter yielding a word ladder of
length two:... 阅读全帖
n********e
发帖数: 41
21
来自主题: JobHunting版 - Leetcode的系统真是弱爆了
楼主 看到 你 isDiffByOne 函数就知道你必然要超时
Leetcode免费给你用 就别挑剔了。凡事要先从自身找问题
你那个测试不是大数据
真正的大数据在这里:
start = "nanny";
end = "aloud";
String[] d = {"ricky","grind","cubic","panic","lover","farce","gofer
","sales","flint","omens","lipid","briny","cloth","anted","slime","oaten","
harsh","touts","stoop","cabal","lazed","elton","skunk","nicer","pesky","
kusch","bused","kinda","tunis","enjoy","aches","prowl","babar","rooms","
burst","slush","pines","urine","pinky","bayed","mania","light","flare","
wares","wom... 阅读全帖
c********i
发帖数: 1489
22
PASSOVER = EXODUS
Passover (Pesach in Hebrew) commemorates the formative experience of the
Jewish people: their transformation from scattered tribes indentured in
Egypt to a nation on the road to redemption.
The Bible relates in the Book of Exodus that after hundreds of years of
slavery, God smote the hardhearted dictator Pharaoh with Ten Plagues until
he finally acceded to the demand relayed by Moses: Let My people go that
they may serve Me! (Exodus 7:16)
As the Israelis hastily prepared for th
G****e
发帖数: 11198
23
来自主题: WaterWorld版 - The Darker Side Of God
The Darker Side Of God
If you ask Christians to describe their quasi-chosen god of worship,
you’ll often hear such descriptors as “wonderful” and “loving.” This
choice of selective designation seems commonplace within the Christian
community. In fact, most churches ignore the Old Testament all together so
that the members feel comfortable propagating this view. Fueled by such
blatant omission, this lengthy chapter will fill the void by offering a look
at the volume of horrendous acts perfo... 阅读全帖
n*********0
发帖数: 925
24
http://www.glorypress.com/devotional/FaithAndLifeOneYearBook.asp?bid=1
绝望的处境
经文: 「有主的一个使者,站在旁边,屋里有光照耀。天使拍彼得的肋旁,拍醒了他,
说,快快起来。那铁链就从他手上脱落下来。」 (徒十二7)
「约在半夜,保罗和西拉,祷告唱诗赞美上帝……忽然地大震动,甚至监牢的
地基都摇动了。监门立刻全开,众囚犯的锁链也都松开了。」(徒十六25 ~26)
这是上帝的方法。上帝的脚步常要等到深夜最黑暗的时候,才渐临近。我们看
见,直到希律要提彼得出来处决的前一夜,天使才来救彼得出监。挂末底改的木架预备
好了以后,才有哈随鲁王睡不着觉的事情发生。
啊,我的魂哪,也许在拯救临到你以前,你还须经过最黑暗的时期;但是不要
怕,上帝必拯救你!上帝也许喜欢让你多等一会儿,但是祂不能忘记祂的誓约,祂必要
实践祂那不可更改的应许。 ──梅尔(F.B.Meyer)
上帝有智慧的策略对付任何困难,上帝有坚定不移的信实对待信靠祂的,上帝
有不变的公义坚持祂的旨意,我... 阅读全帖
G****e
发帖数: 11198
25
来自主题: Belief版 - The Darker Side Of God (转载)
【 以下文字转载自 WaterWorld 讨论区 】
发信人: GoBlue (Wolverines), 信区: WaterWorld
标 题: The Darker Side Of God
发信站: BBS 未名空间站 (Sat Jul 12 13:10:33 2014, 美东)
The Darker Side Of God
If you ask Christians to describe their quasi-chosen god of worship,
you’ll often hear such descriptors as “wonderful” and “loving.” This
choice of selective designation seems commonplace within the Christian
community. In fact, most churches ignore the Old Testament all together so
that the members feel comfortable propagatin... 阅读全帖
c****t
发帖数: 19049
26
来自主题: SciFiction版 - 云图 英文版
THE PACIFIC JOURNAL OF ADAM EWING
Thursday, 7th November—
Beyond the Indian hamlet, upon a forlorn strand, I happened on a trail of
recent footprints.
Through rotting kelp, sea cocoa-nuts & bamboo, the tracks led me to their
maker, a White man,
his trow-zers & Pea-jacket rolled up, sporting a kempt beard & an outsized
Beaver, shoveling
& sifting the cindery sand with a teaspoon so intently that he noticed me
only after I had hailed
him from ten yards away. Thus it was, I made the acquaintance of... 阅读全帖
E*****m
发帖数: 25615
27
来自主题: TrustInJesus版 - question on the book of Isiah 37
37:36 Then the angel of the LORD went forth, and smote in the camp of the
Assyrians a hundred and fourscore and five thousand: and when they arose
early in the morning, behold, they were all dead corpses.
這些人起床後發現自己都死了。
當然,照例沒有任何歷史紀錄。
G*******s
发帖数: 4956
28
来自主题: TrustInJesus版 - on Calvinism, Evil and God's Holiness
Letter from Visitor on Calvinism, Evil and God's Holiness
Today I received an email to my to Monergism.com account from a visitor name
d Shawn. He asked some important questions on on Calvinism, Evil and God's H
oliness. I have reproduced his email in full with my response (with a couple
paragraphs on Job that quote liberally from John Piper)
Dear Mr. Hendryx,
I've been reading your website with interest and find it to be one of the ve
ry best Calvinistic resources I've seen on the net. I am not... 阅读全帖
C****i
发帖数: 1776
29
CHAPTER V
Of Providence
I. God the great Creator of all things doth uphold,[97] direct, dispose, and
govern all creatures, actions, and things,[98] from the greatest even to th
e least,[99] by his most wise and holy providence,[100] according to his inf
allible foreknowledge,[101] and the free and immutable counsel of his own wi
ll,[102] to the praise of the glory of his wisdom, power, justice, goodness,
and mercy.[103]
II. Although, in relation to the foreknowledge and decree of God, the first
... 阅读全帖
C****i
发帖数: 1776
30
CHAPTER XV
Of Repentance unto Life
I. Repentance unto life is an evangelical grace,[292] the doctrine whereof i
s to be preached by every minister of the gospel, as well as that of faith i
n Christ.[293]
II. By it, a sinner, out of the sight and sense not only of the danger, but
also of the filthiness and odiousness of his sins, as contrary to the holy n
ature, and righteous law of God; and upon the apprehension of his mercy in C
hrist to such as are penitent, so grieves for, and hates his sins,... 阅读全帖
C****i
发帖数: 1776
31
来自主题: TrustInJesus版 - 问个问题
所以你认为撒但是有来源的是吧?
这点我认同。
那么撒但的来源是什么呢?我们回到圣经就知道了。
在和合本圣经中,撒但总共出现48次
代上 21:1 撒但起来攻击以色列人,激动大卫数点他们。 伯 1:6 有一天, 神的众子
来侍立在耶和华面前,撒但也来在其中。 伯 1:7 耶和华问撒但说:“你从哪里来?”
撒但回答说:“我从地上走来走去,往返而来。” 伯 1:8 耶和华问撒但说:“你曾用
心察看我的仆人约伯没有?地上再没有人象他完全正直,敬畏 神,远离恶事。” 伯
1:9 撒但回答耶和华说:“约伯敬畏 神,岂是无故呢? 伯 1:12 耶和华对撒但说:“
凡他所有的,都在你手中;只是不可伸手加害于他。”于是撒但从耶和华面前退去。 伯
2:1 又有一天, 神的众子来侍立在耶和华面前,撒但也来在其中。 伯 2:2 耶和华问
撒但说:“你从哪里来?”撒但回答说:“我从地上走来走去,往返而来。” 伯 2:3
耶和华问撒但说:“你曾用心察看我的仆人约伯没有?地上再没有人象他完全正直,敬
畏 神,远离恶事。你虽激动我攻击他,无故地毁灭他;他仍然持守他的纯正。” 伯
2:4 撒但回答耶和华说:“人以皮代皮... 阅读全帖
s*******w
发帖数: 2257
32
来自主题: TrustInJesus版 - 《约伯记》
下面开始第二章的学习:
================================
:1 [hgb] 又 有 一 天 , 神 的 众 子 来 侍 立 在 耶 和 华 面 前 , 撒
但 也 来 在 其 中 。
[kjv] Again there was a day when the sons of God came to present
themselves before the LORD, and Satan came also among them to present
himself before the LORD.
[bbe] And there was a day when the sons of the gods came together
before the Lord, and the Satan came with them.
2:2 [hgb] 耶 和 华 问 撒 但 说 , 你 从 哪 里 来 ? 撒 但 回 答 说 ,
我 从 地 上 走 来 走 去 , 往 返 而 来 。
... 阅读全帖
i**********e
发帖数: 1145
33
来自主题: Programming版 - [算法] word ladder problem (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: dongfeiwww (feifei), 信区: JobHunting
标 题: [算法] word ladder problem
发信站: BBS 未名空间站 (Mon Jan 24 23:59:22 2011, 美东)
amazon好像出过此题,简单的说,就是一个原始字符串,一个目标串,求最少的变换的
路径,要求每次变化后的词都在一个字典中。
有些人说bfs,还是dijkstra算法?
下面是原题
// http://www.cs.duke.edu/csed/newapt/allwordladder.html
A word ladder is a sequence of words in which each word can be transformed
into the next word by changing one letter. For example, the word ladder
below changes 'lot' to 'log'.
lot dot dog log
This is not... 阅读全帖
w********m
发帖数: 1137
A****n
发帖数: 241
35
来自主题: Statistics版 - 如何做sampling
叫 SMOTE
x***t
发帖数: 263
36
来自主题: DataSciences版 - 请教一道面试题
所以我推荐SMOTE或ADASYN,详细参见原paper

发帖数: 1
37
在没有把categorical data 变成 dummy variable的时候,用WEKA 能够生成出具体的
哪一个州。但是WEKA,R studio 产生的结果不同。weka只是double minority class,
保持majority class. 但是R studio 能够产生基本45%,55%的两个classes. 不知道哪
个是对的。
m******r
发帖数: 1033
38
hi, 请问有现成的什么包 什么函数干这个吗? 谢谢。
民科,看不懂文章。
还是我上面那个具体例子,四个地区,东南西北中,请问如何转化成数字呢? 就算按
你说的算距离,比如把东南应该结合在一起,西北应该结合在一起,那也没法变成数字
啊。 当然这是你可以上dummy, 我觉得这只是个权宜之计。 不是通用方法。

体的
class

发帖数: 1
39
“ 至于CATEGORICAL 变量,可以算距离的,不需要处理成DUMMY 变量。然后用最近铃
算法
categorical变量应该不允许单独领出来按照这种最近令算法来吧?整个dataset是有
continouous 和 categorical。
打算用logistic regression, SVM来train model. 想问一下:你在处理mix dataset
的时候,都不需要把categorical变量变成dummy variable吗?
体的
class

发帖数: 1
40
我又仔细看了那个文章,我眼拙,没有找到categorical 通过 VDM 计算出距离后再与
continuous一起来计算,能帮我找找吗?我想看看如何相加的。谢谢!

49
them
E**********e
发帖数: 1736
41
pm你的信箱, 我明天在公司里给你发几个paper。
E**********e
发帖数: 1736
42
他的文章没有谈到具体怎么用 VDM, 他说的是 改版的VDM。 你可以搜索这个吗。 有
一个ppt, 里边有pseudo code。 连续变量,就是欧拉距离, 非连续变量,就是 VDM
。 欧拉距离要scale一下, 然后treat equally。
总的来说,你需要通读几篇相关的文章, 自己写code。 据我所知, 没有现成的code
可以用。

发帖数: 1
43
[email protected]/* */
谢谢!!

发帖数: 1
44
这次好像其他项目组的人用经纬度一类的可以数字化的东西来划分州。。
k******u
发帖数: 3137
45
来自主题: _IrishFootball版 - Football: God strikes Wise dead (zz)
http://media.www.ndsmcobserver.com/media/storage/paper660/news/2008/04/01/Absurder/Football.God.Strikes.Wise.Dead-3294320.shtml
Coach says 'rebuilding,' is smote by Supreme Being as requested
In August, Notre Dame coach Chuck Wise told reporters that "God strike me
dead" if he used the word "rebuilding."
Monday, God delivered on that request.
During a post-practice news conference, Wise updated the media on his plans
for a new headquarters for Banana and Friends, his charity for
developmentally
1 (共1页)