まひろ量子のハックログ

プログラミングや機械学習などの知識を記録・共有します

独自学習したモデルをTensorFlow.jsで使う

1. TensorFlow.js

Tensorflowをブラウザで動かす技術が登場した。その名もTensorFlow.jsだ。 js.tensorflow.org

この記事では、独自に学習したモデルをTensorflowで使うときの流れを紹介する。

2. 学習するモデル(デブ判定器)

身長と体重を入力すると、どのくらい太っているのかを返すモデルを作ろうと思う。 「どのくらい太っているのか」は、身長と体重から計算されるBMIという値を使って定義する。

www.jpm1960.org

以下のように定義した。

  • 18.5未満 やせ (クラス番号0)
  • 18.5~24.9 ふつう (クラス番号1)
  • 25.0~29.9 肥満1度 (クラス番号2)
  • 30.0~34.9 肥満2度 (クラス番号3)
  • 35.0~39.9 肥満3度 (クラス番号4)
  • 40.0以上 肥満4度 (クラス番号5)

学習にもちいるデータセットの形式はこんな感じだ。

177.5890062,64.71439732,20.51959369,1
164.8972845,63.23919414,23.25730132,1
184.4277219,61.55920972,18.09841875,0
154.4941492,80.30581669,33.64518567,3
158.6124011,73.35584165,29.15818083,2
・
・
・

左から順に、身長(cm), 体重(kg), BMI, クラス番号である。カンマで区切られている。 実際の学習データと評価データは記事の末尾に載せておくので参考にしていただきたい。

ここでは、身長と体重の情報だけを使って、クラス番号を予測するモデルを作る。

bmi_tf.py

from sklearn import preprocessing
import tensorflow as tf
import numpy as np

training_data = 'bmi_training.csv'
test_data = 'bmi_test.csv'

# dim次元のOne-hotベクトルを表すlistを返す関数
def one_hot(idx, dim):
    return [1 if i == idx else 0 for i in range(dim)]

# データを読み込む関数
def load_data(filename):
    with open(filename) as f:
        rows = [[float(elem.strip()) for elem in row.split(',')] for row in f.readlines() ]
        x = [row[0:2] for row in rows] # データセットの中から, 身長と体重だけを取り出す。
        t = [one_hot(row[3], 6) for row in rows] # データセットの中から、クラス番号だけを取り出す。分類先のクラス数は6個。

        x = preprocessing.normalize(np.array(x, dtype=np.float32)) # 正規化
        return x, t

x = tf.placeholder(tf.float32, [None, 2], name='x') # 身長と体重の2次元ベクトルを受け取れるようにする。
t = tf.placeholder(tf.float32, [None, 6], name='t') # 「やせ」「ふつう」「肥満1度」「肥満2度」「肥満3度」「肥満4度」の6次元ベクトルを受け取れるようにする。
keep_prob = tf.placeholder(tf.float32, name='keep_prob') # ドロップアウトのためのハイパーパラメータ

# ネットワーク定義
w1 = tf.Variable(tf.random_normal([2,30], mean=0.0, stddev=0.5))
b1 = tf.Variable(tf.random_normal([30], mean=0.0, stddev=0.5))
h1 = tf.matmul(x, w1) + b1
h1 = tf.nn.dropout(h1, keep_prob) # ドロップアウト。keep_probで指定した割合のノードが生き残り、それ以外のノードは値が0になる。
h1 = tf.nn.tanh(h1)

w2 = tf.Variable(tf.random_normal([30,30], mean=0.0, stddev=0.5))
b2 = tf.Variable(tf.random_normal([30], mean=0.0, stddev=0.5))
h2 = tf.matmul(h1, w2) + b2
h2 = tf.nn.dropout(h2, keep_prob) # ドロップアウト
h2 = tf.nn.tanh(h2)

w3 = tf.Variable(tf.random_normal([30,6], mean=0.0, stddev=0.5))
b3 = tf.Variable(tf.random_normal([6], mean=0.0, stddev=0.5))
y = tf.matmul(h2, w3) + b3

# 誤差関数の定義
loss = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(labels=t, logits=y))

# 正解率の定義
correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(t, 1))
acc = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

# 推論結果の定義
predict = tf.argmax(y, 1, name='predict') # 'predict'という名前をつけた。

# 学習アルゴリズム定義
train = tf.train.AdamOptimizer().minimize(loss)

# 初期化
init = tf.global_variables_initializer()

