# Dirichlet

This notebook illustrates a regression task as a solution of the Dirichlet problem (heat diffusion with constraints).

[1]:

from IPython.display import SVG

[2]:

from sknetwork.data import karate_club, painters, movie_actor
from sknetwork.regression import Dirichlet
from sknetwork.visualization import visualize_graph, visualize_bigraph


## Graphs

[3]:

graph = karate_club(metadata=True)
position = graph.position
labels_true = graph.labels

[4]:

# heat diffusion
dirichlet = Dirichlet()
values = {0: 0, 33: 1}

[5]:

image = visualize_graph(adjacency, position, scores=values_pred, seeds=values)
SVG(image)

[5]:


## Directed graphs

[6]:

graph = painters(metadata=True)
position = graph.position
names = graph.names

[7]:

picasso = 0
monet = 1

[8]:

dirichlet = Dirichlet()
values = {picasso: 0, monet: 1}

[9]:

image = visualize_graph(adjacency, position, names, scores=values_pred, seeds=values)
SVG(image)

[9]:


## Bipartite graphs

[10]:

graph = movie_actor(metadata=True)
names_row = graph.names_row
names_col = graph.names_col

[11]:

dirichlet = Dirichlet()

[12]:

drive = 3
aviator = 9

[13]:

values_row = {drive: 0, aviator: 1}

[14]:

image = visualize_bigraph(biadjacency, names_row, names_col, scores_row=values_row_pred, scores_col=values_col_pred,

[14]: