def insertInputOutput(self,line, lineCount, collection, type, isTrain): print(" processing insertInputOutput: " + line) # Declaring StringTokenizer st = line.split(",") for attName in st: attName = str(attName.strip()) print("attrName: " + attName) attrItem=Attributes.getAttributeByName(Attributes,attName) attributes=Attributes.getAttributes(Attributes) for att in attributes: print("att name is :"+str(att.getName())) #print("numbers of items that attributes:"+str(len(attributes))) if ( attrItem == None): print("Attributes.getAttribute == None") # If this attribute has not been declared, generate error er = ErrorInfo(ErrorInfo.InputTestAttributeNotDefined, 0, lineCount, 0, 0, isTrain, ("The attribute " + attName + " defined in @" + type + " in test, it has not been defined in @inputs in its train dataset. It will be ignored")) InstanceSet.errorLogger.setError(er) else: for itemCollection in collection: print("Item in collection is "+itemCollection) print("Attributes.getAttribute != None") print(" > " + str(type) + " attribute considered: " + attName) if(attName not in collection): print("attName:" +attName+" is not in collection") collection.append(attName)
def getOriginalHeaderWithoutInOut(self): line = "" attrs = [] # Getting the relation name and the attributes if (self.storeAttributesAsNonStatic and self.attributes != None): line = "@relation " + self.attributes.getRelationName() + "\n" attrs = self.attributes.getAttributes() else: line = "@relation " + Attributes.getRelationName() + "\n" attrs = Attributes.getAttributes() for i in range(0, len(attrs)): line = line + str(attrs[i]) + "\n" return line