예제 #1
0
        _, f1 = model.predict(testX, batch_size=1024)
        testX = np.concatenate([f1, testX], axis=1)
        Y = clf.predict(testX)
        utils.submit(Y)
    else:
        testX = utils.load_test_data(submit)
        Y = np.array(
            list(
                map(
                    idx2word.get,
                    np.argmax(model.predict(testX, batch_size=1024)[0],
                              axis=-1))))
        utils.submit(Y)
elif svm:
    X, Y = utils.load_train_data(data_path)
    Y = Y.astype(int)
    trainX = np.delete(X, [1, 6, 11], axis=1)
    _, f1 = model.predict(trainX, batch_size=1024)
    X[:, 0] = f1.ravel()
    clf_svm(X, Y, save_model=svm)
else:
    model.load_weights(model_path)
    #print(f'\n\033[32;1mTraining score: {model.evaluate(trainX, trainY, verbose=0)}')
    #print(f'Validation Score: {model.evaluate(validX, validY, verbose=0)}\033[0m')
    print(
        f'\n\033[32;1mTraining score: {model.evaluate(trainX, [trainY, missing_col], verbose=0, batch_size=1024)}'
    )
    print(
        f'Validation Score: {model.evaluate(validX, [validY, valid_missing_col], verbose=0, batch_size=1024)}\033[0m'
    )
예제 #2
0
            testX[:, 0:1], f2, testX[:, 1:5], f7, testX[:, 5:9], f12, testX[:,
                                                                            9:]
        ],
                               axis=1)
        Y = clf.predict(testX)
        utils.submit(Y)
    else:
        out = tf.cast(out * 2, tf.int32)
        submit_model = Model(I, out)
        utils.submit(submit_model, submit)
elif svm:
    X, Y = utils.load_train_data(data_path)
    Y = Y.astype(int)
    trainX = np.delete(X, [1, 6, 11], axis=1)
    _, f2, f7, f12 = model.predict(trainX, batch_size=1024)
    X[:, 1] = f2.ravel()
    X[:, 6] = f7.ravel()
    X[:, 11] = f12.ravel()
    clf_svm(X, Y, seed, save_model=svm)
else:
    trainX, trainY = utils.load_train_data(data_path)
    trainY = trainY.astype(int)
    trainX, validX, trainY, validY = utils.train_test_split(trainX,
                                                            trainY,
                                                            seed=seed)
    missing_col, valid_missing_col = trainX[:, [1, 6, 11]], validX[:,
                                                                   [1, 6, 11]]
    trainX = np.delete(trainX, [1, 6, 11], axis=1)
    validX = np.delete(validX, [1, 6, 11], axis=1)
    print(
        f'\n\033[32;1mTraining score: {model.evaluate(trainX, [trainY, missing_col[:, 0], missing_col[:, 1], missing_col[:, 2]], verbose=0)}'