The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
"Execute Python" operator takes forever to run
I tried to implement the chapter 10 RapidMiner file from the classic RapidMiner textbook, 2nd edition by Vijay Kotu and Bala Deshpande. Dr Kotu is a member of the Advisory Board at RapidMiner.
(
Yes, I have installed the Execute Python operator from Marketplace. However, this operator takes forever to run. After waiting for more than 15 minutes, it still could not execute these codes. (However, I do not encounter this drag when using Jupyter).
Any idea if the Execute Python operator is not working?
The Python code is below, as copied from the textbook:
******************************************
(
http://www.introdatascience.com/download.html
)Yes, I have installed the Execute Python operator from Marketplace. However, this operator takes forever to run. After waiting for more than 15 minutes, it still could not execute these codes. (However, I do not encounter this drag when using Jupyter).
Any idea if the Execute Python operator is not working?
The Python code is below, as copied from the textbook:
******************************************
from __future__ import print_function
import os
import numpy as np
import pandas as pd
import keras
from keras.datasets import mnist
from keras import backend as K
### Loads and returns MNIST data set in Pandas format
def rm_main():
# input image dimensions
img_rows, img_cols, ch_no = 28, 28, 1
num_classes = 10
# the data, shuffled and split between train and test sets
(x_train, y_train), (x_test, y_test) = mnist.load_data()
if K.image_data_format() == 'channels_first':
input_shape = (ch_no, img_rows, img_cols)
else:
input_shape = (img_rows, img_cols, ch_no)
x_train = x_train.reshape(x_train.shape[0], img_rows*img_cols*ch_no).astype('float32')
x_test = x_test.reshape(x_test.shape[0], img_rows*img_cols*ch_no).astype('float32')
x_train /= 255
x_test /= 255
# convert image vectors to data frames
df_train = pd.concat([pd.DataFrame(data={'y': y_train}), pd.DataFrame.from_dict(x_train)], axis=1)
setattr(df_train, "rm_metadata", {})
df_train.rm_metadata['y'] = ("nominal","label")
df_test = pd.concat([pd.DataFrame(data={'y': y_test}), pd.DataFrame.from_dict(x_test)], axis=1)
setattr(df_test, "rm_metadata", {})
df_test.rm_metadata['y'] = ("nominal","label")
# Prepare shape info
shape_data = np.array([['', 'rows', 'cols', 'ch', 'shape'],
['', img_rows, img_cols, ch_no, str(input_shape)]])
shape_result = pd.DataFrame(data=shape_data[1:,1:],
index=shape_data[1:,0],
columns=shape_data[0,1:])
setattr(shape_result, "rm_metadata", {})
shape_result.rm_metadata['rows'] = ("integer",None)
shape_result.rm_metadata['cols'] = ("integer",None)
shape_result.rm_metadata['ch'] = ("integer",None)
shape_result.rm_metadata['shape'] = ("text",None)
# Return results
return df_train, df_test, shape_result
0
Answers
As requested, the XML is here. Hope you could spot the issues from this textbook example. Thank you.
==============================
Our team is also facing similar issue where execute Python operator keeps on spinning but doesn't finish ; no errors.
Any help is appreciated.
Thanks,
Abhishek Bourai
Dortmund, Germany
This block keeps spinning as shown below.
Since i am new to Rapidminer , could you please through a light on the - package manager and conda environment. Do i need to create a separate environment in Anaconda?
Here is my Python script - some Python and Numpy operations