複数の目的変数を同時に考えるDNNをKerasを用いて実装したいのですが、以下のように行うと途中でjupyterのカーネルが落ちてしまいます。
解決方法をご存知の方いましたら、方法を教えていただけないでしょうか。
入力データは数値データです。
import numpy as np from keras.layers import Dense,Activation from keras.models import Sequential model = Sequential() model.add(Dense(16, input_shape=(1,))) model.add(Activation('relu')) model.add(Dense(16, input_shape=(1,))) model.add(Activation('sigmoid')) # 全ての目的変数が0/1のためsigmoidを使う model.add(Dense(10)) # 目的変数が10列ある model.compile(loss='binary_crossentropy', optimizer='Adam') # ここで落ちる
よろしくお願いいたします。
このコード自体には問題はありません。OSはなにか,バックエンドはなにか、Python/Keras/バックエンドのバージョン、CPUかGPUかの情報を追記しましょう。GPUの場合、意図的にCPUを使う様に(GPUを使わない様に)設定して起動してみて、それで動くかは確認しましたか。
返信おそくなり申し訳ありません、
OSのバージョン: macOS 10.12.6
Pythonのバージョン: 3.6.7
kerasのバージョン 2.2.4
tensorflow(CPU版)をバックエンドで使用(バージョン 1.12.0)
になります。
jupyter落ちたときにターミナルにメッセージ出ていたので、こちらに記載します。
2019-01-18 11:55:05.044935: I tensorflow/core/common_runtime/process_util.cc:69] Creating new thread pool with default inter op setting: 8. Tune using inter_op_parallelism_threads for best performance.
OMP: Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib already initialized.
OMP: Hint: This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.