예제 #1
0
 def __getitem__(self, item)->datasets.PredictionItem:
     X=data0[item]
     
     y1=np.zeros(168)
     y1[gr[item]]=1
     
     y2=np.zeros(11)
     y2[vd[item]]=1
     
     y3=np.zeros(7)
     y3[cd[item]]=1
     return datasets.PredictionItem(item,np.stack([X],axis=-1),[y1,y2,y3])
예제 #2
0
    def __getitem__(self, item) -> datasets.PredictionItem:
        tokenText = []
        tokenClazz = []

        if self.byDoc:
            d = self.docs[item]
            for sent in d.sentences:
                tokenText = tokenText + [x.text for x in sent.tokens]
                tokenClazz = tokenClazz + [
                    self.num2Class[self.clazzColumn][0][x.fields[
                        self.clazzColumn]] for x in sent.tokens
                ]
        else:
            sent = self.sentences[item]
            tokenText = tokenText + [x.text for x in sent.tokens]
            tokenClazz = tokenClazz + [
                self.num2Class[self.clazzColumn][0][x.fields[self.clazzColumn]]
                for x in sent.tokens
            ]

        return datasets.PredictionItem(item, np.array(tokenText),
                                       np.array(tokenClazz))
예제 #3
0
 def __getitem__(self, item) -> datasets.PredictionItem:
     return datasets.PredictionItem(
         self.sorted[item][0], self.sorted[item][0],
         (self.sorted[item][1], "count:" + str(self.sorted[item][2])))
예제 #4
0
 def __getitem__(self, item) -> datasets.PredictionItem:
     return datasets.PredictionItem(self.sorted[item][0],
                                    self.sorted[item][0],
                                    self.sorted[item][1])
예제 #5
0
 def __getitem__(self, item):
     return datasets.PredictionItem(
         item, "H", (np.array([item % 2, item % 3])))
예제 #6
0
 def __getitem__(self, item):
     return datasets.PredictionItem(item, "H",
                                    ([item % 2], [item % 3]))
예제 #7
0
 def __getitem__(self, item):
     if item == 2:
         raise ValueError()
     return datasets.PredictionItem(item, "H", 0)
예제 #8
0
 def __getitem__(self, item):
     return datasets.PredictionItem(item, "H", (np.array(
         [float(item % 2), float(item % 3)])))
예제 #9
0
 def __getitem__(self, item):
     return datasets.PredictionItem(item, self.get_questions(item),
                                    np.array([self.target[item]]))
예제 #10
0
 def __getitem__(self, item):
     return datasets.PredictionItem(item, self.src[item], self.dest[item])