# データセットのロード
train_x, train_t = load_data(training_data)
test_x, test_t = load_data(test_data)

with tf.Session() as sess:
    sess.run(init)
    print('Epoch\tTraining loss\tTest loss\tTraining acc\tTest acc')
    for epoch in range(3000):
        sess.run(train, feed_dict={
            x: train_x,
            t: train_t,
            keep_prob: 0.5
        })
        if (epoch+1) % 5 == 0:
            print('{}\t{}\t{}\t{}\t{}'.format(
                str(epoch+1),
                str(sess.run(loss, feed_dict={x:train_x, t:train_t, keep_prob:1.0})),
                str(sess.run(loss, feed_dict={x:test_x, t:test_t, keep_prob:1.0})),
                str(sess.run(acc, feed_dict={x:train_x, t:train_t, keep_prob:1.0})),
                str(sess.run(acc, feed_dict={x:test_x, t:test_t, keep_prob:1.0})),
            ))

    tf.saved_model.simple_save(sess, 'saved_model_debu', inputs={'x': x, 'keep_prob': keep_prob}, outputs={'predict': predict})

以下のコマンドで学習を開始する。

python bmi_tf.py

学習した結果、こうなった↓

Epoch    Training loss   Test loss   Training acc    Test acc
5   3.1208303   3.2619486   0.3511111   0.36
10  2.9821303   3.114055    0.3511111   0.36
15  2.8266895   2.9496677   0.3511111   0.36
20  2.6841924   2.7964628   0.3511111   0.36
25  2.5317469   2.634027    0.3511111   0.36
30  2.3827975   2.4757023   0.3511111   0.36
35  2.2274723   2.3102322   0.3511111   0.36
40  2.0915022   2.1640873   0.3511111   0.36
・
・
(省略)
・
・
3000    0.58536345  0.5924296   0.7511111   0.68

図示するとこんな感じだ。だいたい精度70%であることがわかる。 f:id:twx:20180831153711p:plain

3. TensorFlow.js形式への変換

学習済のモデルは以下のディレクトリ階層で保存される。

saved_model_debu/
├── saved_model.pb
└── variables
    ├── variables.data-00000-of-00001
    └── variables.index

このモデルを、TensorFlow.jsで使える形に変換しよう。変換にはtensorflowjs_converterというツールを使う。tensorflowjs_converterは以下のコマンドでインストールできる。

pip install tensorflowjs

インストールできたら、早速変換してみよう。

tensorflowjs_converter --input_format=tf_saved_model --output_node_names='predict' --saved_model_tags=serve ./saved_model_debu ./web_model_debu

ここで、--output_node_namesには、学習済みモデルの出力層につけた名前を指定すること。2つの引数./saved_model_debu./web_model_debuは、前者が学習済みモデルのディレクトリ、後者が変換後のモデル名(任意)だ。

変換後のモデルは以下のディレクトリ階層で保存される。

web_model_debu/
├── group1-shard1of1
├── tensorflowjs_model.pb
└── weights_manifest.json

4. TensorFlow.jsアプリの作り方

先程生成した変換後のモデルを全て、インターネット上にアップロードしよう。 筆者はAmazon AWSのS3にアップした。

https://s3-ap-northeast-1.amazonaws.com/********************/weights_manifest.json

のようなURLでアクセスできるように、AWS側でアクセス権の緩和と、CORSの設定をしておく。CORSの詳細は以下の記事を参考にした。

qiita.com

モデルをアップロードし、外からアクセス可能であることが確認できたら、次に以下のようなhtmlファイルを作ろう。

index.html

<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@0.12.5"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>

<p>身長(cm)</p>
<input id="height">

<p>体重(kg)</p>
<input id="weight">

<button id="predict"/>推定</button>
<p id="result"></p>

<script type="text/javascript">

  const MODEL_URL = 'https://s3-ap-northeast-1.amazonaws.com/********************/tensorflowjs_model.pb';
  const WEIGHTS_URL = 'https://s3-ap-northeast-1.amazonaws.com/********************/weights_manifest.json';
  const debuNet = tf.loadFrozenModel(MODEL_URL, WEIGHTS_URL);

  $(function(){
    $('#predict').click(function(){
      var list = [
        parseFloat($('#height').val()),
        parseFloat($('#weight').val())
      ];

      // 正規化
      var norm = 0;
      for(var i=0; i<list.length; i++){
        var elem = list[i];
        norm += elem*elem;
      }
      norm = Math.sqrt(norm);
      for(var i=0; i<list.length; i++){
        list[i] = list[i]/norm;
      }

      var x = tf.tensor([list]);
      var keep_prob = tf.tensor(1);

      debuNet
      .then(function(model) {
          return model.predict({
            x: x,
            keep_prob :keep_prob
          }).data();
      })
      .then(function(result){
        if(result == 0) {
          $('#result').text('やせ')
        } else if(result ==1) {
          $('#result').text('ふつう')
        } else if(result ==2) {
          $('#result').text('肥満1度')
        } else if(result ==3) {
          $('#result').text('肥満2度')
        } else if(result ==4) {
          $('#result').text('肥満3度')
        } else if(result ==5) {
          $('#result').text('肥満4度')
        } else {

        }
      });
    });
  });

