docstr: Test end-to-end training of values. 
  
  Uses labeled data with positive/negative sentiment. Model outputs logits, since embed_mode is false. Should be better than random, as transformer language models may actually capture semantics (This is a hypothesis from priming lit.)
docstr_tok: ["Test","end-to-end","training","of","values",".","Uses","labeled","data","with","positive\/negative","sentiment",".","Model","outputs","logits",",","since","embed_mode","is","false",".","Should","be","better","than","random",",","as","transformer","language","models","may","actually","capture","semantics","(","This","is","a","hypothesis","from","priming","lit",".",")"]
code: def test_encode_and_decode(self):
      """
      Test end-to-end training of values.
  
      Uses labeled data with positive/negative sentiment. Model outputs logits, since embed_mode is false. Should be better than random, as transformer language models may actually capture semantics (This is a hypothesis from priming lit.)
      """  # noqa
      seed = 2
  
      np.random.seed(seed)
      torch.manual_seed(seed)
      random.seed(seed)
  
      # Make priming data:
      train, test = create_synthetic_data(1000)
      output_enc = BinaryEncoder(is_target=True)
      output_enc.prepare(train["label"])
      encoded_target_values = output_enc.encode(train["label"])
  
      # Prepare the language encoder
      enc = PretrainedLangEncoder(
          stop_after=10, embed_mode=False, output_type=dtype.binary
      )
      enc.prepare(
          train["text"],
          pd.DataFrame(),
          encoded_target_values=encoded_target_values,
      )
  
      test_labels = test["label"].tolist()
      pred_labels = (
          softmax(enc.encode(test["text"]), dim=1)
          .argmax(dim=1)
          .tolist()
      )
  
      encoder_accuracy = accuracy_score(test_labels, pred_labels)
  
      # Should be non-random since models have primed associations to sentiment
      print(
          f"Categorial encoder accuracy for: {encoder_accuracy} on testing dataset"
      )
  
imports: import unittest
  import numpy
  import random
  import torch
  from torch.nn.functional import softmax
  from sklearn.metrics import accuracy_score
  from lightwood.encoder import BinaryEncoder, NumericEncoder
  from lightwood.encoder.text import PretrainedLangEncoder
  from type_infer.dtype import dtype
  import pandas
  import os
  import pathlib
label_desc: Use image node_id 1 for calling the TestPretrainedLangEncoder obj's underlying member method code with example usage: obj.test_encode_and_decode() without return types