Community
cancel
Showing results for 
Search instead for 
Did you mean: 
cn_j_
Beginner
342 Views

How to run daal example in python independently and monitor inputs and outputs of some main functions?

Hi,

I was able to run all examples in python using the following cmd:

PS C:\IntelPython3\share\pydaal_examples\examples\python> C:\IntelPython3\python.exe .\run_examples.py

What i am really interested in doing is to run just one example below and monitor inputs and outputs of some main functions.

C:\IntelPython3\share\pydaal_examples\examples\python\source\em\em_gmm_dense_batch.py

Here is what I have tried:

PS C:\IntelPython3\share\pydaal_examples\examples\python\source\em> C:\IntelPython3\python.exe .\em_gmm_dense_batch.py
Traceback (most recent call last):
  File ".\em_gmm_dense_batch.py", line 53, in <module>
    from utils import printNumericTable
ModuleNotFoundError: No module named 'utils'

So if all examples can run without error, i do not think something is missing. What is the correct way to run that example?

Thanks a lot!

 

0 Kudos
5 Replies
342 Views

Hi cn,

The examples are set up to run from the `share\pydaal_examples\examples\python` directory, so to run a single example, you can do

cd C:\IntelPython3\share\pydaal_examples\examples\python
C:\IntelPython3\python.exe source\em\em_gmm_dense_batch.py

If you really want to run them from a different directory, just adjust the paths to the data files in the example, and make sure your PYTHONPATH points to the `utils` module, which is in `C:\IntelPython3\share\pydaal_examples\examples\python\sources`.

Chris

cn_j_
Beginner
342 Views

Chris,

Thanks for the info!

I was able to do that using Powershell and even better I could run run_examples.py in pyCharm!

DAAL.png

If I expand source and run \em\em_gmm_dense_batch.py, it still returned me error:

C:\IntelPython3\python.exe C:/IntelPython3/share/pydaal_examples/examples/python/source/em/em_gmm_dense_batch.py
Traceback (most recent call last):
  File "C:/IntelPython3/share/pydaal_examples/examples/python/source/em/em_gmm_dense_batch.py", line 67, in <module>
    DataSourceIface.doDictionaryFromContext
  File "C:\IntelPython3\lib\site-packages\daal\data_management\__init__.py", line 4946, in __new__
    return FileDataSource_CSVFeatureManagerFloat64(*args)
  File "C:\IntelPython3\lib\site-packages\daal\data_management\__init__.py", line 3944, in __init__
    this = _data_management.new_FileDataSource_CSVFeatureManagerFloat64(*args)
SystemError: Error on file open

This example was runable in powershell but I hope to step through the code in pyCharm such that input and output in each line can be monitored.

Do you have any suggestions? Thanks

 

Gennady_F_Intel
Moderator
342 Views

here is standalone example of em_gmm_dense_batch.py example - attached. 

and here is the output 

python.exe em_gmm_dense_batch.py
Weights
0.500     0.500

Means
10.166    0.045     -7.211
0.194     0.019     0.376

Covariance
7.568     1.306     -0.063
1.306     0.979     0.636
-0.063    0.636     2.277

Covariance
0.860     -0.229    0.081
-0.229    2.220     -0.102
0.081     -0.102    2.573

cn_j_
Beginner
342 Views

Thanks for the zip file, Gennady

I tried to run it in pyCharm and I was hoping to see some real time variable values but I was not able to. For instance, when I stepped to the line:

algorithm.input.setValues(em_gmm.inputValues, resultInit)

I hovered over 'resultInit' and looked for initialized mean and weight matrix, but I was showing nothing.

2.png

The same thing happened when i tried to look for input data matrix, and calculated initialized mean and weight matrix. So i am wondering if there is a way to see those values at run time? Are they all designed to be hidden and calculated under the hood?

Thanks!

yingxing__bao
Beginner
342 Views

if your error is "Error on file open", you can change the line 40 to 

DAAL_PREFIX = jp('..', '..','..','data')

then your code will run normally.

Reply