python - TypeError: argument of type 'float' is not iterable-Tensorflow wide_n_deep_tutorial -
i facing issue while running wide_n_deep_tutorial program of tensorflow https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/learn/wide_n_deep_tutorial.py on personal data set variation parameters. loading data s3.
my target variable "impression_flag" takes value of either "true" or "false". below code snippet of train_and_eval method:
def train_and_eval(): """train , evaluate model.""" train_file_name, test_file_name = maybe_download() df_train = pd.read_csv( tf.gfile.open(train_file_name), names=columns, skipinitialspace=true) df_test = pd.read_csv( tf.gfile.open(test_file_name), names=columns, skipinitialspace=true, skiprows=1) df_train[label_column] = ( df_train["impression_flag"].apply(lambda x: "true" in x)).astype(int) df_test[label_column] = ( df_test["impression_flag"].apply(lambda x: "true" in x)).astype(int) model_dir = tempfile.mkdtemp() if not flags.model_dir else flags.model_dir print("model directory = %s" % model_dir) m = build_estimator(model_dir) m.fit(input_fn=lambda: input_fn(df_train), steps=flags.train_steps) results = m.evaluate(input_fn=lambda: input_fn(df_test), steps=1) key in sorted(results): print("%s: %s" % (key, results[key]))
while running code, error "type error: argument of type 'float' not iterable" displayed. following screenshot of error. enter image description here
any appreciated!
i got same problem, turns out caused nan
in first line. please checks answer: https://stackoverflow.com/a/40223208/5318060
Comments
Post a Comment