2012年11月26日月曜日

BibtexのAuthorをそのまま出したい

今書いている論文で,日本の情報通信白書をReferしようとしたんだけど, 英語で書くと著者がMinistry of Internal Affairs and Communications, Japanとなる. 普通に書くと
@Book{internal12:_white_paper_infor_commun_japan,
  author =       {Ministry of Internal Affairs and Communications, Japan},
  title =        {WHITE PAPER Information and Communications in Japan},
  publisher =    {Japanese Government},
  year =         2012
}
これをBibtexのauthorに書いてコンパイルすると, 「M. of Internal Affairs and J.Communications」 となってしまう. で,書いたままで出したければどうすればいいかというと,
@Book{internal12:_white_paper_infor_commun_japan,
  author =       {{Ministry of Internal Affairs and Communications, Japan}},
  title =        {WHITE PAPER Information and Communications in Japan},
  publisher =    {Japanese Government},
  year =         2012
}
と{{}}で囲めばいいらしい. Bibtexで書くとき,名前を省略されたくなければ {{と}}で囲めばいいというTIPSでした. これって常識だった?

2012年11月25日日曜日

Androidプログラミング事始め

Nexus7を買ったので,Androidのプログラミングをしてみたくなったのでやってみた. まずは,SDKのダウンロード. http://developer.android.com/sdk/index.htmlでSDKをゲット. Windows用の32bit版のzipをダウンロードして解凍. 中に /eclipse /sdk があるので,このeclipseを使うととりあえず楽ちん. eclipseを立ち上げるとSDKの場所を聞かれるので,それを指定. その後,新規作成でとりあえずAndroidProjectを作成. まずはHelloWorld. この辺は適当にWEBページを探す. 普通にやろうとすると,なぞのエラーで立ち上がらない.
Starting emulator for AVD 'AVD_for_Nexus_7'
emulator: device fd:580
HAX is working and emulator runs in fast virt mode
Failed to allocate memory: 8
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
とかエラーメッセージが出てくる. 実行Windowのターゲット⇒マネージャで Android仮装デバイスマネージャーを立ち上げて, 使うAVDを指定.
指定されていなかったら,DeviceDefinitionsでNexus7を選択すればいいや. で,編集でAndroid仮想デバイスの編集Windowが出るので, MenoryOptionを512にする. デフォルトが1024とかだけど,512にする. 少ないほうのがいいのかよ!とか突っ込みたくなるけど,512にするとうまく起動する.
Androidの立ち上がりが遅い. Androidのエミュレータが遅いのはデフォらしいけど,それにしても遅すぎる. http://tatete.blogspot.jp/2012/03/android.html で,Snapshotというのを試してみるけど,早くならない. 正解は, sdk/extras/intel/Hardware_Accelerated_Execution_Manager/IntelHaxm.exe を実行して,HAXというのをインストールして, sdk/tools/lib/SDK Manager.exe を sdk/ にコピーしてから実行して,
Android 2.3.3(API10)の -Intel Atom x86 System Image Extrasの -Intel x86 Emulator Accelerator(HAXM) をインストールする.
最後に,またAVD仮想デバイスの設定を立ち上げて, ターゲットを Intel Atom x86 System Image(Intel corporation) - API Level 10 - にすると多少早くなるようだ.
ただし,Androidのバージョンとしては2.3.3しか動かないみたいだけど. これだけやって,ようやくHelloWorldがまっとうに表示された.
先が思いやられるなあ.

2012年11月2日金曜日

cytoscapeでネットワーク

ネットワーク描画ツールとして有名なものにcytoscapeがある. 簡単にネットワークを描画できるので重宝しているが, 巨大なネットワークを描画するにはメモリが必要. でもデフォルトでは800Mくらいしかメモリを確保せずに起動するので,設定を変更したい. cytoscape2.8.3をWindows7で動かす場合には,
path_to_programfiles/Cytoscape_v2.8.3/Cytoscape.vmoptions
を変更すれば良い. たとえば,最大メモリ4G使いたいのであれば,
-Xms10m
-Xmx4G
-Xss10m
-Dswing.aatext=true
-Dawt.useSystemAAFontSettings=lcd
と直して起動すれば,最大で4Gほどのメモリを確保して起動してくれる. 便利.

