転職の思考法を読んだ感想

転職の思考法

感想

上司を見て働くか、マーケットを見て働くか

たしかに。前職はいわゆる日本の古い大企業だったので、上司や人事をみて仕事している人がいたように思う。そして、彼らはスキルないなっと思った。

転職できる人はマーケットを見ている。自分が顧客にどういった価値を提供できるかを考えていると思う。 また価値のあるスキルや経験を積むことを意識している。 だから印鑑の角度とかどうでもいいわけです。 (上司の印鑑の方に少し傾けて押す。お辞儀しているみたいに。真剣にしている人がいるんです。不思議)

20代は専門性、30代は経験をとれ。

専門職でプレーヤーだと30代でもスキルで良いような気がするが、多くのポジションでは合っているかなと。 ただし、20代でスキルをある程度身につけた人は30代では経験も大事にしましょうという感じかな。 私は機械学習エンジニアでチームマネジメントをしているので、専門性は大事。他社でアピールするときは実績も話せたほうがいいと思う。正直、私より専門性の高い人は多くいるので、他社が実現したいと思っているプロジェクトに近いことを成功させた経験とかが評価されそう。

面接で聞くべき質問

  1. 「どんな人物を求めていて、どんな活躍を期待しているのか?」
  2. 「今いちばん社内で活躍し、評価されている人はどんな人物か? なざ活躍しているのか?」
  3. 「自分と同じように中途で入った人物で、今活躍している人はどんな部署を経て、どんな業務を担当しているのか?」

なるほど。逆に聞かれる立場として、これらに答えられるのか? 1は答えられる。2と3は答えられると思うが、ケースが少ない・狭い気がする。 この辺は誰が評価されているのかが分からないことの弊害かな。うむ。

いいベンチャーを見極める三つのポイント ・競合はどこか? そして、競合「も」伸びているか? ・現場のメンバーは優秀か? ベンチャーの経営陣は優秀であるのが当たり前だが、他も優秀か? ・同業他社からの評判は悪くないか?

もうすでにベンチャーではないけれど、こういう視点で今の会社を見てみたほうがいい。 弊社に応募してくれる人たちはちゃんと見ているだろうし、自分のマーケットバリューを上げていくためにも常に確認したほうがよい。

現場のメンバーの優秀さを見よ。

まぁそうだよね。

転職の最後には『やはり自分がいないと仕事が回らないのでは』と不安になるものだ。だがな、絶対に回る。会社とはそういうものだ。

はい。勘違いしないように気をつけよう。自分がいなくても会社は回ります。

・to do(コト)に重きをおく人間 ・being(状態)に重きをおく人間

たしかに! そうだ!! と思う。これはすごく納得のいく分け方。なんとなくモヤモヤと思っていたけどスッキリした。 自分はbeingに重きをおいていると思う。なかなかちゃんと説明できなかった。 前職では、新人芸の強要があることや、それを無くすことが出来なかったことが原因で退職したから。現職でも周りが楽しいと感じる環境を作りたいし、周りも仕事が楽しいと思っている状態で働きたい。

Work Rules!を読んだ感想

Work Rules!

感想

職場を変える10ステップ

自分のチームでもすぐに導入したい。導入済みのものもあるけど、もっと大胆に楽しくできるように工夫したい。

フィードバック

フィードバックの仕方も色々と工夫されている。 自分の職場も360度評価を取り入れており、半年に一回フィードバックする機会があるけど、もっと回数を増やす、数を増やすために仕組みが必要だと思う。

Google Formを使って簡単にフィードバックを貯める、取り出すことができるようにしておこうと思う。

文化が戦略を食う

確かにその通りだなと思う。戦略を打ち立ててもそれが文化と合わないんじゃ進まない。

今の職場のいいところもあるけど、変えたいところも多い。まずは文化や雰囲気を変えたい。さぁどうするか。

リファラル採用

