示例#1
0
    validation_data_provider = BatchDataProvider(X=X_valid,
                                                 Y=Y_valid,
                                                 lengths=lengths_valid)

    ## BUILD THE MODEL

    model = CSM(
        layers=[
            WordEmbedding(dimension=embedding_dimension,
                          vocabulary_size=vocabulary_size),
            SentenceConvolution(n_feature_maps=n_feature_maps,
                                kernel_width=kernel_width,
                                n_channels=1,
                                n_input_dimensions=embedding_dimension),
            SumFolding(),
            KMaxPooling(k=pooling_size * 2),
            Bias(n_input_dims=embedding_dimension / 2,
                 n_feature_maps=n_feature_maps),
            Tanh(),

            # Softmax(
            #     n_classes=n_classes,
            #     n_input_dimensions=420),
            SentenceConvolution(n_feature_maps=n_feature_maps,
                                kernel_width=3,
                                n_channels=n_feature_maps,
                                n_input_dimensions=embedding_dimension / 2),
            KMaxPooling(k=pooling_size),
            Bias(n_input_dims=embedding_dimension / 2,
                 n_feature_maps=n_feature_maps),