1
は、私は正常にIBMデータ・サイエンスの経験ではPythonでTensorflowを使用してモデルを構築しました。このモデルを使用してテストデータを評価します。しかし、レコードを予測するために呼び出すと、評価結果が消費されるわけではありません。私はhttps://www.tensorflow.org/get_started/input_fnからの説明と使用方法のリストを()は、次のとおりです。Tensorflow:予測結果を消費することにより、リストに失敗した()
predict_input_fn = tf.estimator.inputs.pandas_input_fn(
x={"x": x_pandas_predict_data},
num_epochs=1,
shuffle=False)
y = m.predict(input_fn=predict_input_fn)
predictions = list(p["predictions"] for p in itertools.islice(y, 6))
print("Predictions: {}".format(str(predictions)))
次のように私が手にエラーがある:
TypeErrorTraceback (most recent call last)
<ipython-input-49-49a72bc2fad0> in <module>()
15 # .predict() returns an iterator of dicts; convert to a list and print
16 # predictions
---> 17 predictions = list(p["predictions"] for p in itertools.islice(y, 6))
18 print("Predictions: {}".format(str(predictions)))
TypeError: 'list' object is not callable
がどのように私はこの問題を解決することができますか?
多くのありがとうございます。あなたは、標準のpythonの種類list
をシャドウlist
という変数を持っているよう
ヨハネス
ありがとうございます - あなたは正しいです。事故で、私はプログラムの早い段階で変数名としてlistを使用しました。私はこれを変更しました。今でも、私は別のエラーメッセージが表示されます:で TypeErrorTraceback(最後の最新の呼び出し) () 16#.predictを()dictsのイテレータを返します。リストに変換して印刷する 17#予測 ---> 18予測= itertools.islice(y、6)のpのリスト(p ["predictions"]) ... TypeError:データはpandasがインストールされている場合は、numpy配列またはpandas DataFrame。辞書 –
Johannes
このエラーは – Maxim
x_pandas_predict_data' 'について@Johannesで、新しい問題のための新しい質問を開いてくださいました。 –