This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python 3 program to build Bloom Filter | |
# Install mmh3 and bitarray 3rd party module first | |
# pip install mmh3 | |
# pip install bitarray | |
import math | |
import mmh3 | |
from bitarray import bitarray | |
class BloomFilter(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import traceback | |
from bloomfilter import BloomFilter | |
import jellyfish | |
edit_distance = 2 | |
tamil_unique_words_file_path = "tamilwordlist.txt" | |
bloom_filter_file_path = "tamil_bloom_filter.txt" | |
def read_tamil_words_listfile(tamil_unique_words_file_path): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
import tamil | |
import os | |
from bloomfilter import BloomFilter | |
# URL for Project Madurai | |
base_url = 'https://www.projectmadurai.org' | |
bloom_filter_file_path = "tamil_bloom_filter.txt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USER INPUT NODE | |
I can tell you Chuck Norris jokes that you can hear, even with your ears closed. | |
TOPIC SELECTOR NODE | |
Two topics 1) Greetings 2) Chuck Norris Jokes | |
Greetings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USER INPUT NODE | |
Welcome message: Hi! I can help you convert from one currency type to another. | |
TOPIC SELECTOR NODE | |
Greeting: | |
Hello | |
Hi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(X_train, y_train), (X_test, y_test) = mnist.load_data() | |
# plot 4 images as gray scale | |
plt.subplot(221) | |
plt.imshow(X_train[20], cmap=plt.get_cmap('gray')) | |
plt.subplot(222) | |
plt.imshow(X_train[23], cmap=plt.get_cmap('gray')) | |
plt.subplot(223) | |
plt.imshow(X_train[42], cmap=plt.get_cmap('gray')) | |
plt.subplot(224) | |
plt.imshow(X_train[54], cmap=plt.get_cmap('gray')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
os.environ['KERAS_BACKEND'] = 'tensorflow' | |
import keras | |
import matplotlib as plt | |
from keras.datasets import mnist | |
import matplotlib.pyplot as plt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0.468534325458 | |
0.464193701547 | |
0.459686450749 | |
0.454970093343 | |
0.450008466033 | |
0.444771502862 | |
0.439235147048 | |
0.433381398721 | |
0.42719846303 | |
0.42068094941 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#update weights | |
synapses_1 += l1.T.dot(l2_delta) | |
synapses_0 += l0.T.dot(l1_delta) | |
print "Output after training" | |
print l2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l1_error = l2_delta.dot(synapses_1.T) | |
l1_delta = l1_error*sigmoid(l1, derivative=True) |
NewerOlder