class_docstr: Writer for writing out FeatureSets as ARFF files.
  
  Parameters
  ----------
  path : :class:`skll.types.PathOrStr`
      A path to the feature file we would like to create.
      If ``subsets`` is not ``None``, this is assumed to be a string
      containing the path to the directory to write the feature
      files with an additional file extension specifying the file
      type. For example ``/foo/.arff``.
  
  feature_set : :class:`skll.data.featureset.FeatureSet`
      The ``FeatureSet`` instance to dump to the output file.
  
  quiet : bool, default=True
      Do not print "Writing..." status message to stderr.
  
  subsets : Optional[Dict[str, List[str]]], default=None
      A mapping from subset names to lists of feature names
      that are included in those sets. If given, a feature
      file will be written for every subset (with the name
      containing the subset name as suffix to ``path``).
      Note, since string- valued features are automatically
      converted into boolean features with names of the form
      ``FEATURE_NAME=STRING_VALUE``, when doing the
      filtering, the portion before the ``=`` is all that's
      used for matching. Therefore, you do not need to
      enumerate all of these boolean feature names in your
      mapping.
  
  logger : Optional[logging.Logger], default=None
      A logger instance to use to log messages instead of creating
      a new one by default.
  
  relation : str, default='skll_relation'
      The name of the relation in the ARFF file.
  
  regression : bool, default=False
      Is this an ARFF file to be used for regression?
  
  kwargs : Optional[Dict[str, Any]]
      The arguments to the ``Writer`` object being instantiated.
class_docstr_tok: ["Writer","for","writing","out","FeatureSets","as","ARFF","files",".","Parameters","--","--","--","--","--","path",":",":","class",":","`","skll.types.PathOrStr","`","A","path","to","the","feature","file","we","would","like","to","create",".","If","``","subsets","``","is","not","``","None","``",",","this","is","assumed","to","be","a","string","containing","the","path","to","the","directory","to","write","the","feature","files","with","an","additional","file","extension","specifying","the","file","type",".","For","example","``","\/foo\/.arff","``",".","feature_set",":",":","class",":","`","skll.data.featureset.FeatureSet","`","The","``","FeatureSet","``","instance","to","dump","to","the","output","file",".","quiet",":","bool",",","default=True","Do","not","print","``","Writing","...","''","status","message","to","stderr",".","subsets",":","Optional","[","Dict","[","str",",","List","[","str","]","]","]",",","default=None","A","mapping","from","subset","names","to","lists","of","feature","names","that","are","included","in","those","sets",".","If","given",",","a","feature","file","will","be","written","for","every","subset","(","with","the","name","containing","the","subset","name","as","suffix","to","``","path","``",")",".","Note",",","since","string-","valued","features","are","automatically","converted","into","boolean","features","with","names","of","the","form","``","FEATURE_NAME=STRING_VALUE","``",",","when","doing","the","filtering",",","the","portion","before","the","``","=","``","is","all","that's","used","for","matching",".","Therefore",",","you","do","not","need","to","enumerate","all","of","these","boolean","feature","names","in","your","mapping",".","logger",":","Optional","[","logging.Logger","]",",","default=None","A","logger","instance","to","use","to","log","messages","instead","of","creating","a","new","one","by","default",".","relation",":","str",",","default='skll_relation'","The","name","of","the","relation","in","the","ARFF","file",".","regression",":","bool",",","default=False","Is","this","an","ARFF","file","to","be","used","for","regression","?","kwargs",":","Optional","[","Dict","[","str",",","Any","]","]","The","arguments","to","the","``","Writer","``","object","being","instantiated","."]
docstr: Write headers to ARFF file.
  
  Called before lines are written to file, so that headers can be written
  for files that need them.
  
  Parameters
  ----------
  feature_set : Ignored
      Not used.
  
  output_file : IO[str]
      The file being written to.
  
  filter_features : Set[str]
      If only writing a subset of the features in the
      FeatureSet to ``output_file``, these are the
      features to include in this file.
docstr_tok: ["Write","headers","to","ARFF","file",".","Called","before","lines","are","written","to","file",",","so","that","headers","can","be","written","for","files","that","need","them",".","Parameters","--","--","--","--","--","feature_set",":","Ignored","Not","used",".","output_file",":","IO","[","str","]","The","file","being","written","to",".","filter_features",":","Set","[","str","]","If","only","writing","a","subset","of","the","features","in","the","FeatureSet","to","``","output_file","``",",","these","are","the","features","to","include","in","this","file","."]
code: def _write_header(
      self,
      feature_set: FeatureSet,
      output_file: IO[str],
      filter_features: Set[str],
  ) -> None:
      """
      Write headers to ARFF file.
  
      Called before lines are written to file, so that headers can be written
      for files that need them.
  
      Parameters
      ----------
      feature_set : Ignored
          Not used.
  
      output_file : IO[str]
          The file being written to.
  
      filter_features : Set[str]
          If only writing a subset of the features in the
          FeatureSet to ``output_file``, these are the
          features to include in this file.
      """
      fieldnames, _ = self._get_column_names_and_indexes(
          self.feat_set, filter_features
      )
      fieldnames.append(self.id_col)
  
      # Add relation to header
      print(f"@relation '{self.relation}'\n", file=output_file)
  
      # Loop through fields writing the header info for the ARFF file
      for field in fieldnames:
          field = field.replace("\\", "\\\\").replace("'", "\\'")
          print(f"@attribute '{field}' numeric", file=output_file)
  
      # Print class label header if necessary
      if self.regression:
          print(
              f"@attribute {self.label_col} numeric", file=output_file
          )
      else:
          if self.feat_set.has_labels:
              sorted_features = sorted(set(self.feat_set.labels))  # type: ignore
              labels_str = ",".join(
                  [str(feat) for feat in sorted_features]
              )
              labels_str = "{" + labels_str + "}"
              print(
                  f"@attribute {self.label_col} {labels_str}",
                  file=output_file,
              )
      if self.label_col:
          fieldnames.append(self.label_col)
  
      # Create CSV writer to handle missing values for lines in data section
      # and to ignore the instance values for non-numeric attributes
      self._dict_writer = DictWriter(
          output_file,
          fieldnames,
          restval=0,
          extrasaction="ignore",
          dialect="arff",
      )
  
      # Finish header and start data section
      print("\n@data", file=output_file)
  
imports: import json
  import logging
  import sys
  from csv import DictWriter
  from decimal import Decimal
  from pathlib import Path
  from typing import IO, Any, Dict, List, Optional, Set, Tuple, Union
  import numpy
  import pandas
  from scipy.sparse import issparse
  from sklearn.feature_extraction import DictVectorizer, FeatureHasher
  from skll.data import FeatureSet
  from skll.types import FeatGenerator, FeatureDict, IdType, LabelType, PathOrStr
label_desc: Use image node_id 2 for calling the ARFFWriter obj's underlying member method code with example usage: obj._write_header(feature_set, output_file, filter_features) without return types