code: def gs_nai(
      g,
      targets,
      num_samples,
      optimizer,
      batch_size=4,
      epochs=4,
      bias=True,
      dropout=0.0,
      normalize="l2",
      seed=0,
      shuffle=True,
  ):
      set_seed(seed)
      tf.random.set_seed(seed)
      if shuffle:
          random.seed(seed)
  
      nodes = list(g.nodes())
      generator = GraphSAGENodeGenerator(g, batch_size, num_samples)
      train_gen = generator.flow(nodes, targets, shuffle=True)
  
      model = gs_nai_model(
          num_samples,
          generator,
          targets,
          optimizer,
          bias,
          dropout,
          normalize,
      )
  
      model.fit(
          train_gen,
          epochs=epochs,
          verbose=1,
          use_multiprocessing=False,
          workers=4,
          shuffle=shuffle,
      )
      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 4 for calling a global function with example usage: gs_nai(g, targets, num_samples, optimizer, batch_size, epochs, bias, dropout, normalize, seed, shuffle) and returns: model