示例#1
0
 def get_validation_data(self):
     if self.validation_text_set is not None:
         return self.validation_text_set.get_samples().map(
             lambda sample: Sample.from_jtensor(
                 features=sample.features + sample.labels,
                 labels=JTensor.from_ndarray(np.array([0.0]))))
     return None
示例#2
0
 def to_jtensor(i):
     if isinstance(i, np.ndarray):
         return JTensor.from_ndarray(i)
     elif isinstance(i, JTensor):
         return i
     else:
         raise Exception("Error unknown input type %s" % type(i))
示例#3
0
 def get_training_data(self):
     sample_rdd = self.text_set.get_samples().map(
         lambda sample: Sample.from_jtensor(
             features=sample.features + sample.labels,
             labels=JTensor.from_ndarray(np.array([0.0]))))
     return FeatureSet.sample_rdd(sample_rdd,
                                  sequential_order=self.sequential_order,
                                  shuffle=self.shuffle)
示例#4
0
 def get_prediction_data(self):
     rdd = self.text_set.get_samples().map(
         lambda sample: Sample.from_jtensor(features=sample.features,
                                            labels=JTensor.from_ndarray(
                                                np.array([0.0]))))
     rdd_wrapper = callZooFunc("float", "zooRDDSampleToMiniBatch", rdd,
                               self.batch_per_thread)
     return rdd_wrapper.value().toJavaRDD()
示例#5
0
 def get_validation_data(self):
     if self.validation_text_set is not None:
         sample_rdd = self.validation_text_set.get_samples().map(
             lambda sample: Sample.from_jtensor(
                 features=sample.features + sample.labels,
                 labels=JTensor.from_ndarray(np.array([0.0]))))
         return FeatureSet.sample_rdd(
             sample_rdd,
             sequential_order=self.sequential_order,
             shuffle=self.shuffle)
     return None
示例#6
0
 def get_validation_data(self):
     if self.validation_text_set is not None:
         sample_rdd = self.validation_text_set.get_samples().map(
             lambda sample: Sample.from_jtensor(
                 features=sample.features + sample.labels,
                 labels=JTensor.from_ndarray(np.array([0.0]))))
         fs = FeatureSet.sample_rdd(sample_rdd,
                                    sequential_order=self.sequential_order,
                                    shuffle=self.shuffle)
         fs = fs.transform(SampleToMiniBatch(self.batch_size))
         return fs
     return None
示例#7
0
 def get_training_data(self):
     return self.text_set.get_samples().map(
         lambda sample: Sample.from_jtensor(features=sample.features + sample.labels,
                                            labels=JTensor.from_ndarray(np.array([0.0]))))