</script>
</body>
</html>

ブラウザでみると、こんな画面になる。

f:id:twx:20180901130157p:plain

特に難しい点はない。初心者が気をつけるポイントとしては以下が挙げられる。

  • tensorflow.jsをheadタグ内でロードする
  • S3にアップしたモデルを読み込む
  • scriptタグ内で、身長と体重を受け取り正規化したあと、その値をモデルに入力して推定(predict)する
  • モデルはPromiseの形式になっているので、predictを行うときや結果を取り出すときは then メソッドを使う

画面に試しに身長と体重を入力して「推定ボタン」を推してみると・・・

f:id:twx:20180901130206p:plain

ふぇぇ (´・ω・`)

以上。TensorFlow.jsで自作モデルを動かしてみました。 いい記事だと思っていただければ、「スター☆」ボタンのクリックと、「読者になる」のボタンのクリックをお願いします!! 最後に、学習と評価に使ったデータセットを以下においておきます。

bmi_training.csv

157.7155327,89.68050674,36.05364012,4
149.0121203,64.41123934,29.00804543,2
180.8459627,55.09253775,16.84516007,0
148.1409148,58.21515077,26.52686836,2
149.2502218,53.00152538,23.79350368,1
184.8827907,86.88905118,25.41979705,2
148.836688,71.11034448,32.10057323,3
167.876071,73.54321637,26.09546421,2
177.8102206,50.07939998,15.83965344,0
150.449792,63.65515523,28.12227159,2
149.8739218,80.70286729,35.92831268,4
149.6785531,68.83859997,30.72648466,3
173.5408125,57.99238695,19.25607336,1
146.4555397,69.72566599,32.50731235,3
177.0621681,75.50536945,24.0838704,1
151.9656812,89.98033185,38.96337319,4
173.9581647,61.11309788,20.19503755,1
161.9356154,51.38360914,19.59475571,1
183.6585108,63.37645285,18.7890928,1
149.2184957,86.90654869,39.03077622,4
177.408315,84.17821087,26.74556329,2
157.6604586,50.83106006,20.44954248,1
152.7515651,75.97009171,32.55901914,3
173.8752019,84.72934364,28.02583414,2
150.2700977,53.63825253,23.75360241,1
177.5344335,79.65344496,25.27198563,2
145.5893331,62.96287424,29.70471786,2
179.2373856,60.37189685,18.79219975,1
184.8458864,66.59516262,19.49050552,1
172.8220754,83.34467776,27.90483374,2
164.1720909,70.22624545,26.05558277,2
165.7871527,53.74288128,19.55326114,1
174.1596466,68.32979815,22.52760737,1
174.5970877,87.13738126,28.58449429,2
179.2134466,63.90002495,19.89572838,1
165.4931726,82.13920995,29.99095932,2
166.7130118,64.7062284,23.28129274,1
170.9222462,88.16626659,30.17902939,3
155.4404346,61.4285431,25.42390234,2
161.1070384,81.16486086,31.27080205,3
175.4938469,50.52338884,16.40471482,0
173.6004887,50.95757405,16.90856913,0
166.7265635,88.32838536,31.77537571,3
152.7375314,66.19004502,28.3727311,2
172.5711501,88.01113292,29.55297623,2
159.4249706,62.74471303,24.68677997,1
165.6377195,51.96867408,18.94188308,1
169.210192,62.37068417,21.78349055,1
152.0001686,50.79446732,21.98509116,1
168.0976016,81.25903212,28.75733329,2
170.1208967,78.28826519,27.05087658,2
178.3777173,69.50922592,21.84546272,1
145.3744007,62.87172388,29.74948785,2
167.6526607,64.36569707,22.89989951,1
177.8696125,62.96025472,19.90045282,1
182.9627614,54.05407072,16.14741447,0
170.4067472,82.56212355,28.43199156,2
173.50718,59.56403492,19.78559919,1
153.9613623,87.00660585,36.70529648,4
169.992288,64.99083206,22.49021767,1
171.8726179,67.62774648,22.89346511,1
149.1961418,82.31398231,36.97927806,4
148.5367581,53.84273354,24.40389899,1
164.4137849,50.3552604,18.62809276,1
183.2855421,72.62546189,21.61884514,1
149.6538687,63.18539533,28.21245053,2
150.6515524,80.87792831,35.63549499,4
150.0463927,57.66190822,25.61166972,2
179.390308,69.34457456,21.5483756,1
168.6063504,67.31180665,23.67791142,1
164.715269,75.71062652,27.90545577,2
157.6131655,88.96907978,35.81410607,4
180.6176576,80.64710438,24.72113278,1
155.7455737,67.45877817,27.81038782,2
169.5264842,50.5105705,17.57547872,0
183.376559,76.88244008,22.86333186,1
172.1076611,76.53237814,25.83716171,2
182.4525469,78.52615519,23.5892685,1
152.4416425,70.28994314,30.24725397,3
175.0827847,76.36906384,24.91326089,1
148.9325606,50.40144284,22.72289473,1
169.8609411,57.74390422,20.01331784,1
148.0900142,80.17583936,36.55880284,4
145.9226146,71.74693768,33.69443388,3
159.7269954,57.76592443,22.6420155,1
184.3214793,75.06659062,22.09504025,1
170.6399787,54.662222,18.77265528,1
148.4289187,55.17332476,25.04333185,2
184.5440594,52.19220818,15.32517818,0
162.1844097,57.65434794,21.91865272,1
161.9099959,89.63481422,34.19238531,3
181.0545639,81.81706614,24.9588717,1
172.9925781,59.32444994,19.82342893,1
153.5270401,75.09438561,31.85940894,3
168.0620045,55.64229267,19.69998693,1
159.0545163,68.76936709,27.18335249,2
182.2331352,59.02123891,17.7727089,0
161.2793743,85.68580379,32.94209499,3
152.6140681,61.52894501,26.41741571,2
156.2272884,51.67716953,21.17312339,1
148.6560908,80.69228625,36.5146048,4
172.8285406,66.76435121,22.35186201,1
148.1289169,75.62562337,34.46587218,3
145.5838673,74.24987407,35.03234571,4
176.4481979,88.13375372,28.30791047,2
166.3855633,58.06165102,20.97288129,1
159.7874675,85.86434008,33.63004199,3
158.6001423,83.0993259,33.03622045,3
155.6849648,86.72531051,35.78100361,4
182.0380679,81.83331672,24.69481168,1
151.0529471,57.73475946,25.30340432,2
183.8554464,55.81207933,16.51106943,0
146.0337252,53.14171151,24.91891964,1
175.3983385,57.83828842,18.80028714,1
184.9982516,63.22194314,18.47279419,0
159.3768643,84.30043029,33.18785893,3
145.9164074,53.89040686,25.31064458,2
156.9363765,60.67406266,24.63518533,1
155.4874739,81.30182693,33.62865429,3
155.4100094,74.98071056,31.04499388,3
153.8766917,57.49420776,24.28166219,1
182.1612558,81.83728795,24.66261966,1
171.4525982,78.5244881,26.71264989,2
178.9225733,65.39993003,20.42899549,1
180.2905305,88.71783925,27.29387024,2
167.4993216,83.59944472,29.7973257,2
178.3726076,61.48050138,19.32329028,1
153.594292,60.74658652,25.74967349,2
159.3989171,69.99456954,27.54822451,2
167.2124346,89.74665363,32.09823288,3
160.7251328,54.42312257,21.06763907,1
158.3090676,78.59805222,31.36174371,3
146.2168134,57.68851931,26.98328141,2
149.5912478,86.27764039,38.55546006,4
147.1582954,76.81850828,35.47287368,4
149.4123965,67.45203913,30.21494584,3
163.3200818,50.19543108,18.81850033,1
153.7814331,61.94603791,26.1942354,2
155.5895322,78.40873408,32.38945883,3
169.2698674,65.12670279,22.73001821,1
154.1585034,65.08940062,27.38894485,2
167.8883344,64.03186102,22.71721473,1
152.9047756,80.15882862,34.28540334,3
179.820623,54.4641647,16.84348102,0
163.5407149,72.08616904,26.95256873,2
162.7653018,64.14076394,24.21087429,1
176.945171,60.88480941,19.4460555,1
184.014674,86.65779044,25.59190992,2
156.5266603,56.08205813,22.89007971,1
169.5587512,58.51553614,20.35310953,1
175.3063965,89.09586175,28.99092067,2
148.9111549,81.24573858,36.63921224,4
151.6049608,78.86193774,34.31157224,3
164.6174398,62.04237867,22.89479473,1
157.9983343,79.91732085,32.01370211,3
172.441642,67.62475641,22.74162086,1
170.1356003,82.54416927,28.51648586,2
170.5969597,56.81603835,19.52218276,1
160.1619961,88.09289876,34.34171308,3
182.6271006,71.5375181,21.44882077,1
184.0416223,69.38383399,20.48453872,1
170.2841579,86.50081983,29.83126922,2
175.1466346,80.41120407,26.21277329,2
169.339176,74.30209615,25.91111975,2
160.9370743,77.67668167,29.99013773,2
182.3850435,79.8669827,24.0098162,1
146.7053531,73.04376137,33.93838774,3
168.0845942,71.47918406,25.30018904,2
170.6004502,69.61179557,23.9178694,1
178.3041772,71.91893524,22.62143827,1
162.3017291,53.32948874,20.24515596,1
172.4008266,51.39286873,17.29116174,0
149.4934094,90.99993305,40.71898834,5
147.6022913,69.52411995,31.91165306,3
151.9466991,52.3702797,22.6830972,1
156.7888829,59.06078923,24.0252942,1
172.4115667,78.54564514,26.42343745,2
148.651563,78.87955444,35.6964879,4
167.6532432,83.85123979,29.8322198,2
178.7979229,79.92009286,24.99948381,1
159.5780316,82.00740674,32.20378148,3
180.5910297,72.75337582,22.30800849,1
149.3074282,79.3107191,35.5769782,4
151.3716546,75.1254063,32.7867008,3
166.1840818,82.99459665,30.05183357,3
184.7692166,71.41154119,20.9174708,1
149.6300372,68.98412328,30.81141059,3
173.5499971,69.92581004,23.21604755,1
161.4384153,76.94770134,29.5244543,2
182.9679794,61.04245163,18.233993,0
156.1995881,78.27606955,32.08257674,3
182.3643508,84.78544291,25.49420086,2
181.0499511,62.35027309,19.02135873,1
167.0806891,65.62502791,23.50807056,1
168.5063332,80.75420945,28.4402044,2
164.1788409,69.70613119,25.86048161,2
181.4215994,53.1252378,16.14072002,0
151.9402083,78.70155436,34.09085353,3
168.2577001,71.65916784,25.31173201,2
152.0237422,79.72960205,34.49822564,3
175.0427094,64.78010501,21.14236635,1
177.3033687,76.28344327,24.26589499,1
171.7354741,75.93022702,25.74510524,2
179.9685707,82.63429176,25.51331989,2
153.3040287,71.94715896,30.61304382,3
152.6615533,63.01105518,27.03693135,2
145.8459363,79.48174547,37.36618245,4
146.4958156,53.58907889,24.97042028,1
173.1265168,80.58151243,26.884888,2
158.3202433,75.76344234,30.22642621,3
173.0441548,57.15814026,19.08816682,1
158.333763,85.9455012,34.28278396,3
182.9343224,79.80056503,23.84600191,1
167.3083282,88.7581202,31.7083013,3
155.4539857,61.61662447,25.49729919,2
154.1209788,78.49089725,33.04424069,3
184.4653564,85.03876528,24.9912118,1
155.0318437,83.39911716,34.69921338,3
152.5907669,86.97857267,37.35560418,4
149.0609161,61.95202051,27.88225555,2
171.9372368,77.30724682,26.1505195,2
170.601271,52.94429641,18.19091969,0
153.2182459,79.32503159,33.79008479,3
170.659357,73.56253416,25.25785535,2
172.3643416,72.12418905,24.2765011,1
168.5763064,72.2965142,25.44042077,2
174.0869549,82.00927773,27.06017057,2
175.74006,77.15672636,24.98229038,1
146.2420239,66.26265887,30.98307232,3
145.489392,75.1165553,35.48730391,4
160.5201071,70.67651216,27.42939494,2
174.8082885,88.32422522,28.90385667,2
160.2481918,60.52577291,23.56970075,1
148.0434908,74.90199009,34.17548785,3
181.7853065,89.12081347,26.96879787,2
181.9521881,73.89992278,22.32181062,1
168.1214277,63.3882205,22.42654753,1
184.1070588,75.8561311,22.37947059,1
165.7434423,65.45845082,23.82829751,1
163.921465,75.17112768,27.97560013,2
163.1878674,75.04894726,28.18180924,2
184.1514241,58.99138912,17.39556182,0
182.8329938,69.36432068,20.750425,1
182.2906849,63.87738932,19.22286893,1
149.8682582,50.01043963,22.26595631,1
182.2094183,63.43718942,19.10743056,1
147.0194119,86.25199189,39.90430682,4
167.574818,77.5330136,27.61017453,2
161.9812326,52.24765211,19.91303147,1
167.6740848,82.15761916,29.22240505,2
154.118762,81.68941892,34.39179022,3
181.8022972,80.42652513,24.33327545,1
176.3578257,60.59207313,19.48167707,1
159.5974037,51.84091934,20.35265405,1
172.6465786,76.91316822,25.80386427,2
178.7631678,55.0387295,17.22313938,0
172.1310153,74.93066169,25.28956195,2
165.6504023,65.34991449,23.8155181,1
183.4936715,50.8949689,15.11585343,0
179.6551575,58.01877767,17.97584011,0
169.0473656,75.92859509,26.56981616,2
172.7146392,80.20031664,26.8854793,2
178.2950252,77.99774604,24.53599088,1
159.2760076,88.18386302,34.7606907,3
150.9588277,58.11316379,25.5010164,2
182.950318,75.39919468,22.52684495,1
157.3406697,54.83425809,22.14980887,1
152.4065117,66.33777838,28.55971553,2
177.4641784,54.53854525,17.31737828,0
175.717313,86.30359482,27.95115629,2
172.4872564,50.54806869,16.98988888,0
181.3106385,64.24570114,19.543282,1
184.9831686,89.02859927,26.01747297,2
159.975983,89.19376545,34.85177679,3
152.2490568,67.73641361,29.22220458,2
154.4820317,80.95117427,33.9208876,3
148.9685523,80.39530118,36.22775917,4
167.62042,55.67636625,19.81604747,1
158.3735751,87.65824569,34.94840289,3
180.6064409,64.07336001,19.64314536,1
156.0508291,84.53370915,34.71344889,3
149.0075481,73.9006028,33.28368811,3
179.7071368,70.2424338,21.75048279,1
161.5705073,80.22228081,30.73058501,3
159.5416722,80.71150914,31.70933897,3
174.3045058,77.05127965,25.36078126,2
150.3736104,70.93578243,31.37054827,3
181.2550919,71.21812747,21.67754612,1
175.5010334,78.37750267,25.44673491,2
177.590069,64.80105457,20.54682499,1
163.66572,80.19388556,29.93820831,2
174.6346543,50.36624012,16.51500365,0
183.8126828,86.95996376,25.73762107,2
168.8061071,72.85117331,25.56585029,2
168.9084438,61.22302023,21.45912595,1
168.0549212,68.71393805,24.33001462,1
150.627658,75.11132889,33.10518342,3
173.1173238,51.04018084,17.03064691,0
166.0085831,79.87424048,28.98315476,2
171.1838987,63.28320221,21.59546803,1
182.0776954,65.79373398,19.84591099,1
156.8419633,82.05200599,33.35528558,3
175.5000343,72.38378393,23.5010286,1
171.9697225,67.0503105,22.67236437,1
167.594816,67.56062571,24.05318,1
150.7517843,56.82400824,25.0038533,2
167.7826929,81.38352545,28.90960637,2
177.0478577,83.75032304,26.71807341,2
145.5779619,78.52835032,37.05400913,4
163.152313,84.52254277,31.75309655,3
179.6280211,87.45370859,27.10379227,2
166.0409623,86.74383311,31.46357925,3
172.8257661,64.54318441,21.60893721,1
155.9954628,89.16971087,36.64320268,4
179.2596599,89.18705305,27.75470896,2
164.7431365,59.16750178,21.80060631,1
158.0807508,88.83636325,35.54944224,4
162.7486243,69.70147519,26.31523891,2
174.3393437,76.53706005,25.18146323,2
158.410351,67.77739588,27.00957594,2
172.9661805,87.42263075,29.22143106,2
151.5870944,87.07661541,37.89457871,4
173.302157,74.92502995,24.94703801,1
177.0968798,76.62601077,24.43173996,1
176.3212754,75.0916669,24.15362435,1
171.8038901,52.63785661,17.83332032,0
174.0420899,51.37380626,16.96028573,0
173.2049595,54.38778488,18.12928702,0
168.8166411,58.50679479,20.52937826,1
170.5796392,51.79879565,17.80185582,0
161.0195515,52.43331794,20.22321109,1
168.0551411,79.50085161,28.1493373,2
146.2433242,87.52450675,40.92395242,5
154.5407026,75.98272466,31.81479273,3
172.4660046,69.92307091,23.50788128,1
174.0313115,80.05359544,26.43175841,2
147.8605655,60.79959762,27.8096792,2
145.4332319,78.23109588,36.98725514,4
175.2361815,54.15221739,17.63472463,0
148.2657267,72.99963073,33.20772486,3
162.3534235,74.14012178,28.12745206,2
157.1223385,75.92337329,30.75385957,3
181.2029486,58.6381576,17.8586981,0
179.2092745,56.08266545,17.46255081,0
148.9418644,55.49571146,25.01645986,2
182.986381,76.76870269,22.92697015,1
153.3085052,78.19933319,33.27135984,3
177.9805621,83.67255136,26.41422445,2
159.3210844,57.14116349,22.51140345,1
165.9615903,77.25883561,28.05000758,2
146.1174498,85.9862305,40.27399791,5
159.154756,62.41325402,24.639823,1
175.9788186,74.92647418,24.19438018,1
149.8231288,82.53009217,36.76669612,4
183.1112068,79.15329579,23.60691048,1
174.854012,59.90646113,19.59397106,1
182.9240039,69.47266013,20.76215987,1
164.9759126,67.39014217,24.7602653,1
167.6688455,76.45539041,27.19589541,2
176.3464495,82.30658632,26.46678255,2
174.5285875,50.24554942,16.4954608,0
183.3561583,68.14734187,20.27019463,1
183.7558575,51.50061773,15.25211442,0
162.075959,86.28202245,32.84604751,3
155.957132,71.26326178,29.29916318,2
160.1795587,76.93054418,29.98365821,2
147.6248672,59.34823102,27.2325769,2
181.3829508,71.73579676,21.80434276,1
154.8249707,80.68011227,33.65770356,3
177.8784041,75.75758154,23.94305996,1
167.9123709,83.86121185,29.74375166,2
175.5386515,87.82911632,28.50315915,2
172.8805992,80.81401083,27.03921899,2
174.3321336,84.19801098,27.70428468,2
149.4782888,78.38342296,35.08067893,4
169.1932897,67.87375715,23.71022203,1
174.9127973,83.09751802,27.16094535,2
149.9777468,53.85939414,23.94461257,1
157.6901,67.58749653,27.18050384,2
149.8611359,61.2001462,27.25049651,2
183.7267805,84.48437459,25.02830644,2
161.1953623,86.1595461,33.15876273,3
153.5181619,69.35334107,29.42712702,2
155.6317648,86.45351537,35.69325648,4
169.9845004,76.60473879,26.51166415,2
176.8340627,50.81973709,16.25176614,0
175.0697603,55.23408735,18.02124986,0
182.2243265,74.17226373,22.33720482,1
151.1684906,88.54046905,38.74532115,4
168.1994292,78.35154858,27.69482014,2
150.9651206,63.64761493,27.92729659,2
179.9674734,65.84629508,20.33027741,1
147.9210768,72.72361748,33.2365054,3
154.7921768,81.82589135,34.15015895,3
164.7096753,88.75038795,32.71387864,3
152.1781317,52.79752692,22.79864752,1
149.982159,79.94577965,35.53991134,4
165.2595737,84.32591244,30.87648063,3
179.8377603,75.3279897,23.29134708,1
176.7450689,62.62620267,20.04755746,1
173.296572,64.51815255,21.48334878,1
173.4572788,75.59740841,25.12591288,2
174.505952,71.3026303,23.41450939,1
157.8317687,70.35301931,28.24189889,2
182.280835,89.64614962,26.98047693,2
159.8341186,71.37517257,27.93882839,2
163.2056594,67.49663993,25.34029841,2
175.369942,89.22555119,29.01208379,2
156.4252993,87.6635424,35.82655315,4
169.8816604,81.32900021,28.18074299,2
171.1144927,53.38125057,18.23119581,0
168.8614906,65.14963914,22.84813611,1
176.4838219,68.0626426,21.8523932,1
148.2570204,88.63959365,40.32712127,5
152.3758229,70.22619111,30.24593301,3
160.2629815,58.11471752,22.62662063,1
153.3379902,82.04809498,34.89546329,3
152.3362552,67.88776432,29.25397973,2
148.6005181,74.18673024,33.59584609,3
184.6203628,79.20092313,23.23651769,1
174.9782669,80.64383213,26.33922156,2
166.7766028,68.71267061,24.70396037,1
148.1258255,83.70953852,38.15165482,4
184.5434548,69.5752964,20.42950161,1
171.9460395,76.22336771,25.78123865,2
158.6319375,89.72704574,35.65677917,4
178.8705627,88.85236123,27.77098138,2
163.4693003,58.87708535,22.03301321,1
165.9491547,85.63276738,31.09495194,3
183.0362117,89.24582279,26.63875113,2
149.0118872,86.66500511,39.03030427,4
148.1957429,86.87868553,39.5586794,4
153.1556163,87.06557239,37.11766134,4
152.3601273,65.65493287,28.28295014,2
171.7113937,83.98450965,28.48399917,2
162.8425068,74.77283928,28.19735119,2
183.5581212,63.65249121,18.89157635,1
182.9890081,69.904489,20.87637356,1
158.9937181,65.96703862,26.09558622,2
147.9565227,77.11510724,35.22664113,4
155.5827786,67.21372696,27.76738172,2
147.6850494,79.20831283,36.31597408,4
184.5470772,54.84662395,16.10406657,0
150.6249304,78.21400773,34.47393207,3
174.7982124,62.96715665,20.6082023,1
151.8402525,55.82792759,24.21462079,1
175.6415194,53.93923076,17.48438568,0
166.9464257,59.92177302,21.49960123,1
150.5567741,53.66719352,23.67599738,1
170.9130725,59.93013043,20.51609302,1

bmi_test.csv

177.5890062,64.71439732,20.51959369,1
164.8972845,63.23919414,23.25730132,1
184.4277219,61.55920972,18.09841875,0
154.4941492,80.30581669,33.64518567,3
158.6124011,73.35584165,29.15818083,2
166.0370229,82.36169692,29.87551569,2
169.6612532,82.39583608,28.62463278,2
172.8582082,52.272359,17.49411939,0
183.7597861,73.43739126,21.74784793,1
178.3102594,84.42059402,26.55190832,2
145.7058367,88.84342396,41.84768034,5
174.9631237,63.90942817,20.87718232,1
165.3872153,83.06574655,30.36813372,3
173.4048449,66.75339003,22.19989249,1
179.6483265,58.74047555,18.20082635,0
175.8814376,76.5235827,24.73747004,1
150.43772,88.93210917,39.29570701,4
156.0780163,50.15016044,20.58680037,1
164.5276807,60.66220104,22.40991518,1
172.3360904,75.772929,25.51300431,2
175.7425384,84.70157933,27.42443685,2
153.4043271,78.98498113,33.56365891,3
181.4151475,73.55314109,22.34879601,1
173.3434861,60.09424361,19.99943931,1
165.0101735,74.37733123,27.31612864,2
181.0326434,78.43490605,23.9329148,1
166.9788122,72.89473459,26.14408364,2
184.4072401,77.5883363,22.81605229,1
158.9369714,63.38543563,25.09225044,2
154.0814563,85.96921674,36.21114195,4
164.7194599,76.60178479,28.23248262,2
183.6692317,79.3862389,23.53273521,1
174.8219975,56.41324809,18.45818309,0
147.936031,84.47716627,38.60036506,4
150.107019,51.9918355,23.07454516,1
159.2579522,68.60528806,27.04925684,2
168.1818128,80.40685083,28.42725953,2
171.7174646,72.95312311,24.74086922,1
172.1301013,85.02582818,28.69704787,2
145.4192007,58.97900827,27.89034966,2
150.2171378,72.46398354,32.11317451,3
163.2451122,64.42814556,24.17660182,1
164.2772281,67.65596147,25.06982704,2
182.2175676,54.06466818,16.2829486,0
152.9064199,70.45371725,30.13370081,3
158.4670756,54.28863847,21.61876413,1
176.06228,78.99466036,25.48385309,2
150.7407019,77.22001955,33.98355754,3
169.2401197,80.0370143,27.94372068,2
181.8093354,76.64634827,23.18777671,1
Kozuko Mahiro's Hacklog ―― Copyright © 2018 Mahiro Kazuko