def recordBoxStats(listOfBoxes, phaseLabel): requires(isinstance(phaseLabel, str)) requires(len(phaseLabel) > 0) requires(isinstance(listOfBoxes, list)) requires(all([isProperBox(x) for x in listOfBoxes])) labelForThisPhaseInQuestionAnswering = "Question_DomainOfVariablesInResponce:" + phaseLabel #V~~VV~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V # Below is largely copied from descriptionState.py # TODO: add this sort of code as a funtion in the utils to call upon.... #========================================================================= generalSummaryFunctionsAndLabelsForThem = [\ ( (lambda A : np.prod(np.diff(A, axis=1)) ), "bvolume"), \ ( (lambda A : np.min(np.diff(A, axis=1)) ), "bminSideLength"), \ ( (lambda A : np.max(np.diff(A, axis=1)) ), "bmaxSideLength"), \ ( (lambda A : np.sum(np.diff(A, axis=1)) ), "bsumSideLengths"), \ ] for thisFunctAndLabel in generalSummaryFunctionsAndLabelsForThem: theseValues = [thisFunctAndLabel[0](x) for x in listOfBoxes] resultValue = distributionStatics(theseValues) specificLabel = labelForThisPhaseInQuestionAnswering + ":" + thisFunctAndLabel[ 1] for thisKey in resultValue: commandToExecute = \ "INSERT INTO QAStateValues ( QAStateUUID , fieldName, fieldValue) VALUES ('" + \ ObjDatabaseValueTracker.get_QAStateUUID_mostRecentBeingComputed() + "', '" + (specificLabel + ":" + thisKey) + "', ? );" objDatabaseInterface.interfaceBleed_insertValuesForBlob(\ commandToExecute, [resultValue[thisKey]] ) objDatabaseInterface.commit() #^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^ return
def preloop(self): availableDomains = getAvailableDomains(); userResponce = promptToSelectFromList([x.getName() for x in availableDomains], "the domain to use"); integerDomainSelection = userResponce[1]; s = z3.Solver(); self.domainInformation = availableDomains[integerDomainSelection](s); print("Enter path to the neural-net weights to use. Spaces in the path name will be ignored.", flush=True); thisLineMissingNewLine = readInLineAllowingForPathCompletion(); pathToWeights = os.path.realpath(thisLineMissingNewLine.replace(" ", "")); assert(isinstance(pathToWeights, str)); assert("\n" not in pathToWeights); if(not os.path.isfile(pathToWeights)): raise Exception("Path not found: " + str(pathToWeights)); # userUUID is NULL for now, and the time started is set by default. The end-time will be set later.... randomSeeds = {"randomSeedForNumpy" : config.randomSeedForNumpy, "randomSeedForPython3LibRandom": config.randomSeedForPython3LibRandom}; commandToStartSessionInDatabase = \ "INSERT INTO sessionInfo ( sessionUUID, domainUUID , pathToSystemAnalyzed, gitCommitHash, randomSeeds ) VALUES " + \ "('" + str(ObjDatabaseValueTracker.get_sessionUUID()) + "' , '" + \ str(self.domainInformation.getUUID()) + "' , '" + \ str(pathToWeights) + "', '" + \ str(getGitCommitHash(str(uuid.uuid4()))) + "', ?);"; objDatabaseInterface.interfaceBleed_insertValuesForBlob(commandToStartSessionInDatabase, [randomSeeds]);""" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAIAQC/RPJH+HUB5ZcSOv61j5AKWsnP6pwitgIsRHKQ5PxlrinTbKATjUDSLFLIs/cZxRb6Op+aRbssiZxfAHauAfpqoDOne5CP7WGcZIF5o5o+zYsJ1NzDUWoPQmil1ZnDCVhjlEB8ufxHaa/AFuFK0F12FlJOkgVT+abIKZ19eHi4C+Dck796/ON8DO8B20RPaUfetkCtNPHeb5ODU5E5vvbVaCyquaWI3u/uakYIx/OZ5aHTRoiRH6I+eAXxF1molVZLr2aCKGVrfoYPm3K1CzdcYAQKQCqMp7nLkasGJCTg1QFikC76G2uJ9QLJn4TPu3BNgCGwHj3/JkpKMgUpvS6IjNOSADYd5VXtdOS2xH2bfpiuWnkBwLi9PLWNyQR2mUtuveM2yHbuP13HsDM+a2w2uQwbZgHC2QVUE6QuSQITwY8RkReMKBJwg6ob2heIX+2JQUniF8GKRD7rYiSm7dJrYhQUBSt4T7zN4M5EDg5N5wAiT5hLumVqpAkU4JeJo5JopIohEBW/SknViyiXPqBfrsARC9onKSLp5hJMG1FAACezP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8pMQ3TrzC1961GAp5eiYA1zGSyDPz+w== abc@defg """ self.loadedLearnedModel = None; dictMappingModelTypeDescriptionToClass = {\ "Nueral Net: input>32 hidden->[fully connected]->32 hidden->linear output unit->output clipped" : PropogatorForNueralNet, \ "Linear Regression with Degree-3 Polynomial Features" : PropogatorForPolyFeatLinearModel, \ "Models Described in README.txt for sanity checking" : PropogatorForPolyFeatLinearModel \ }; userChoice = promptToSelectFromList(list(dictMappingModelTypeDescriptionToClass.keys()), "type of learned model."); self.loadedLearnedModel = dictMappingModelTypeDescriptionToClass[userChoice[0]](pathToWeights); assert(isinstance(self.loadedLearnedModel , ModelBoxProgatorManager)); self.history = []; def functorFor_do_methods(thisQuestionType): return ( lambda *args: self.tempFuct(self.dictMappingLeadingTokenToQuestionClass[thisQuestionType], args[1] )); def functorFor_complete_methods(thisQuestionType): return (lambda s, text, line, start_index, end_index : \ self.dictMappingLeadingTokenToQuestionClass[thisQuestionType].getUseableConditions(\ self.domainInformation, self.dictMappingLeadingTokenToQuestionClass[thisQuestionType], conditionNameStartsWith=text) ); for thisQuestionType in self.dictMappingLeadingTokenToQuestionClass: setattr(FanoosFrontend, ("do_" + thisQuestionType), classmethod( functorFor_do_methods(thisQuestionType) )); setattr(FanoosFrontend, ("complete_" + thisQuestionType), classmethod(functorFor_complete_methods(thisQuestionType)) ); return;
def _convertDictionaryToSQLCommands(self, leadingTag, dictToRecord): requires(isinstance(leadingTag, str)) requires(len(leadingTag) > 0) requires(isinstance(dictToRecord, dict)) requires(all([isinstance(x, str) for x in dictToRecord.keys()])) requires(all([(len(x) > 0) for x in dictToRecord.keys()])) for keyName in dictToRecord: assert (isinstance(keyName, str)) fieldName = leadingTag + ":" + keyName objDatabaseInterface.interfaceBleed_insertValuesForBlob(\ "INSERT INTO QAStateValues (QAStateUUID, fieldName, fieldValue) VALUES ( '" + self.getID() + "', '" + fieldName + "' , ?);", \ [dictToRecord[keyName]] \ ) objDatabaseInterface.commit() return
def convertBoxAndLabelToList(self, label, d2Array, listOfAxisForBox): requires(d2Array.shape[0] == len(listOfAxisForBox)) for thisIndex in range(0, len(listOfAxisForBox)): for upperOrLowerSelector in [0, 1]: specificLabel = (\ label + ":" + str(listOfAxisForBox[thisIndex]) + ":" + \ ("u" if (upperOrLowerSelector == 1) else "l") \ ) commandToExecute = \ "INSERT INTO QAStateValues ( QAStateUUID , fieldName, fieldValue) VALUES ('" + \ self.getID() + "', '" + specificLabel + "', ? );" objDatabaseInterface.interfaceBleed_insertValuesForBlob(\ commandToExecute, [d2Array[thisIndex, upperOrLowerSelector]] ) objDatabaseInterface.commit() return
def _helper_convertDescriptionToSQLCommands(self, thisObj): thisObjUUIDAsString = DescriptionState.convertDescriptionStateIDToStringUniformly( thisObj.getID()) # need for the case of a MetaCondition_Conjunction, but does the proper thing in other cases as well if (isinstance(thisObj, MetaCondition_Conjunction)): for childObj in thisObj.listOfConditionsToConjunct: objDatabaseInterface.exec(\ "INSERT INTO QAStateValues ( QAStateUUID , fieldName, parentUUID , childUUID) VALUES ('" + \ self.getID() + "', 'd:parent_child', '" + thisObjUUIDAsString + "', '" + childObj.getID() + "' );" \ ) self._helper_convertDescriptionToSQLCommands(childObj) elif (isinstance(thisObj, Condition_TheBoxItself)): commandToExecute = \ "INSERT INTO QAStateValues ( QAStateUUID , fieldName, childUUID, fieldValue) VALUES ('" + \ self.getID() + "', 'd:box:value', '" + thisObjUUIDAsString + "', ? );" objDatabaseInterface.interfaceBleed_insertValuesForBlob(\ commandToExecute, [str(thisObj)] ) return
def write(self, label, thisThing): requires(isinstance(label, str)) # TODO: safety checks on the label.... byteObj = pickle.dumps(thisThing) commandToExecute = \ "INSERT INTO terminalOutput ( sessionUUID, orderIndex , channelName , valueOnChannel ) VALUES " + \ "('" + str(ObjDatabaseValueTracker.get_sessionUUID()) + "' , " + \ str(self.orderIndex) + " , '" + \ label + "', ?);" """ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAIAQC/RPJH+HUB5ZcSOv61j5AKWsnP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qb/50xy6ZMwKVccw0mhVSt1NXZgoa6mx6cx251G9crWvxfPpvuYLH2NqnceoeADP8hTiia6N6iN3e4kBzDXHIrsgI6NFd6qW9p9HrFnDmHdakv3qfCJSY8acYdEe9ukRXvheyKGtvqmbMnS2RNDLcMwSQo9aypSPNpHMEXtvVp+vIuiWCR1fjgz8uY1f1Pa0SETX9jrLXfqq1zGeQTmFPR1/ANUbEz25nFIkwSUTr5YduvbFIruZ5cW8CySfKyiun+KclIwKhZVbHXcALjAOc//45HV0gdJfEEnhbUkQ+asWdf3Guyo6Eqd8g40X6XsJiFY5ah7Mc4IacNBzp3cHU3f0ODVjP9xTMMH+cNxq9IYvvhlVp38e8GydYCGoQ79jvKWHLbtsF+Z1j98o7xAxdBRKnCblSOE4anny07LCgm3U18Qft0HFEpIFATnLb3Yfjsjw1sE8Rdj9FBFApVvA3SvjGafvq5b7J9QnTWy80TjwL5zrix6vwxxClT/zjDNX+3PPXVr1FMF+Rhel58tJ8pMQ3TrzC1961GAp5eiYA1zGSyDPz+w== abc@defg """ objDatabaseInterface.interfaceBleed_insertValuesForBlob( commandToExecute, [byteObj]) assert (self.orderIndex + 1 > self.orderIndex) # weak overflow check, though strictly speaking not # needed in python..... self.orderIndex = self.orderIndex + 1 objDatabaseInterface.commit() return
def tempFuct(self, questionType, *arg): try: parsedUserQuestion = getAndParseUserInput(self.domainInformation, questionType, arg[0], self.dictMappingConditionTokenToCondition); self.history.append((parsedUserQuestion, [])); # This object is modified by reference by the events in # externalCall_respondToUserQuestion ObjDatabaseValueTracker.set_questionInstanceUUID(uuidToUse=parsedUserQuestion.getID()); commandToStartQuestionInDatabase_1 = \ "INSERT INTO session_questionInstance_relation (sessionUUID, questionInstanceUUID) VALUES ('" + \ str(ObjDatabaseValueTracker.get_sessionUUID()) + "' , '" + str(ObjDatabaseValueTracker.get_questionInstanceUUID()) + "')"; objDatabaseInterface.exec(commandToStartQuestionInDatabase_1); # below, the value of database column questionInstanceUUID is set by default.... commandToStartQuestionInDatabase_2 = \ "INSERT INTO questionInstanceInfo (questionInstanceUUID, questionInstanceType) VALUES ('" + \ str(ObjDatabaseValueTracker.get_questionInstanceUUID()) +"', '" + \ str(parsedUserQuestion.__class__.__name__) + "');"; objDatabaseInterface.exec(commandToStartQuestionInDatabase_2); objDatabaseInterface.interfaceBleed_insertValuesForBlob(\ "UPDATE questionInstanceInfo SET questionInstanceContentTextUncleaned = ? WHERE questionInstanceUUID = '" + \ str(ObjDatabaseValueTracker.get_questionInstanceUUID()) + "';", \ [arg[0]]); objDatabaseInterface.commit(); externalCall_respondToUserQuestion(\ self.domainInformation, self.loadedLearnedModel, \ parsedUserQuestion, self.history); # record the end of the question..... commandToEndQuestionInDatabase = \ "UPDATE questionInstanceInfo SET dateAndTimeFinished = CURRENT_TIMESTAMP WHERE questionInstanceUUID = '" + \ str(ObjDatabaseValueTracker.get_questionInstanceUUID()) + "';"; objDatabaseInterface.exec(commandToEndQuestionInDatabase); objDatabaseInterface.commit(); except: errorMessageIndented = " " + traceback.format_exc().replace("\n", "\n "); sys.stderr.write(errorMessageIndented); sys.stderr.flush(); timePackageToUseForSleep.sleep(3); return;
def _convertBoxesToSQLCommandsToRecordSummaryStatistics( self, variablesBoxesProducedMayBeOver, universeForBoxes): labelBeginning = "bstats" # short for "box statistics"; #V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V # domain specific statistics - i.e., those that are most clearly applicale to this specific domain.... #============================================================= labelForDomainSpecificStats = labelBeginning + ":d" variablesBoxesProducedMayBeOver = [ str(x) for x in variablesBoxesProducedMayBeOver ] resultValue = self._getAnalysisResult(self.internalDictionary["boxes"]) for thisKey in resultValue: self.convertBoxAndLabelToList(\ labelForDomainSpecificStats + ":" + thisKey, \ resultValue[thisKey], \ variablesBoxesProducedMayBeOver ) generalSummaryFunctionsAndLabelsForThem = [\ ( (lambda A : np.prod(np.diff(A, axis=1)) ), "bvolume"), \ ( (lambda A : np.min(np.diff(A, axis=1)) ), "bminSideLength"), \ ( (lambda A : np.max(np.diff(A, axis=1)) ), "bmaxSideLength"), \ ( (lambda A : np.sum(np.diff(A, axis=1)) ), "bsumSideLengths"), \ ] for thisFunctAndLabel in generalSummaryFunctionsAndLabelsForThem: theseValues = [thisFunctAndLabel[0](x) for x in self.getBoxes()] resultValue = self._getAnalysisResult(theseValues) specificLabel = labelForDomainSpecificStats + ":" + thisFunctAndLabel[ 1] for thisKey in resultValue: commandToExecute = \ "INSERT INTO QAStateValues ( QAStateUUID , fieldName, fieldValue) VALUES ('" + \ self.getID() + "', '" + (specificLabel + ":" + thisKey) + "', ? );" objDatabaseInterface.interfaceBleed_insertValuesForBlob(\ commandToExecute, [resultValue[thisKey]] ) objDatabaseInterface.commit() #^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^ #V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V~V # general statistics - i.e., those that may be easily useable across domains... #============================================================= labelForGeneralStats = labelBeginning + ":g" numberOfBoxes = len(self.internalDictionary["boxes"]) commandToExecute = \ "INSERT INTO QAStateValues ( QAStateUUID , fieldName, fieldValue) VALUES ('" + \ self.getID() + "', '" + (labelForGeneralStats + ":numberOfDataPoints") + "', ? );" objDatabaseInterface.interfaceBleed_insertValuesForBlob(\ commandToExecute, [numberOfBoxes] ) scalingFactors = np.diff(universeForBoxes, axis=1) # NOTE: below, we find the NORMALIZED side-lengths. Yes, this is normalized # even though the constant offset term (subtracting the minimal value) is not shown - those terms would # simply cancel when we compute the interval length.... getScaledSideLengths = \ (lambda A: (np.diff(A, axis=1) / scalingFactors)) labelForGeneralStats = labelForGeneralStats + ":normalizedInputBoxes" generalSummaryFunctionsAndLabelsForThem = [\ ( (lambda A : np.prod(getScaledSideLengths(A)) ), "bvolume"), \ ( (lambda A : np.min(getScaledSideLengths(A)) ), "bminSideLength"), \ ( (lambda A : np.max(getScaledSideLengths(A)) ), "bmaxSideLength"), \ ( (lambda A : np.sum(getScaledSideLengths(A)) ), "bsumSideLengths"), \ ] for thisFunctAndLabel in generalSummaryFunctionsAndLabelsForThem: theseValues = [ thisFunctAndLabel[0](x) for x in self.getRawInputDomainBoxes() ] resultValue = self._getAnalysisResult(theseValues) specificLabel = labelForGeneralStats + ":" + thisFunctAndLabel[1] for thisKey in resultValue: commandToExecute = \ "INSERT INTO QAStateValues ( QAStateUUID , fieldName, fieldValue) VALUES ('" + \ self.getID() + "', '" + (specificLabel + ":" + thisKey) + "', ? );" objDatabaseInterface.interfaceBleed_insertValuesForBlob(\ commandToExecute, [resultValue[thisKey]] ) objDatabaseInterface.commit() #^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^_^ return