Importing jupyter codes to python script

I wanted to load isolation forest code in python script. I played with isolation forest node already and it went well. But next task given to me is to load isolation forest code in python script and to compare the results. How can I copy my jupyter code in python script? Can you help

1 Like

I have made a sample workflow here that works fine with Python script and Isolation forest, used the sample code from the documentation
isolation_forest.knwf (15.2 KB) IsolationForest example — scikit-learn 0.24.2 documentation

Please let me know if this is useful.


Thankyou for the code.
But it shows the error as follows
No module named ‘sklearn’
Traceback (most recent call last):
File “”, line 5, in
ModuleNotFoundError: No module named ‘sklearn’

If you encounter the “no module named ‘sklearn’” error, there are several steps you can take to troubleshoot the issue:

Check if scikit-learn is installed, if it is not installed, you can install it using pip.

If scikit-learn is installed on your system, but you are still getting the “no module named ‘sklearn’” error, you may need to check if the Python path is set correctly. The Python path is a list of directories where Python looks for modules and packages. To check the Python path, you can run the following command in your terminal or command prompt:

python -c "import sys; print(sys.path)"

This will print out the directories in the Python path. Make sure that the directory where scikit-

1 Like