๐Ÿ”
Tobigs Graph Study
  • Tobigs Graph Study
  • Chapter1. Machine Learning with Graphs
    • Python code - graph basic
  • Chapter2. Properties of Networks, Random Graph Models
    • Python code - kronecker product
  • Chapter3. Motifs and Structural Roles in Networks
    • Python code - RoIX & ESU Tree
  • Chapter4. Community Structure in Networks
  • Chapter5. Spectral Clustering
  • Chapter6. Message Passing and Node Classification
  • Chapter7. Graph Representation Learning
  • Chapter8. Graph Neural Networks
  • Chapter9. Graph Neural Networks:Hands-on Session
  • Chapter10. Deep Generative Models for Graphs
  • Chapter11. Link Analysis: PageRank
  • Chapter12. Network Effects and Cascading Behavior
  • Chapter13. Probabilistic Contagion and Models of influnce
  • Chapter14. Influence Maximization in Networks
  • Chapter15. Outbreak Detection in Networks
  • Chapter16. network evolution graph
  • Chapter17. Reasoning over Knowledge Graphs
  • Chapter18. Limitations of Graph Neural Networks
  • Chapter19. Applications of Graph Neural Networks
Powered by GitBook
On this page
  • Kronecker product - numpy
  • Kronecker product MLE ๊ตฌํ˜„ํ•˜๊ธฐ

Was this helpful?

  1. Chapter2. Properties of Networks, Random Graph Models

Python code - kronecker product

PreviousChapter2. Properties of Networks, Random Graph ModelsNextChapter3. Motifs and Structural Roles in Networks

Last updated 5 years ago

Was this helpful?

Kronecker product - numpy

numpy.kron(a, b)

a, b์—๋Š” kronecker product๋ฅผ ๊ตฌํ•˜๊ณ ์ž ํ•˜๋Š” ํ–‰๋ ฌ์ด ๊ฐ๊ฐ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋“ค์–ด๊ฐ€๊ณ , kronecker product์˜ ๊ฒฐ๊ณผ๊ฐ’์„ ๋ฆฌํ„ดํ•ฉ๋‹ˆ๋‹ค.

Kronecker product MLE ๊ตฌํ˜„ํ•˜๊ธฐ

import numpy as np
G = [[1,0,1,1],[0,1,0,1],[1,0,1,1],[1,1,1,1]]
KM = [[0.5,0.2],[0.1,0.3]]
KM = np.kron(KM, KM)
P = 1
for i in range(KM.shape[0]):
  for j in range(KM.shape[1]):
    # G์— ์†ํ•  ๋•Œ.
    if G[i][j]==1:
      P = P*KM[i][j]
    # G์— ์†ํ•˜์ง€ ์•Š์„ ๋•Œ.
    else:
      P = P*(1-KM[i][j])
# P๋Š” kronecker ๋กœ๋ถ€ํ„ฐ ์ƒ์„ฑ๋œ ๊ทธ๋ž˜ํ”„๊ฐ€ ์‹ค์ œ G์ผ ํ™•๋ฅ ์„ ๋‚˜ํƒ€๋ƒ„.
print(P)
[source]
numpy.kron โ€” NumPy v1.13 Manual
Logo