code: def gs_link_pred_model(
      num_samples, generator, optimizer, bias, dropout, normalize
  ):
      layer_sizes = [50] * len(num_samples)
      graphsage = GraphSAGE(
          layer_sizes=layer_sizes,
          generator=generator,
          bias=bias,
          dropout=dropout,
          normalize=normalize,
      )
      # Build the model and expose input and output sockets of graphsage, for node pair inputs:
      x_inp, x_out = graphsage.in_out_tensors()
      pred = link_classification(
          output_dim=1, output_act="relu", edge_embedding_method="ip"
      )(x_out)
  
      model = tf.keras.Model(inputs=x_inp, outputs=pred)
  
      model.compile(
          optimizer=optimizer,
          loss=tf.keras.losses.binary_crossentropy,
      )
  
      return model
  
imports: import numpy
  import pytest
  import random
  import tensorflow
  from stellargraph.data.unsupervised_sampler import UnsupervisedSampler
  from stellargraph.mapper.sampled_node_generators import GraphSAGENodeGenerator
  from stellargraph.mapper.sampled_link_generators import GraphSAGELinkGenerator
  from stellargraph.layer.graphsage import GraphSAGE
  from stellargraph.layer.link_inference import link_classification
  from stellargraph.random import set_seed
  from ..test_utils import flaky_xfail_mark
  from ..test_utils.graphs import petersen_graph
  from .fixtures import assert_reproducible
  from ..None import require_gpu
label_desc: Use image node_id 5 for calling a global function with example usage: gs_link_pred_model(num_samples, generator, optimizer, bias, dropout, normalize) and returns: model