I am very good at Python and Tensorflow, but I am newbie of KNIME.
I have a question.
Assuming that I am using “Python source” module in KNIME.
import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
fashion_mnist = keras.datasets.fashion_mnist(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load_data()
I want to use “train_images” numpy variable as output, and the dimension is (60000, 28, 28).
However, I found that numpy cannot be used for output of “Python source” module, but only “pandas dataframe” can be used. But, my data is 3d data, so conversion (from numpy to pandas) would be tricky…
Hi @leekh3,
first of all: welcome to the KNIME Forum! Well, KNIME tables are also only 2D, so if you want to return your numpy array, what do you expect to receive on the KNIME side? The only solution I see is “flattening” the array into a Pandas data frame of the form x, y, z, value. However, with that many dimensions this only works for sparse data.
Kind regards,
Alexander
Okay. Then, if I flatten the array: (60000, 28, 28) ==> (60000*28, 28), is there any method
for reverse (get the original one) from KNIME native module?