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
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))
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)
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()
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
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
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]))))