def METHOD_NAME(self, titleencoder, user_embedding_layer):
    """The main function to create user encoder of NPA.
    Args:
        titleencoder (object): the news encoder of NPA.
    Return:
        object: the user encoder of NPA.
    """
    hparams = self.hparams
    his_input_title = keras.Input(
        shape=(hparams.his_size, hparams.title_size), dtype="int32"
    )
    user_indexes = keras.Input(shape=(1,), dtype="int32")
    nuser_id = layers.Reshape((1, 1))(user_indexes)
    repeat_uids = layers.Concatenate(axis=-2)([nuser_id] * hparams.his_size)
    his_title_uid = layers.Concatenate(axis=-1)([his_input_title, repeat_uids])
    click_title_presents = layers.TimeDistributed(titleencoder)(his_title_uid)
    u_emb = layers.Reshape((hparams.user_emb_dim,))(
        user_embedding_layer(user_indexes)
    )
    user_present = PersonalizedAttentivePooling(
        hparams.his_size,
        hparams.filter_num,
        hparams.attention_hidden_dim,
        seed=self.seed,
    )([click_title_presents, layers.Dense(hparams.attention_hidden_dim)(u_emb)])
    model = keras.Model(
        [his_input_title, user_indexes], user_present, name="user_encoder"
    )
    return model