2012年7月11日水曜日

Ruby on Railsをさくらレンタルサーバにインストール・・・ができないことが判明した件

最初に結論から書くと,さくらのレンタルサーバにrailsをインストールするのは難しいようだ.
数年前まではいけたっぽいけど,今は無理みたい.





学会ページ作成のために,さくらレンタルサーバにRailsを導入して,Railsの勉強をしてみる.
基本的な手順は以下の通り.

  1. RubyGemsをインストール
  2. gemを使ってrailsをインストール

ただし,レンタルサーバなのでローカルに入れなければ行けない.
とりあえず,インストール場所は
~/local/bin

~/local/lib

以下にしてみる.
というわけで,以下手順.

RubyGemsをインストール

http://rubyforge.org/frs/?group_id=126
で最新版を探してダウンロード
$ cd
$ mkdir src
$ cd src
$ wget http://rubyforge.org/frs/download.php/76073/rubygems-1.8.24.tgz

インストールする場所を作成
$ mkdir local

$ tar zxvf rubygems-1.8.24.tgz
$ ruby setup.rb --prefix=$HOME/local/
RubyGems 1.8.24 installed



== 1.8.24 / 2012-04-27



* 1 bug fix:



  * Install the .pem files properly. Fixes #320

  * Remove OpenSSL dependency from the http code path





------------------------------------------------------------------------------



RubyGems installed the following executables:

        /home/name/local/bin/gem18

$ cd
$ emacs .cshrc
...

set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $HOME/\

bin $HOME/local/bin)

setenv RUBYLIB $HOME/local/lib

setenv GEM_HOME $HOME/local/lib/ruby/gem

$ sources .cshrc
$ gem --version
1.8.24

Railsをインストール

$ gem18 install rails --include-dependencies
chown/chgrp: Operation not permitted
エラーだ.
解決策はこちら
http://playet.jugem.jp/?eid=56

$ setenv RB_USER_INSTALL true
$ gem18 install rails --include-dependencies

成功したように見えるのに,なぜかrailsが入っていない.
おや?
Pathに
$HOME/local/lib/ruby/gem/bin
が必要だった.
.cshrcに追加
...

set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $HOME/bin $HOME/local/bin $HOME/local/lib/ruby/gem/bin)

$ source .cshrc
$ rails -v
Rails 3.2.6
お~.できたできた.

それじゃ,早速アプリケーションを作成してみましょうかね.

$ cd
$mkdir Rails
$ rails new HelloWolrd
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby18 extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/ruby18
        --with-sqlite3-dir
        --without-sqlite3-dir
        --with-sqlite3-include
        --without-sqlite3-include=${sqlite3-dir}/include
        --with-sqlite3-lib
        --without-sqlite3-lib=${sqlite3-dir}/lib
        --enable-local
        --disable-local


Gem files will remain installed in /home/name/local/lib/ruby/gem/gems/sqlite3-1.3.6 for inspection.
Results logged to /home/name/local/lib/ruby/gem/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
An error occured while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
おや?
続けていくと,次々怒られるので,順番にgemでインストールしていって見る.
$ gem18 install coffee-script
$ gem18 install coffee-rails
$ gem18 install sass
$ gem18 install sass-rails
$ gem18 install sqlite3

ここまで順調だったが,ここで問題発生.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.

だけど,さくらに入っているのはsqlite3 ver 3.7.9 20
とりあえず古いバージョンをインストールしてみる.
$ gem install sqlite3-ruby --version=1.2.4
$ rails new HelloWorld
...
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
        /usr/local/bin/ruby18 extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.


Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/ruby18
        --with-sqlite3-dir
        --without-sqlite3-dir
        --with-sqlite3-include
        --without-sqlite3-include=${sqlite3-dir}/include
        --with-sqlite3-lib
        --without-sqlite3-lib=${sqlite3-dir}/lib
        --enable-local
        --disable-local


