weight_function = None if args.random: print( "Weight of links between nodes will be set to random values from range [{}; {}]".format( args.random[0], args.random[1] ) ) weight_function = lambda: random.uniform(args.random[0], args.random[1]) elif args.zeros: print("Weight of links between nodes will be set to 0.") weight_function = lambda: 0.0 network = NetParser(args.network).parse(weight_function) if args.vector_limits: input_vector = RandomInputVectorFactory.create_new( args.vector_limits[0], args.vector_limits[1], network.layers[0].get_nodes_ids() ) print( "Generated vector with values from range [{}; {}]:\n{}".format( args.vector_limits[0], args.vector_limits[1], input_vector ) ) else: input_vectors = [InputVectorParser(vector).parse() for vector in args.vector_file] if args.kohonen: network.learning_process(input_vectors, args.coefficient, args.coefficient_half_life, args.turns) if args.backpropagation: network.backpropagation_learn(input_vectors, args.coefficient, args.turns) else: print("Network response is:") print(network.calculte_answer(input_vectors[0]))