http://microjs.com/#
introduction.js
Jasmine is a behavior-driven development framework for testing JavaScript code. It does not depend on any other JavaScript frameworks. It does not require a DOM. And it has a clean, obvious syntax so that you can easily write tests.
This guide is running against Jasmine version 1.2.0 revision 1337005947 .
中國云?移動互聯(lián)網(wǎng)創(chuàng)新大獎賽
賽題4:難舍難分
1.? 概述
? ? ? ?百度網(wǎng)頁搜索是影響力和覆蓋率最大的網(wǎng)頁搜索工具,每天會有數(shù)億人通過百度網(wǎng)頁搜索提交搜索詞,查看和點擊搜索結(jié)果,找到所求。對搜索詞進行分析和研究,是搜索引擎的基本技術(shù)之一。我們通過它來不斷加深對用戶需求的理解,改進搜索結(jié)果,提高用戶對搜索結(jié)果滿意率。
? ? ? ? 對搜索詞(以下簡稱query)的一個研究方向就是嘗試做搜索詞分類。優(yōu)質(zhì)的搜索詞分類能夠讓我們更清晰地區(qū)分用戶需求,了解流量變化趨勢。分類問題首先必須面向具體應(yīng)用建立合理的分類體系。
? ? ? ? 搜索詞分類涉及到多個技術(shù)領(lǐng)域,如自然語言處理(NLP)、機器學(xué)習(xí)、文本分類等等,是一項難度很高的工作。大體來說,短文本的分類難度較高,它具有表義模糊或有歧義、語法形式不規(guī)范、難提取有效特征等特點。同時,百度網(wǎng)頁query的數(shù)量巨大(數(shù)十億),涉及領(lǐng)域廣,分類的類別數(shù)量多(幾百到幾千),這些特性讓該問題更具有挑戰(zhàn)性。
2.? 數(shù)據(jù)集描述
? ? ? ? 本題目會提供給參賽者兩類文件:標注的查詢詞分類及查詢詞特征數(shù)據(jù)。參賽者基于標注的查詢詞分類及這些查詢詞對應(yīng)的特征數(shù)據(jù)設(shè)計算法、訓(xùn)練并檢測模型,并利用訓(xùn)練好的算法對待分類查詢詞進行分類,并給出分類結(jié)果。
? ? ? ?本題目的數(shù)據(jù)分為兩個階段公布。第一階段公布的數(shù)據(jù)用于初賽階段,數(shù)據(jù)內(nèi)容介紹如下。第二階段將會提供新的待分類查詢詞及特征數(shù)據(jù),數(shù)據(jù)含有更多噪音且特征空間變大。
2.1.? 標注的查詢詞類別
? ? ? ? 初賽階段公布的用于模型訓(xùn)練和檢測的標注查詢詞包含480個分類,每類約200條查詢詞。每個查詢詞占一行,包括三個字段即query_id, query明文和類別標號,每項字段以制表符(\t)分隔開,每行以\n結(jié)尾。需要注意的是每個類別的含義并未公布,但從每個類別所含查詢詞可以了解其類別含義。下面兩行為查詢詞類別文件中的兩行,表明“八月桂”這個查詢詞的id為22,所屬類別為185;而“百葉窗”這個查詢詞的id為23,所屬類別為34。表1為查詢詞類別文件中各個字段含義介紹。
?
22???? 八月桂???? 185
23???? 百葉窗???? 34
?
表 1 查詢詞類別文件中各個字段的含義
字段
格式
含義和取值范圍
? query_id
? unsigned int32
? query的編號,取值范圍為0-10,000,000
? query明文
? 字符串
? query的明文,可用于了解查詢詞內(nèi)容
? class_id
? unsigned int32
? 分類類別標號,0-479
2.2.? 查詢詞特征數(shù)據(jù)
? ? ? ? 查詢詞特征數(shù)據(jù)分為兩類:標注查詢詞特征數(shù)據(jù)和待分類查詢詞特征數(shù)據(jù),分別位于不同的文件中,但他們的文件格式相同,只是標注查詢詞特征數(shù)據(jù)與標注查詢詞類別相結(jié)合用于模型訓(xùn)練,而待分類查詢詞用于題目測試。參賽者所提交的算法將對待分類查詢詞的特征數(shù)據(jù)進行處理后給出待分類查詢詞的分類。
? ? ? ? 每一個查詢詞的特征數(shù)據(jù)為一行,包括的字段有query_id, 特征向量長度,每一個特征的特征id和特征權(quán)重。每行一個query,每項字段以制表符(\t)分隔開,每行以\n結(jié)尾。即:
? ? ? ? query_id \t size \t feature_id_1? \t feature_weight_1 \t? feature_id_2 \t feature_weight_2 \t ……
? ? ? ? 如下例所示查詢詞id為0,含有22個特征,第一個特征的id為7797,特征權(quán)重值為4.19117,后續(xù)特征id和特征屬性依次類推。關(guān)于特征數(shù)據(jù)文件中每行每個字段含義見表2。
? ? ? ?0? 22????? 77597?? 4.19117 ?57907?? 2.52463 102261? 2.7777? 100179? 2.28435 100704? 4.23765 2409??? 2.80831 25442?? 2.76276 138662????? 11.8289 150839? 9.51083 87205?? 6.54339 137685? 4.13053 136771? 8.02004 79270?? 6.00066 80632?? 8.31261 51236?? 10.5543 106239????? 3.78187 102222? 6.13974 16484?? 4.27566 150014? 1.47338 69932?? 6.45025 95094?? 4.80892 113717? 13.1069
表 2 特征數(shù)據(jù)文件中各字段含義
字段名
格式
字段含義
query_id
unsigned int32
查詢詞的編號,全局唯一
size
unsigned int32
表示一個查詢詞有size個 <feature_id, feature_weight>的pair數(shù)據(jù)
feature_id
unsigned int32
feature_id是特征的標號,每個特征標號的含義未公布,可以大致認為提取的特征是中文詞語。特征空間是153564維度,也就是意味著feature_id的標號是在0到153563之間。
feature_weight
float
對應(yīng)于特征屬性的特征權(quán)重,即該特征對query的重要程度,為浮點數(shù)
?
?
? ? ? ? 需要注意的是,每個查詢詞的特征數(shù)目不等,平均約在50個左右。標注查詢詞的特征數(shù)據(jù)包含約15萬個查詢詞,而待分類查詢詞特征數(shù)據(jù)包含1000萬個查詢詞,在這些文件中查詢詞文本已省略。
3.? 任務(wù)描述
? ? ? ? 本題目從百度query分類體系里,選出五百個預(yù)先定義好的分類,提供訓(xùn)練樣本和測試樣本,以及所有樣本的特征數(shù)據(jù),主要是考察參賽者面對海量真實的中文query數(shù)據(jù)以及較大類別數(shù)的分類體系,如何設(shè)計算法,提高短文本的分類準確率。
? ? ? ? 參賽者可以利用預(yù)先標注好分類的query數(shù)據(jù)進行模型訓(xùn)練和效果自評。最終評估待分類查詢詞特征數(shù)據(jù)統(tǒng)一進行。參賽者只需要提供分好類的結(jié)果文件并調(diào)用相應(yīng)的命令,則會得到結(jié)果文件分類的評估結(jié)果。
3.1.? 輸入
? ? ? ? 參賽者進行模型訓(xùn)練時可以使用標注的查詢詞類別和標注的查詢詞特征數(shù)據(jù)兩個文件。參賽者需要應(yīng)用所得到的算法和模型對待分類查詢詞特征數(shù)據(jù)文件進行處理后給出待分類查詢詞的類別。
? ? ? ? 在競賽所提供的Hadoop平臺的/share/data/qc目錄下包括本題目所需的數(shù)據(jù),名為query-to-classify-features.txt是待分類的查詢詞特征數(shù)據(jù)文件,包括約1000萬個待分類的查詢詞。名為query-classified.txt是標注的查詢詞類別文件,名為query-classified-features.txt是標注的查詢詞特征數(shù)據(jù)文件。
3.2.? 輸出
? ? ? ? 參賽者給出待分類查詢詞的類別。其格式為每行一個查詢詞,每行包括兩個字段,第一個字段為查詢詞的query_id,第二個字段為該查詢詞所屬class_id,如下所示:
? ? ? ? query_id \t class_id
3.3.? 約束條件
? ? ? ? 參賽者通過參賽網(wǎng)站進入計算平臺 http://cc-ws.duapp.com (參賽網(wǎng)站有相關(guān)指示),登錄后可以操作hadoop命令。本題目所有的數(shù)據(jù)放置在HDFS的共享目錄:/share/data/qc下。這個目錄下的文件為只讀文件,參賽者在計算平臺所提供的Hadoop環(huán)境上通過MapReduce編程對數(shù)據(jù)進行處理。
? ? ? ? 計算平臺也提供了在線評估答案的命令,其使用方式為:
? ? ? ? evaluate? - pr|qc result_file
??????? 其中evaluate為命令名,"-pr|qc"為評估的題目名稱。對于本題目選擇qc參數(shù),result_file為參賽者所輸出的最終文件在參賽者的工作目錄中的路徑及文件名。如果結(jié)果文件位于HDFS系統(tǒng)中,參賽者可以首先使用“hadoop fs –get”命令拷貝到其工作目錄中,然后調(diào)用evaluate命令。evaluate命令比較參賽者所提供的最終結(jié)果文件中的分類結(jié)果和本題目標注的分類結(jié)果,并輸出此次分類的正確率。
??????? 參賽者必須提供相應(yīng)的源代碼,才能參與評獎。相關(guān)程序的知識產(chǎn)權(quán)歸參賽選手所有(不得侵犯他人權(quán)益),大賽組委會取得的相關(guān)資料僅用于評獎使用。
4.? 評價標準
? ? ? ? 在1000萬個待分類查詢詞里,我們會抽樣一部分作為評估對象進行統(tǒng)計。抽取哪些樣本是不公開的,但是會均勻涵蓋480個類別。我們以正確率作為分類效果的評估指標。設(shè)總共有K個類,對于第i個類有個用于評估的查詢詞,參賽者的方法正確給出?個查詢詞的類別為i。則第i個類的分類正確率為。分類正確率R計為所有這些類別的分類正確率的平均值:
? ? ? ? 參賽者給出所有待分類查詢詞的分類后,他可以調(diào)用“evaluate”命令來計算分類正確率。每次調(diào)用都會立刻給出分類正確率,用于評估其算法的優(yōu)劣。同時,在規(guī)定的時間調(diào)用“evaluate”命令所給出的分類正確率將會記錄在案以作為成績評定的標準。
Effing Package Management.
Preface
Package maintainers work hard and take a lot of shit. You can't please
everyone. So, if you're a maintainer: Thanks for maintaining packages!What is fpm?
It helps you build packages quickly (Packages like RPM and DEB formats).
Here is a presentation I gave on fpm at BayLISA: http://goo.gl/sWs3Z (I
included speaker notes you can read, too)At BayLISA in April 2011, I gave a talk about fpm. At the end, I asked "What
can I package for you?"Someone asked for memcached.
Google for 'memcached', download the source, unpack, ./configure, make, make
install, fpm, deploy.In 60 seconds, starting from nothing, I had both an RPM and a .DEB of memcached
ready to deploy, and I didn't need to know how to use rpmbuild, rpm specfiles,
dh_make, debian control files, etc.Backstory
Sometimes packaging is done wrong (because you can't do it right for all
situations), but small tweaks can fix it.And sometimes, there isn't a package available for the tool you need.
And sometimes if you ask "How do I get python 3 on CentOS 5?" some unhelpful
trolls will tell you to "Use another distro"Further, a job switches have me flipping between Ubuntu and CentOS. These use
two totally different package systems with completely different packaging
policies and support tools. Learning both was painful and confusing. I want to
save myself (and you) that pain in the future.It should be easy to say "here's my install dir and here's some dependencies;
please make a package"The Solution - FPM
I want a simple way to create packages without all the bullshit. In my own
infrastructure, I have no interest in Debian policy and RedHat packaging
guidelines - I have interest in my group's own style culture and have a very strong
interest in getting work done.(This is not to say that you can't create packages with FPM that obey Debian or
RedHat policies, you can and should if that is what you desire)The goal of FPM is to be able to easily build platform-native packages.
- Creating packages easily (deb, rpm, etc)
- Tweaking existing packages (removing files, changing metadata/dependencies)
- Stripping pre/post/maintainer scripts from packages
Get with the download
You can install fpm with gem:
gem install fpm
Running it:
fpm -s TYPE -t TYPE ...
Things that are in the works or should work:
Sources:
- gem (even autodownloaded for you)
- python modules (autodownload for you)
- pear (also downloads for you)
- directories
- rpm
- deb
- node packages (npm)
Targets:
- deb
- rpm
- solaris
- tar
- directories
Need Help or Want to Contribute?
All contributions are welcome: ideas, patches, documentation, bug reports,
complaints, and even something you drew up on a napkin.It is more important to me that you are able to contribute and get help if you
need it..That said, some basic guidelines, which you are free to ignore :)
- Have a problem you want fpm to solve for you? You can email the
mailing list , or
join the IRC channel #fpm on irc.freenode.org, or email me personally
( jls@semicomplete.com )- Have an idea or a feature request? File a ticket on
github , or email the
mailing list , or email
me personally ( jls@semicomplete.com ) if that is more comfortable.- If you think you found a bug, it probably is a bug. File it on
jira or send details to
the mailing list .- If you want to send patches, best way is to fork this repo and send me a pull
request. If you don't know git, I also accept diff(1) formatted patches -
whatever is most comfortable for you.- Want to lurk about and see what others are doing? IRC (#fpm on
irc.freenode.org) is a good place for this as is the
mailing listMore Documentation
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