Gem files will remain installed in /home/name/local/lib/ruby/gem/gems/sqlite3-1.3.6 for inspection.
Results logged to /home/name/local/lib/ruby/gem/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
An error occured while installing sqlite3 (1.3.6), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
調べてみると,結構インストールのやり方が出てくるけど,皆情報が古い.
ここ1年で検索してみると,
http://okwave.jp/qa/q5323794.html
http://d.hatena.ne.jp/ar_tama/20120212/1329027876
を見る限り無理っぽい
なんてこったい.

2012年7月10日火曜日

Hadoop再インストール

Hadoopのインストールにチャレンジ中だけど,どうも通常のHadoopをインストールするよりも,CDH(Cloudera's Distribution including Apache Hadoop)をインストールする方が色々良さそうなので,インストールを試みた.
ところが,一度通常のHadoopをインストールしていると,どうも動きがおかしいということが分かったので,いっそOSから再インストール.


参考URL
http://www.ne.jp/asahi/hishidama/home/tech/apache/hadoop/hadoopCDH3.html

まずは,yumでCDHがダウンロードできるようにリポジトリを更新.
# cd /etc/yum.repos.d/
# wget http://archive.cloudera.com/redhat/cdh/cloudera-cdh3.repo
# yum update yum

次に,Hadoopをインストール.
# yum install hadoop-0.20
実行してみたら,エラー.何かと思ったら,
JAVAをインストールしていなかったw

素直にsun.javaからインストール.
rpmなら何も考えずにインストール可能.

次に実行したら,今度はホスト名が見つからないと怒られたので,
/etc/host
ホスト名を追加

最後に,
Hadoopの擬似分散モード用設定ファイル集のダウンロード
# yum -y install hadoop-0.20-conf-pseudo

# alternatives --display hadoop-0.20-conf
# alternatives --config hadoop-0.20-conf
で,
conf.pseudoを選択

最後に無事動いたかどうかを確認.
$ hadoop jar /usr/lib/hadoop/hadoop-*-examples.jar pi 4 2000
無事実行完了
ちなみに,実行中は
で,namenode情報
http://localhost:50030
で,MapReduce情報
を見ることが可能.
ちょっと重たいものを走らせてMapReduce情報を見ると,ちゃんと進行状況が分かって面白い.
通常版はインストールにめちゃめちゃ手間取ったけど,CDH版は一瞬でインストール完了.
さて,これから色々遊んでみよう.



2012年7月3日火曜日

HADOOPインストールトライ中

あまりにもTwitterデータの数が多すぎて,単体のマシンでは処理が難しくなってきたので,HADOOPを使ってみることにした.
 まずは,スタンドアロンな環境から.
基本的には,Hadoop徹底入門を参考にして入れてみる. 

  • OSはCentOS6.2
  • Hadoopのバージョンは0.20.205

0.20系が1.0につながるものらしいので,まあ,これでいいだろうと.

本の通りにインストール作業をすれば,基本的には大丈夫.
ただ,一点だけはまったのが, start-dfs.sh の実行.
普通の設定で実行しようとすると
Warning: $HADOOP_HOME is deprecated
と表示されうまく起動しない. そこで,
hadoop-env.sh
に,
export HADOOP_HOME_WARN_SUPPRESS="TRUE"
を追加.
これで,無事start-dfs.shが実行された. まだMapReduceにもたどり着いていないけど.

2012年6月6日水曜日

ICWSM12・初日メモ


アイルランドで6月5~7日の日程で行われているICWSM12に参加しているので,
聴講メモを貼り付けておきます.

6/5発表分

Distributional Footprints of Deceptive Product Reviews
Customer's review 
5と評価する人もいれば,1を評価する人もいる
1-5の評価分布から,ステマを探す

National vs Distorted(自然?ゆがんでる?)
Find from distribution

SingleReviewかMultiReviewかで行動が違う
Singleだと1か5が多い
Multiは4-5が多い
S-Shape vs J-Shape(Single)

Characterization of rating distribution
D sorted by #
4,2が高いものと4,5が高いものが多い
MultiTimeとSingleTimeで形が全然違う
51・・と15・・が多い

Detection strategies to identify deceptive business entities
SingleReviewer vs MultiReviewer
positive/negative
Temporal boost in ratingの発見

Novel evaluation methodologies
Pseudo-Gold Standard Data

72~75%の判別率
Baselineが40%程度

Privacy in Interaction: Exploring Disclosure and Social Capital in Facebook
Presentation of Self in Everyday Life.
いろいろなクラスタが本人を中心にネットワークを形成しているはず
Social Capital

Access to emotional and substantive support often from strong ties.
Face book user variables
Signals of Relational Investment

Responding to friends' question because,
-Create an expectation about reciprocal behavior
-Perform a social grooming function
-Potentially train the news feed
-Comments on friends update and wall post are seen by the friends' network

Friendの割合が高くなるほど,FriendsOnlyが増えてくる
Bonding SC:Benefits of focused inclusive interaction
Bridging SC:Costs of highly targetting disclosing

Don’t Disturb My Circles! Boundary Preservation Is at the Center of Location-Sharing Concerns
What is the motivation of Boundary regulation

Online Boundary Regulation
preserve offline relation ship

Friendに対してはPrivacyを考える
Familyは考えない
Strangerに対しても考えない(日本とは違うなあ)

Boundary preservation concern = BPC

Facebook and Privacy: The Balancing Act of Personality, Gender, and Relationship Currency

sentiment的に友人と自分には相関がある
disclose & conceal what is considered private and public in Facebook
Count number of disclosed & concealed from facebook properties

Item Response Theory(IRT)

P_IJ= 1/(1+exp(-a_i(t_j-B_i)))

1. Smart Privacy Mob
About privacy, Westine has divided people in
 1.privacy fundamentalists
 2.pragmatic majority
 3.marginally concerned

2. Who are they?
Those who share more sensitive info are
-open to new experience ------important
-self monitoring
-male --------------------------important
-more active 
-younger

3. What's sensitive
position, employer
residence, hometown not sensitive in circle.

The Livehoods Project: Utilizing Social Media to Understand the Dynamics of a City
neighborhoods

Two perspectives
Politically constructed 政治的に作られた構造か
Socially constructed 社会的に作られた構造か
Collective Cognitive Map

どこでTweetしたかでユーザをグループ分け
そこから,土地のグループ分け.
Tweetにも応用可能か.

場所の類似性(Jaccard係数)

How to evaluate
実際にピッツバーグの人に聞いてみた

Who Does What on the Web: A Large-Scale Study of Browsing Behavior

Nielsen MegaPanel
265000 individuals in US
user data, log of anonymized complete browsing activity from 2009/6-2010/5

Younger and more educated => more use web, more active
色々調べているけど・・・

education が大きな効果を持つ

Evolution of Experts in Question Answering Communities

Expert Influence best answer selection
Ordinary users get intimated by expert
Experts avoid other experts
Experts evolve with differente patterns
These experes can be found with satisfactory performance within 20 weeks

Temporal Motifs Reveal the Dynamics of Editor Interactions in Wikipedia
Motifを使ってWikipediaの編集を分析
編集合戦中とかMotifから判別可能

Modeling Spread of Disease from Social Interactions Best Paper Candidate!

SVMでインフルエンザであるTweetかどうかを判断

Modeling Destructive Group Dynamics in On-line Gaming Communities

WoWを対象にグループの生成と解散を分析
ギルドの歴史から分析可能
Charactor&Guildの二部ネットワーク

Guild抜けは感染する
Quitting Eventを予測可能か?
Quitting Eventが起きないことは90%近い予測
Quitting Eventが起きる可能性は30%程度

ソーシャルネットワークとして調べると面白い
GroupDynamicsが直接見えるデータというのは貴重だ.