def getUnclassifiedDataToClassify(self, nonInteractive, unclassifiedDataArray): if (nonInteractive == True): parsedUnclassifiedData = unclassifiedDataArray elif (nonInteractive == False): unclassifiedDataPath = input( "Please enter the path to a file with data, which should be classified: " ) unclassifedDataParser = Parser() unclassifedDataParser.setDestination(unclassifiedDataPath) unclassifedDataParser.processData() # Retrieve data back parsedUnclassifiedData = unclassifedDataParser.getDataArray() # Set necessary input arrays (inputValues, inputLabels ) = self.setInputForClassificationScaled(parsedUnclassifiedData) return (inputValues, inputLabels)
# Initialize and run parser parser = Parser() #parser.askForAverageCalculation() # Asks whether new average values should be calculated # Ask whether an NN should be trained nnTraining = input( "Do you want to train a neural network for step recognition? (y(es) / n(o)): " ) if (nnTraining == "yes") or (nnTraining == "y"): NN = NeuralNetwork() #NN.listen = True #inArray = NN.listenOnPort() #parser.processDataArray(inArray) parser.askForDestination() parser.processData() # Retrieve parsed data as an array parsedData = [] parsedData = parser.getDataArray() # Set X (input step data values) and y (input labels corresponding to the step data values) X = [] y = [] (X, y) = NN.setInputForClassificationScaled(parsedData) # Start new training print("Training: Started ...\n", end=" ") t = time.process_time() loss = 1.0 # initialize loss trainingCounter = 0