<jupyter_start><jupyter_text>NLTK Neural Network<jupyter_code>X_train = data_set[['cosine', 'cosineClean', 'fuzzRatio','fuzzPartial','fuzzTokenSort',
                    'fuzzTokenSet', 'SMratio','SMratioClean', 'jaccard']]
y_train = data_set[['is_duplicate_y']]
X_test = test_data[['cosine', 'cosineClean', 'fuzzRatio','fuzzPartial','fuzzTokenSort',
                    'fuzzTokenSet', 'SMratio','SMratioClean', 'jaccard']]
y_test = []
X_train = X_train.fillna(0)
X_test = X_test.fillna(0)
predictions = neuralNetwork.createNeuralNetwork(X_train, X_test, y_train, y_test, (45,30,15,10,5), 10000, kind = 'classification')
predictions
submission = pd.concat([test_data.iloc[:, 0], pd.DataFrame(predictions)], axis=1, sort=False)
submission.head()
submission.to_csv('result/submission.csv', index = False)<jupyter_output><empty_output><jupyter_text>Tensorflow Neural Network<jupyter_code>X_train = data_set[['cosine', 'cosineClean', 'fuzzRatio','fuzzPartial','fuzzTokenSort',
                    'fuzzTokenSet', 'SMratio','SMratioClean', 'jaccard']]
y_train = data_set[['is_duplicate_y']]
X_test = test_data[['cosine', 'cosineClean', 'fuzzRatio','fuzzPartial','fuzzTokenSort',
                    'fuzzTokenSet', 'SMratio','SMratioClean', 'jaccard']]
y_test = []
X = data_set[['cosine', 'cosineClean', 'fuzzRatio','fuzzPartial','fuzzTokenSort',
                    'fuzzTokenSet', 'SMratio','SMratioClean', 'jaccard']].values
y = data_set[['is_duplicate_y']].values

X_train = X_train.fillna(0)
X_test = X_test.fillna(0)
# Importing the Keras libraries and packages
import keras
from keras.models import Sequential
from keras.layers import Dense
#Initializing Neural Network
classifier = Sequential()
import tensorflow as tf
# Adding the input layer and the first hidden layer
classifier.add(Dense(output_dim = 15, init = 'uniform', activation = 'relu', input_dim = 9))
# Adding the second hidden layer
classifier.add(Dense(output_dim = 20, init = 'uniform', activation = 'relu'))
# Adding the second hidden layer
classifier.add(Dense(output_dim = 10, init = 'uniform', activation = 'relu'))
# Adding the second hidden layer
classifier.add(Dense(output_dim = 5, init = 'uniform', activation = 'relu'))
# Adding the output layer
classifier.add(Dense(output_dim = 1, init = 'uniform', activation = 'sigmoid'))
classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
classifier.fit(X, y, batch_size = 10, nb_epoch = 20)
classification = classifier.predict(X_test.values)
outcome = np.array([1 if x > 0.30 else 0 for x in classification ])
submission = pd.concat([test_data.iloc[:, 0], pd.DataFrame(outcome)], axis=1, sort=False)
submission.to_csv('result/submission.csv', index = False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1517467248908297, 'fraction_numerical': 0.01455604075691412, 'mean_word_length': 6.215223097112861, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '548686', 'license': 'Apache-2.0', 'n_tokens_mistral': 978, 'n_tokens_neox': 931, 'n_words': 193, 'path': 'TF-IDF.ipynb', 'repo_name': 'JessyBosman1/KaggleQpairs', 'size': '2748'}