def create_conv_node(name): n = Node(name) n.add_op(Identity()) n.add_op(Conv1D(filter_size=3, num_filters=16)) n.add_op(Conv1D(filter_size=5, num_filters=16)) n.add_op(MaxPooling1D(pool_size=3, padding='same')) n.add_op(MaxPooling1D(pool_size=5, padding='same')) return n
def create_conv_node(name): n = VariableNode(name) n.add_op(Identity()) n.add_op(Conv1D(filter_size=3, num_filters=16)) n.add_op(MaxPooling1D(pool_size=3, padding='same')) n.add_op(Dense(10, tf.nn.relu)) n.add_op(Conv1D(filter_size=5, num_filters=16)) n.add_op(MaxPooling1D(pool_size=5, padding='same')) n.add_op(Dense(100, tf.nn.relu)) n.add_op(Conv1D(filter_size=10, num_filters=16)) n.add_op(MaxPooling1D(pool_size=10, padding='same')) n.add_op(Dense(1000, tf.nn.relu)) return n
def create_structure(input_shape=(2, ), output_shape=(1, ), *args, **kwargs): struct = AutoOutputStructure(input_shape, output_shape, regression=False) n1 = ConstantNode(op=Conv1D(filter_size=20, num_filters=128), name='N') struct.connect(struct.input_nodes[0], n1) n2 = ConstantNode(op=Activation(activation='relu'), name='N') struct.connect(n1, n2) n3 = ConstantNode(op=MaxPooling1D(pool_size=1, padding='same'), name='N') struct.connect(n2, n3) n4 = ConstantNode(op=Conv1D(filter_size=10, num_filters=128), name='N') struct.connect(n3, n4) n5 = ConstantNode(op=Activation(activation='relu'), name='N') struct.connect(n4, n5) n6 = ConstantNode(op=MaxPooling1D(pool_size=10, padding='same'), name='N') struct.connect(n5, n6) n7 = ConstantNode(op=Flatten(), name='N') struct.connect(n6, n7) n8 = ConstantNode(op=Dense(units=200), name='N') struct.connect(n7, n8) n9 = ConstantNode(op=Activation(activation='relu'), name='N') struct.connect(n8, n9) n10 = ConstantNode(op=Dropout(rate=0.1), name='N') struct.connect(n9, n10) n11 = ConstantNode(op=Dense(units=20), name='N') struct.connect(n10, n11) n12 = ConstantNode(op=Activation(activation='relu'), name='N') struct.connect(n11, n12) n13 = ConstantNode(op=Dropout(rate=0.1), name='N') struct.connect(n12, n13) return struct
def create_conv_block(input_nodes): # first node of block n1 = Node('N1') for inpt in input_nodes: n1.add_op(Connect(cell.graph, inpt, n1)) # second node of block n2 = Node('N2') n2.add_op(Conv1D(filter_size=5, num_filters=2)) block = Block() block.add_node(n1) block.add_node(n2) block.add_edge(n1, n2) return block
def add_conv_op_(node): node.add_op(Identity()) node.add_op(Conv1D(filter_size=3, num_filters=8)) node.add_op(Conv1D(filter_size=4, num_filters=8)) node.add_op(Conv1D(filter_size=5, num_filters=8)) node.add_op(Conv1D(filter_size=6, num_filters=8))