Googleリファラル採用が多いらしい。「誰か紹介して」となったときに、頭に浮かぶのは比較的親しい数人程度。やっぱり数に限りがある。

そうではなくSNSや大学同期など少しでも繋がりのある人を全員リストに上げてから、紹介できるかどうかを考える。

読んだ本の感想

心を整える

感想

  • なにか大きな学びがあったわけではないけど、読み物として面白かった。
  • 一つ自分も実践しようと思ったのが、一人温泉。インドアでネクラな性格なんだが、結婚したりチームリーダーしたりとなかなか一人でぼーっとする時間を取れていないので、温泉にでも行ってぼーっとするのも良さそう。

ソフトスキル

感想

  • 最近、学びが少ない・生産性が下がったと感じることが多々あったので久しぶりに読み返した。
  • 後半の金融や不動産、筋トレの章は読み飛ばし。もっといい本があると思うし、今自分が求めているものではない。
  • 生産性を上げるために「何か1つ取り組むものを決めて25分間集中して取り組む」というのを実践してみた。なかなか良いと思う。もちろん、その間はメールやスラック、SNSを一切見ないし、他のタスクを思い出してしたくなっても無視する。最近、チームマネジメントやその他の業務が増えて気が散って開発に集中できていなかったが、この方法を実践すると開発に集中でき生産性が上がったと思う。当面続けるつもり。
  • 「ブログを書こう」とあったので久しぶりに記事を書いている。
  • 時間の使い方の見直しをしてみた。あまりテレビを見ない(妻と過ごす週末の夜くらい)。どこが無駄だろうな~っと振り返ると、最近電車の中でtwitterを見る習慣がついてしまっている。(同僚とその彼女のやりとりが面白いとか、面白い論文やブログが紹介されていたり)。有益なこともあるけど、本や論文を読む量が減ったのは確かなので今日から電車では本に集中することにしている。
  • ハードワークの重要性を再認識した。もちろん人に勧めることはしないが自分の目標を達成するためにはハードワークは不可欠かなと。前職のメガバンだと、目に見えてハードワーク(長時間労働?)している人がいたし、博士課程の習慣のまま働いていたこともあって、自分もそこそこハードワーカーだった。最近、ちょっと息抜き気味なのでもう一度頑張ろうと思う。

DockerでFlaskとRedisを動かす

書くこと

  • Docker公式のtutorialに従う。
  • シンプルなFlask appをDockerで動かす。
  • FlaskからRedisに接続する。
  • docker-composeを使う。

フォルダの構成

├── Dockerfile
├── app.py
├── docker-compose.yml
└── requirements.txt

app.py

from flask import Flask
from redis import Redis

app = Flask(__name__)
redis = Redis(host='redis', port=6379)


@app.route('/')
def hello():
    count = redis.incr('hits')
    return 'Hello from Docker! I have been seen {} times.\n'.format(count)


if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)

requirements.txt

Flask==0.12.2
redis==2.10.6

Dockerfile

FROM python:3.6.2
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
CMD ["python", "app.py"]

docker-compose.yml

version: '3'
services:
  web:
    build: ./
    ports:
     - "5000:5000"
    volumes:
     - .:/code
  redis:
    image: "redis"

動作確認

サーバーの起動

docker-compose up

サイトへアクセス

  • IPの確認
$ docker-machine ip
192.168.99.100

動作

  • アクセスするたびにカウントアップされる。
    • "Hello from Docker! I have been seen 5 times."

論文メモ Abstractive Text Summarization using Sequence-to-sequence RNNs and Beyond

Ramesh Nallapati et al 2016

autoscale: true slidenumbers: true

Notes about

“Abstractive TextSummarization using Sequence-to-sequence RNNs and Beyond”


Introduction

Authors

  • apply the attentional encoder-decoder RNN to text summarization.
    • The model is developed for machine translation.
  • propose the novel models and show that they provide additional improvement in performance.
    • The models use additional linguistic features such as parts-of-speech and so on.

