Esempio n. 1
0
    def get_hyper_preprocessors(self):
        hyper_preprocessors = []

        if self._add_one_dimension:
            hyper_preprocessors.append(
                hpps_module.DefaultHyperPreprocessor(
                    preprocessors.AddOneDimension()))

        if self.dtype in [tf.uint8, tf.uint16, tf.uint32, tf.uint64]:
            hyper_preprocessors.append(
                hpps_module.DefaultHyperPreprocessor(
                    preprocessors.CastToInt32()))

        if not self._encoded and self.dtype != tf.string:
            hyper_preprocessors.append(
                hpps_module.DefaultHyperPreprocessor(
                    preprocessors.CastToString()))

        if self._encoded_for_sigmoid:
            hyper_preprocessors.append(
                hpps_module.DefaultHyperPreprocessor(
                    preprocessors.SigmoidPostprocessor()))
        elif self._encoded_for_softmax:
            hyper_preprocessors.append(
                hpps_module.DefaultHyperPreprocessor(
                    preprocessors.SoftmaxPostprocessor()))
        elif self.num_classes == 2:
            hyper_preprocessors.append(
                hpps_module.DefaultHyperPreprocessor(
                    preprocessors.LabelEncoder(self._labels)))
        else:
            hyper_preprocessors.append(
                hpps_module.DefaultHyperPreprocessor(
                    preprocessors.OneHotEncoder(self._labels)))
        return hyper_preprocessors
Esempio n. 2
0
 def get_hyper_preprocessors(self):
     hyper_preprocessors = []
     if self._add_one_dimension:
         hyper_preprocessors.append(
             hpps_module.DefaultHyperPreprocessor(
                 preprocessors.AddOneDimension()))
     if self._dtype in [tf.uint8, tf.uint16, tf.uint32, tf.uint64]:
         hyper_preprocessors.append(
             hpps_module.DefaultHyperPreprocessor(
                 preprocessors.CastToInt32()))
     if not self._encoded and self._dtype != tf.string:
         hyper_preprocessors.append(
             hpps_module.DefaultHyperPreprocessor(
                 preprocessors.CastToString()))
     if self.multi_label:
         hyper_preprocessors.append(
             hpps_module.DefaultHyperPreprocessor(
                 preprocessors.MultiLabelEncoder()))
     if not self._encoded:
         if self.num_classes == 2 and not self.multi_label:
             hyper_preprocessors.append(
                 hpps_module.DefaultHyperPreprocessor(
                     preprocessors.LabelEncoder(self._labels)))
         else:
             hyper_preprocessors.append(
                 hpps_module.DefaultHyperPreprocessor(
                     preprocessors.OneHotEncoder(self._labels)))
     return hyper_preprocessors
Esempio n. 3
0
 def get_hyper_preprocessors(self):
     hyper_preprocessors = []
     if self.dtype != tf.string:
         hyper_preprocessors.append(
             hpps_module.DefaultHyperPreprocessor(
                 preprocessors.CastToString()))
     return hyper_preprocessors