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
from word_features import extract | |
import pickle | |
import sys | |
try: | |
f = open('classifier.pickle', 'rb') | |
except FileNotFoundError: | |
print('Classifier not found') | |
exit() |
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
from nltk.classify import NaiveBayesClassifier | |
from nltk.corpus import movie_reviews | |
from word_features import extract | |
import pickle | |
import nltk.classify.util | |
""" | |
Only downloads the movie reviews database |
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
def extract(words): | |
return dict([(word, True) for word in words]) |
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 tensorflow as tf | |
import sys | |
image_path = sys.argv[1] | |
image_data = tf.gfile.FastGFile(image_path, 'rb').read() | |
label_lines = [line.rstrip() for line in tf.gfile.GFile('labels.txt')] | |
with tf.gfile.FastGFile('graph.pb', 'rb') as f: | |
graph_def = tf.GraphDef() | |
graph_def.ParseFromString(f.read()) |
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
from keras.models import load_model | |
import numpy | |
model = load_model('wine-model.h5') | |
predict_me = numpy.array([ | |
[6.6, 0.16, 0.4, 1.5, 0.044, 48, 143, 0.9912, 3.54, 0.52, 12.4], # Good | |
[5.2, 0.405, 0.15, 1.45, 0.038, 10, 44, 0.99125, 3.52, 0.4, 11.6] # Bad | |
]) |
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
from keras.models import load_model | |
import numpy | |
dataset = numpy.loadtxt("wine-data.csv", delimiter=";") | |
input = dataset[:, 0:11] | |
output = dataset[:, 11] | |
# since the data comes in a scale of 0 to 10, this is needed to we get a simple true or false | |
output = [(round(each / 10)) for each in output] |
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
from keras.models import Sequential | |
from keras.layers import Dense | |
import numpy | |
dataset = numpy.loadtxt("wine-data.csv", delimiter=";") | |
input = dataset[:, 0:11] | |
output = dataset[:, 11] | |
# since the data comes in a scale of 0 to 10, this is needed to we get a simple true or false |
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
from keras.models import load_model | |
import numpy | |
dataset = numpy.loadtxt("diabetes.csv", delimiter=",") | |
input = dataset[:,0:8] | |
output = dataset[:,8] | |
model = load_model('diabetes.h5') |
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
from keras.models import load_model | |
import numpy | |
model = load_model('diabetes.h5') | |
predict_me = numpy.array([[1, 126, 60, 0, 0, 30.1, 0.349, 47]]) | |
predictions = model.predict(predict_me) | |
rounded = [round(output[0]) for output in predictions] |
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
from keras.models import Sequential | |
from keras.layers import Dense | |
import numpy | |
# load dataset | |
dataset = numpy.loadtxt("diabetes.csv", delimiter=",") | |
# split into input and ouput | |
input = dataset[:,0:8] | |
output = dataset[:,8] |
NewerOlder