Text summarization

  • Abstractive text summarization is the task of generating a headline or short summary consisting of a few sentences that captures the salient ideas of an article or a passage.

The difficulties of this kind of problems

  • In summarization, original documents are compressed in lossy manner such that key concepts are preserved.

Models: RNN language model (preparation)

  • (Extraction of embedding vector) $$\bar{y}_t = E y_{t-1}$$
  • (Calculation of hidden layer) $$h_t = \tanh \left( W^{(l)} [\bar{y}_t, h_{t-1}]^t + b^{(l)} \right)$$
  • (Calculation of output layrer) $$o_t = W^{(o)} h_t + b^{(o)}$$
  • (Calculation of probability) $$p_t = \text{softmax}(o_t)$$
  • (Extraction of probability) $$P(y_t| Y_{<t}) = p_t \cdot y_t$$

Models: bidirectional RNN language model (preparation)

  • (Forward calculation of hidden layer)
    • $$\overrightarrow{h}_t = \tanh \left( \overrightarrow{W}^{(l)} [\bar{y}_t, \overrightarrow{h}_{t-1}]^t + \overrightarrow{b}^{(l)} \right)$$
  • (Backward calculation of hidden layer)
    • $$\overleftarrow{h}_t = \tanh \left( \overleftarrow{W}^{(l)} [\bar{y}_t, \overleftarrow{h}_{t+1}]^t + \overleftarrow{b}^{(l)} \right)$$
  • (Calculation of output layrer)
    • $$o_t = W^{(o)} [\overrightarrow{h}_t, \overleftarrow{h}_t]^t + b^{(o)}$$

Models: encoder-decoder RNN language model (preparation)

  • (Input) $$X=(x_i)_ {i=1}^I$$
  • (Output) $$Y=(y_j)_ {j=0}^{J+1}$$ where $$y_0=BOS$$ and $$y_{J+1}=EOS$$
  • (Encoder) $$z=\Lambda(X)$$
  • (Hidden layer) $$h_t = \phi(h_{j-1}, y_{j-1})$$ where $$h_0 = z$$
  • (Probability)
    • $$P(Y|X) = \prod_{j=1}^{J+1} P(y_j|Y_{<j}, X)$$
    • $$P(y_j|Y_{<j}, X) = \psi(h_j, y_j)$$

Models: Soft attention mechanism (preparation)

  • (Encoder) $$h_i^{(s)} = \phi^{(s)}(x_i, h_{i-1}^{(s)})$$
  • (Decoder) $$h_j^{(t)} = \phi^{(t)}(y_j, h_{j-1}^{(t)})$$
  • (Attention)
    • $$\bar{h} = \sum_{i=1}^I a_ih_i^{(s)}$$ where $$a_i = \frac{\exp(e_i)}{\sum_{\tilde{i}=1}^I \exp(e_{\tilde{i}})}$$ and $$e_i = \Omega(h_i^{(s)}, h_j^{(t)})$$
    • $$\hat{h}_j^{(t)} = \tanh(W^{(a)}[\bar{h}, h_j^{(t)}])$$

Models: Large vocabulary trick (preparation)

  • Large vocabulary problems

    • The computation cost of $$\text{softmax}(o_t)$$ is very high, when the vocabulary size is large, because $$\dim(o_t)$$ equals to the vocabulary size.
  • Approaches

    • model-specific approaches
      • noise-contrastive estimation
      • binary hierarchical softmax
    • translation-specific approaches

Models: Authors apply encoder-decoder RNN with attention and large vocabulary trick(LVT)

  • The encoder-decoder RNN with attention is described in preparation slides.
  • Authors' LVT is that
    • the decoder-vocabulary of each mini-batch is restricted to words in the source documents of that batch.
    • the most frequent words in the target dictionary are added until the vocabulary reaches a fixes size.

