Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_task_runner(self):
run(self.filename)
def run(filename):
print('Loading dataset...')
data = load_dataset(filename)
x_train, x_test, y_train, ids = train_test_split(data)
print('Building vectorizer and model...')
vectorizer = build_vectorizer()
clf = build_model()
print('Vectorizing...')
x_train = vectorizer.fit_transform(x_train)
x_test = vectorizer.transform(x_test)
print('Fitting...')
clf.fit(x_train, y_train)
print('Predicting...')
y_pred = clf.predict(x_test)
y_prob = clf.predict_proba(x_test)
y_prob = np.max(y_prob, axis=-1)
print('Saving...')
data = make_output(data, ids, y_pred, y_prob)
def run(filename):
print('Loading dataset...')
data = load_dataset(filename)
x_train, x_test, y_train, ids = train_test_split(data)
print('Building vectorizer and model...')
vectorizer = build_vectorizer()
clf = build_model()
print('Vectorizing...')
x_train = vectorizer.fit_transform(x_train)
x_test = vectorizer.transform(x_test)
print('Fitting...')
clf.fit(x_train, y_train)
print('Predicting...')
y_pred = clf.predict(x_test)
y_prob = clf.predict_proba(x_test)
clf = build_model()
print('Vectorizing...')
x_train = vectorizer.fit_transform(x_train)
x_test = vectorizer.transform(x_test)
print('Fitting...')
clf.fit(x_train, y_train)
print('Predicting...')
y_pred = clf.predict(x_test)
y_prob = clf.predict_proba(x_test)
y_prob = np.max(y_prob, axis=-1)
print('Saving...')
data = make_output(data, ids, y_pred, y_prob)
save_dataset(data, filename)
def run(filename):
print('Loading dataset...')
data = load_dataset(filename)
x_train, x_test, y_train, ids = train_test_split(data)
print('Building vectorizer and model...')
vectorizer = build_vectorizer()
clf = build_model()
print('Vectorizing...')
x_train = vectorizer.fit_transform(x_train)
x_test = vectorizer.transform(x_test)
print('Fitting...')
clf.fit(x_train, y_train)
print('Predicting...')
y_pred = clf.predict(x_test)
y_prob = clf.predict_proba(x_test)
y_prob = np.max(y_prob, axis=-1)
print('Saving...')
data = make_output(data, ids, y_pred, y_prob)
save_dataset(data, filename)
print('Vectorizing...')
x_train = vectorizer.fit_transform(x_train)
x_test = vectorizer.transform(x_test)
print('Fitting...')
clf.fit(x_train, y_train)
print('Predicting...')
y_pred = clf.predict(x_test)
y_prob = clf.predict_proba(x_test)
y_prob = np.max(y_prob, axis=-1)
print('Saving...')
data = make_output(data, ids, y_pred, y_prob)
save_dataset(data, filename)
def run(filename):
print('Loading dataset...')
data = load_dataset(filename)
x_train, x_test, y_train, ids = train_test_split(data)
print('Building vectorizer and model...')
vectorizer = build_vectorizer()
clf = build_model()
print('Vectorizing...')
x_train = vectorizer.fit_transform(x_train)
x_test = vectorizer.transform(x_test)
print('Fitting...')
clf.fit(x_train, y_train)
print('Predicting...')
y_pred = clf.predict(x_test)
y_prob = clf.predict_proba(x_test)
y_prob = np.max(y_prob, axis=-1)
def main():
application = tornado.web.Application([
url(r'/', IndexHandler, name='index'),
],
template_path=os.path.join(BASE_DIR, 'templates'),
static_path=os.path.join(BASE_DIR, 'static'),
)
http_server = tornado.httpserver.HTTPServer(application)
port = int(os.environ.get('PORT', 8080))
http_server.listen(port)
tornado.ioloop.IOLoop.instance().start()