0

我对使用 Microsoft Azure 运行 jupyter 笔记本很陌生。我注意到绘制 2 个 numpy 数组的极坐标图可能需要 30-45 秒,该数组相对较小(每个数组<300 个数据点)。当我必须执行其中几个图时,时间会增加,所以我想知道这是否与特定的计算实例或网络延迟有关?任何见解将不胜感激,谢谢!

4

1 回答 1

0

Notebook will be slow when the data loading limits are high, below is one of the case where I faced similar issue.

  • Tried to display some 40000 columns, I faced some serious unresponsive issue and slowness.
  • As soon as I changed the code to display only 40 or 80 columns, the response was good.

Below are some root causes for this:

  • Clean all the data which is related to dataframes like pandas etc.

  • From the below block we can get memory and cpu usage, so that it will help us to clear the unwanted data:

    #!/usr/bin/env python
    import psutil
    # gives a single float value
    psutil.cpu_percent()
    # gives an object with many fields
    psutil.virtual_memory()
    # you can convert that object to a dictionary 
    dict(psutil.virtual_memory()._asdict())
    # you can have the percentage of used RAM
    psutil.virtual_memory().percent
    79.2
    # you can calculate percentage of available memory
    psutil.virtual_memory().available * 100 / psutil.virtual_memory().total
    20.8
    
  • We will have some variable inspectors, if they are enabled the notebook might get slow because of some dataframes like pandas. GIT Issue

    If you want to disable it --> Edit --> nbextensions config.

Refer to these SO (SO1, SO2, SO3, SO4) links for detailed explanations.

于 2021-11-29T07:25:36.620 回答