Models: Authors propose the model uses the additional linguistic features.

  • Linguistic features
    • parts-of-speech tags (POS tag)
    • named-entity tags
      • MUC: organization, person, location, date, time, money, percent
    • TF (Term Frequency)
      • $$ tf_{i, j} = \frac{n_{i, j}}{\sum_k n_{k, j}}$$
      • $$n_{i, j}$$ is the number of times that term $$t_i$$ occurs in document $$d_j$$.
    • IDF (Inverse Document Frequency)
      • $$ idf_{i}=\log \frac{|D|}{{d: t_i \in d}} $$

Models: Authors propose modeling rare/unseen words using switching generator-pointer.

  • The algorithm is needed to handle unseen words, because the vocabulary is limited at training time.
  • In general, a most common way is to emit an ‘UNK’ token as a placeholder.
  • In summarization, an intuitive way is to simply point to their location in the source document.
  • Authors model this notion using our novel switching decoder/pointer architecture.
    • The switch decides between using the generator or a pointer at every time step.

Models: The switch

  • The probability of the switch turning on at the i-th time-step is
    • $$P(s_i = 1) = \sigma(vs \cdot (W_hs h_i + W_es E o_{i-1} + W_cs c_i + bs))$$
    • where $$E o_{i-1}$$ is the embedding vector of the emission from the previous time step,
    • $$c_i$$ is the attention-weighted context vector.
  • The pointer value at i-th time-step is
    • $$p_i = \arg \max_{j} (Pa_i(j))$$ for $$j \in {1, …, N_d}$$
    • where $$Pa_i(j) = \exp(va \cdot (W_ha h_{i-1} + Wa_e E o_{i-1} + W_ca hd_{j} + ba))$$

Models: The training of the switch parameters.

  • At the training time, the explicit pointer information is provides whenever the summary word does not exist in the target vocabulary.
  • The loss function is
    • $$\log P(y|x) = \sum_{i} (g_i \log {P(y_i|y_{-i}, x) P(s_i)}$$ $$ + (1-g_i) \log {P(p(i)|y_{-i}, x)(1-P(s_i))})$$
  • $$g_i$$ is an indicator function that is set to 0 whenever the word at position $$i$$ in the summary is OOV with respect to the decoder vocabulary.

Models: Capturing hierarchical document structure with hierarchical attention

  • In summarization, it is important to identify the key sentences from which the summary can be drawn.
  • This model aims to capture this notation of two levels of importance using bi-directional RNNs on the source sids, one at the word level and the other at the sentence level.
  • $$Pa(j) = \frac{Pa_w(j) Pa_s(s(j))}{\sum_{k=1}^{N_d} Pa_w(k) Pa_s(s(k))}$$

pandas.groupbyでaggに自作関数を渡す、要素にnumpy.arrayを使う。

import pandas as pd
import numpy as np


def g(x):
    y = None
    for i, a in x.iteritems():
        if y is None:
            y = a.copy()
        else:
            y += a
    return Foo(y)


class Foo:
    def __init__(self, x):
        self.x = x

    def __str__(self):
        return str(self.x)


if __name__ == '__main__':
    df = pd.DataFrame({'a': [1, 1, 2], 'b': [np.array([1, 2]), np.array([1, 2]), np.array([1, 2])]})
    x = df.groupby('a').agg({'b': g})
    print(repr(x))
    print(repr(df))

sklearn.ensemble.AdaBoostClassifierの使い方

公式ドキュメント

パラメータ

  • base_estimator=None,
  • n_estimators=50,
  • learning_rate=1.0,
  • algorithm=‘SAMME.R’,
  • random_state=None

GridSearchを使ったbase estimatorのパラメータ調整

  • 下記のようにkeyの前にbase_estimator__をつけたら良い。
param_grid = {'base_estimator__max_depth': [4, 5, 6, None], 'base_estimator__max_features': [2, None],
              'base_estimator__min_samples_split': [2, 8, 16, 32],
              'base_estimator__min_samples_leaf': [2, 8, 16, 32], 'base_estimator__max_leaf_nodes': [50, None],
              'learning_rate': [0.5, 1, 4]}