clean up imports (#230)

This commit is contained in:
Robert Nishihara
2016-07-08 12:46:47 -07:00
committed by Philipp Moritz
parent 191909dd93
commit 5dd411546d
16 changed files with 81 additions and 105 deletions
+1 -2
View File
@@ -1,6 +1,5 @@
import numpy as np
import ray
import ray.services as services
import os
import functions
@@ -11,7 +10,7 @@ epochs = 100
worker_dir = os.path.dirname(os.path.abspath(__file__))
worker_path = os.path.join(worker_dir, "worker.py")
services.start_ray_local(num_workers=num_workers, worker_path=worker_path)
ray.services.start_ray_local(num_workers=num_workers, worker_path=worker_path)
best_params = None
best_accuracy = 0
+3 -3
View File
@@ -38,12 +38,12 @@ def train_cnn(params, epochs):
sess.run(train_step, feed_dict={x: batch[0], y: batch[1], keep_prob: keep})
if i % 100 == 0: # checks if accuracy is low enough to stop early every set number of epochs
train_ac = accuracy.eval(feed_dict={x: batch[0], y: batch[1], keep_prob: 1.0})
if train_ac < 0.25: # Accuracy threshold is on a application to application basis.
if train_ac < 0.25: # Accuracy threshold is on a application to application basis.
totalacc = accuracy.eval(feed_dict={x: mnist.validation.images, y: mnist.validation.labels, keep_prob: 1.0})
return totalacc
totalacc = accuracy.eval(feed_dict={x: mnist.validation.images, y: mnist.validation.labels, keep_prob: 1.0})
return totalacc
return totalacc.astype("float64")
def cnn_setup(x, y, keep_prob, lr, stddev):
first_hidden = 32
second_hidden = 64
+1 -2
View File
@@ -1,6 +1,5 @@
import argparse
import ray
import ray.worker as worker
import functions
@@ -13,4 +12,4 @@ if __name__ == "__main__":
args = parser.parse_args()
ray.connect(args.scheduler_address, args.objstore_address, args.worker_address)
ray.register_module(functions)
worker.main_loop()
ray.worker.main_loop()