How to disable keras warnings?
keras, machine-learning, tensorflow
Solution
You can tell tensorflow using environment variables. From within python:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
The warnings indicate you are using keras 1.x code with a keras 2.x installation. Maybe it would be easier to fix them, instead of ignoring.
Problem
When I run the following code: ``` init = "he_uniform" inp = Input(shape=(1800, 1)) norm1 = BatchNormalization(mode=0)(inp) conv1 = Convolution1D(16, 5, border_mode='same', init=init, activation="relu")(norm1) pool1 = MaxPooling1D(pool_size=3)(conv1) norm2 = BatchNormalization(mode=0)(pool1) flat1 = Flatten()(norm2) dens1 = Dense(128, init=init, activation="relu")(flat1) #norm3 = BatchNormalization(mode=0)(dens1) output = Dense(2, init=init, activation="softmax")(dens1) from keras.models import * model = Model(input=[inp], output=output) ``` I had the warnings: ``` root/miniconda/envs/jupyterhub_py3/lib/python3.4/site-packages/ipykernel/__main__.py:4: UserWarning: Update your `BatchNormalization` call to the Keras 2 API: `BatchNormalization()` /root/miniconda/envs/jupyterhub_py3/lib/python3.4/site-packages/ipykernel/__main__.py:5: UserWarning: Update your `Conv1D` call to the Keras 2 API: `Conv1D(16, 5, activation="relu", kernel_initializer="he_uniform", padding="same")` /root/miniconda/envs/jupyterhub_py3/lib/python3.4/site-packages/ipykernel/__main__.py:7: UserWarning: Update your `BatchNormalization` call to the Keras 2 API: `BatchNormalization()` /root/miniconda/envs/jupyterhub_py3/lib/python3.4/site-packages/ipykernel/__main__.py:9: UserWarning: Update your `Dense` call to the Keras 2 API: `Dense(128, activation="relu", kernel_initializer="he_uniform")` ``` The following approach did not help. ``` with warnings.catch_warnings(): warnings.simplefilter("ignore") ``` How to disable this warning?