2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Enum.minの挙動について

Posted at

関数型でデータサイエンス#2で躓いた箇所は解決することができました。が、また新たな問題に気づきました。

今回の問題

ApplicantIncome列を正規化し、表示することができました。(一番左の列です。)
ApplicantIncome.png

無事に正規化された値が表示された! と思いましたが、よく見ると、

error.png

正規化で最小値を「1」にしているはずが、「0.15」が表示されています。

原因調査

最小値の値を表示してみます。

min = result |> Enum.map( &( &1[ "ApplicantIncome" ] ) ) |> Enum.min |> String.to_integer
<p>min = <%= min %></p>
min.png

「15」が最小値のはずが、「100」が表示されています。


結論

結論から言うと、解決できませんでした。

考えられる原因は次の3つかなと思っています。
CSVデータの文字コード当たりも調べてみたり、いくつか数値を変えてみたりしましたが、正しい最小値が取得できませんでした。

  1. Enum.minの挙動がおかしい
  2. CSVデータが不正
  3. CSVライブラリのバグ

環境
OS : Windows 10 Home
Elixir : 1.9.0
CSV : 2.1

2
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?