Deep learning sentiment analysis

Hi,
I’m trying to implement sentiment analysis through Deep learning on knime for my school project. I’m getting the following error regarding keras dataset:
ERROR Python Source 3:12:0:1 Execute failed: Traceback (most recent call last):
File “/Applications/KNIME 3.7.1.app/Contents/Eclipse/plugins/org.knime.python2_3.7.1.v201901281201/py/PythonKernelBase.py”, line 278, in execute
exec(source_code, self._exec_env, self._exec_env)
File “”, line 5, in
File “/anaconda3/lib/python3.7/site-packages/keras/datasets/imdb.py”, line 57, in load_data
file_hash=‘599dadb1135973df5b59232a0e9a887c’)
File “/anaconda3/lib/python3.7/site-packages/keras/utils/data_utils.py”, line 182, in get_file
os.makedirs(datadir)
File “/anaconda3/lib/python3.7/os.py”, line 221, in makedirs
mkdir(name, mode)
FileExistsError: [Errno 17] File exists: ‘/Users/akashysawant/.keras/datasets’

Please help rectify the error and suggest a link that would help me understand all the processes in the workflow.

Welcome @akshaysawant,

I guess that you were using this Sentiment analysis workflow from the examples.

If so, could you try to rerun the workflow and if you get the same error, then go inside the Read Data wrapped metanode and execute the Python Source nodes one after another.

The problem could be a race condition of the ~/.keras/datasets creation, which is checked in the keras code, but the workflow executes two similar operations simultaneously and the code is not robust against it.

A side node, KNIME officially recommends to use tensorflow 1.12 and python 3.6 (see python installation guide and Deep learning installation guide), whereas it seems that you are using python 3.7. The problem there is that this version of python was not supported up until the recent release tensonflow 1.13.0rc1 see this comment on TF github. In order not to step into uncharted teritory and thus not to bump into new features, I would recommend to create a new python virtual environment that would be aligned with the KNIME guidelines.

@nemad could have more insights

Cheers,
Misha

3 Likes

Thank you Misha! That did resolve my problem. Additionally, can you suggest changes in parameters to improve accuracy or would I need to build another workflow with additional nodes?

Regards,
Akshay

1 Like

Hi Akshay,

I have not tried to improve accuracy in this example, so i can make only general suggestions.
The most common advise, when it comes to neural networks is “Get more data” :slight_smile: . The second most popular advice is to increase network complexity or train longer. For this you can reuse the same workflow and just adjust the code in DL Python Network creator or Keras Network Learner, respectively. If you do not feel confident with python, there is a variant of the workflow, that uses KNIME nodes to define the network. In this case you can keep interacting with GUI

Optimisation of neural network performance is a very broad topic and each case needs some investigation around to understand what will work best.

2 Likes

Hello

I’m also trying to run the workflow and encounter the follwing error from the “Keras Network learner”

Cannot run program “C:\Users.condarc”:CreateProcess error=193, %1 ist keine zulässige Win32-Anwendung

does anybody have an idea what might be the problem?

many thanks in advance

Hi @And_Z,

could you check if python scripts in general in knime work, for example, you can try to run this workflow:

https://kni.me/w/TKrzQZ-rNSbYOVdg

In addition, which KNIME version do you use and how do you configure python in KNIME?

Best regards,
Mischa

Hi @lisovyi

i tested it on another python node i’ve got and this one is working.

the knime version is 3.7.2. I configured python in knime with a bat file (https://www.knime.com/blog/setting-up-the-knime-python-extension-revisited-for-python-30-and-20)

best

Andreas

Hi,

the origin of the problem seems to be different from the original question asked in the thread. To ease discovery of the problem and solution in the future, could you please create a new topic?

In addition to the original question, could you please also comment in the following topics in the new ticket:

  • is it an option to update to KNIME 4.0? Then you could use the easier python configuration procedure that directly deals with conda environments instead of bat scripts;
  • how does your python configuration bat script looks like?
  • what environments do you have in conda? (a screenshot from anaconda navigator or a dump of conda env list would be useful)
  • could you share a screenshot of your python preference page?
  • I did not fully understand, did the provided example work as-is or not? There are python2 and python3 environments in KNIME and this script was configured to use python 3, same as Keras integration. Whereas if you tried another workflow that might have used python 2 and thus did not probe if the relevant python environment is configured correctly.

All that information will be very useful for us to debug further and understand how to help you.

Best,
Mischa

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.