<｜begin▁of▁sentence｜>### Instruction:
Given a synthesized stochastic block model graph created using NetworkX with 150 nodes distributed evenly across 3 blocks and probabilities p=[[0.25, 0.05, 0.02], [0.05, 0.35, 0.07], [0.02, 0.07, 0.40]], can you use the SBMEstimator in Graspologic to fit the graph and estimate its block probabilities? You should display the estimated block probability matrix.
### Response:
import numpy as np
from graspologic.models import SBMEstimator
import networkx as nx

# Generate a stochastic block model graph
G = nx.stochastic_block_model(sizes=[50, 50, 50], p=[[0.25, 0.05, 0.02], [0.05, 0.35, 0.07], [0.02, 0.07, 0.40]])

# Convert it to an adjacency matrix
adjacency_matrix = nx.to_numpy_array(G)

# We create block labels for 150 nodes
block_labels = np.array([0]*50 + [1]*50 + [2]*50)

# Initialize SBMEstimator
sbm_estimator = SBMEstimator(directed=False, loops=False)

# Fit the estimator to the adjacency matrix with the known block labels
sbm_estimator.fit(adjacency_matrix, y=block_labels)

# Print the estimated block probability matrix
print('Block probabilities:', sbm_estimator.block_p_)
<|EOT|>
