CNN Graph を使ってみる(書きかけ)

CNN Graph のインストールについて図解で説明する. Python を使うのが前提である.

先人に感謝.

関連する外部ページ】 Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering https://arxiv.org/abs/1606.09375

GitHub の mdeff/cnn_graph の配布サイト(https://github.com/mdeff/cnn_graph

前準備

Python のインストール(Windows上)

注:既にPython(バージョン3.12を推奨)がインストール済みの場合は,この手順は不要である.

winget(Windowsパッケージマネージャー)を使用してインストールを行う

  1. Windowsで,コマンドプロンプト管理者権限で起動する(手順:Windowsキーまたはスタートメニュー,「cmd」と入力,右クリックメニューなどで「管理者として実行」を選択)
  2. winget(Windowsパッケージマネージャー)が利用可能か確認する:
    winget --version
    
  3. Pythonのインストール(下のコマンドにより Python 3.12 がインストールされる).
    reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
    REM Python をシステム領域にインストール
    winget install --scope machine --id Python.Python.3.12 --id Python.Launcher -e --silent
    REM Python のパス
    set "INSTALL_PATH=C:\Program Files\Python312"
    echo %PATH% | find /i "%INSTALL_PATH%" >nul
    if errorlevel 1 setx PATH "%PATH%;%INSTALL_PATH%" /M >nul
    echo %PATH% | find /i "%INSTALL_PATH%\Scripts" >nul
    if errorlevel 1 setx PATH "%PATH%;%INSTALL_PATH%\Scripts" /M >nul
    
  4. 【関連する外部サイト】

    【サイト内の関連ページ】

    Git のインストール

    Git の URL: https://git-scm.com/

    • Windows での Git のインストール: 別ページ »で説明
    • Ubuntu での Git のインストール:

      端末で,次のコマンドを実行

      # パッケージリストの情報を更新
      sudo apt update
      sudo apt -y install git
      

    プログラムのダウンロードと展開(解凍)

    GitHub の mdeff/cnn_graph の配布サイト(https://github.com/mdeff/cnn_graph)で公開されている プログラムを,ダウンロードし展開(解凍)する.

    * 以下,Windows での手順を示す.Ubuntu でも同様の手順になる.

    1. GitHub の mdeff/cnn_graph の Web ページを開く.説明を確認

      https://github.com/mdeff/cnn_graph

    2. Windows では,コマンドプロンプトを実行.
    3. ディレクトリ(フォルダ)を空にする操作
      cd c:\pytools
      rmdir /s /q cnn_graph
      
    4. ダウンロード(git を使用)
      git clone https://github.com/mdeff/cnn_graph
      
    5. pip install -r requirements.txt の実行
      E:
      cd c:\pytools
      cd cnn_graph
      pip install -r requirements.txt
      
    6. models.py を次のように書き換え

    usage.ipyrb を実行してみる(書きかけ)

    まず、ディレクトリを移動

    from <ほにゃらら> import ... の「from <ほにゃらら> 」は削除