This file contains hidden or 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
| {"format": "graph-model", "generatedBy": "2.0.0-beta1", "convertedBy": "TensorFlow.js Converter v1.2.2.1", "modelTopology": {"node": [{"name": "statefulpartitionedcall_args_96", "op": "Placeholder", "attr": {"dtype": {"type": "DT_RESOURCE"}, "shape": {"shape": {"unknownRank": true}}}}, {"name": "statefulpartitionedcall_args_95", "op": "Placeholder", "attr": {"shape": {"shape": {"unknownRank": true}}, "dtype": {"type": "DT_RESOURCE"}}}, {"name": "statefulpartitionedcall_args_91", "op": "Placeholder", "attr": {"dtype": {"type": "DT_RESOURCE"}, "shape": {"shape": {"unknownRank": true}}}}, {"name": "statefulpartitionedcall_args_90", "op": "Placeholder", "attr": {"dtype": {"type": "DT_RESOURCE"}, "shape": {"shape": {"unknownRank": true}}}}, {"name": "statefulpartitionedcall_args_85", "op": "Placeholder", "attr": {"shape": {"shape": {"unknownRank": true}}, "dtype": {"type": "DT_RESOURCE"}}}, {"name": "statefulpartitionedcall_args_84", "op": "Placeholder", "attr": {"shape": {"shape": {"unknownRank": true}}, "dtype": |
This file contains hidden or 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 tensorflow.contrib.eager as tfe | |
| import matplotlib.pyplot as plt | |
| from io import BytesIO | |
| from PIL import Image | |
| import requests | |
| import numpy as np |
This file contains hidden or 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 rollout(self, w, render): | |
| """ | |
| Plays one episode to `max_num_steps` or a terminal state, given a weight vector w. | |
| Returns a scalar of the reward sum of the episode. | |
| """ | |
| self._update_network(w) | |
| observation = self.env.reset() |
This file contains hidden or 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 train(self, render = False): | |
| """ | |
| Given an initial distribution vector of w_i, compute a new distribution | |
| vector via the cross-entropy method. | |
| Returns a policy network and stores performance history as `perf_hist` | |
| """ | |
| tf.initialize_all_variables().run() |
This file contains hidden or 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
| class SoftmaxLinearModel(object): | |
| def __init__(self, | |
| sess, | |
| num_features, | |
| name = "SoftmaxLinear"): | |
| self.sess = sess | |
| with tf.variable_scope(name): |
This file contains hidden or 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
| class LinearModel(object): | |
| def __init__(self, | |
| sess, | |
| num_features, | |
| name = "BinaryLinear"): | |
| self.sess = sess | |
| with tf.variable_scope(name): |
This file contains hidden or 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
| # Gym params | |
| EXPERIMENT_DIR = './cartpole-experiment-1' | |
| if __name__ == "__main__": | |
| np.random.seed(0) | |
| env = gym.make('CartPole-v0') | |
| env.monitor.start(EXPERIMENT_DIR, force=True) | |
| num_features = env.observation_space.shape[0] |
This file contains hidden or 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
| package models | |
| import java.util.Random | |
| import breeze.linalg.{SparseVector, DenseVector} | |
| import breeze.numerics.{round, exp} | |
| case class DataPoint(featureVector: DenseVector[Double], label: Double) | |
| // TODO: add defaults |
This file contains hidden or 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
| (1 to 100).foreach { x => | |
| if (x % 3 == 0 && x % 5 ==0) println("CracklePop") | |
| else if (x % 3 == 0) println("Crackle") | |
| else if (x % 5 == 0) println("Pop") | |
| else println(x) | |
| } |
This file contains hidden or 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
| campaign_id | creative_id | creative_url | |
|---|---|---|---|
| 1 | 814 | catpictures.us/images/gallery/uploads/cat/catpicture-555.jpg | |
| 2 | 200 | www.jpl.nasa.gov/opportunities/images/earth_sci.jpg | |
| 3 | 651 | www.jpl.nasa.gov/images/dawn/20150825/pia19631-16.jpg | |
| 4 | 896 | catpictures.us/images/gallery/uploads/cat/catpicture-581.jpg | |
| 5 | 336 | catpictures.us/images/gallery/uploads_big/cat/catpicture-543.jpg | |
| 6 | 243 | catpictures.us/images/gallery/uploads/cat/catpicture-520.jpg | |
| 7 | 434 | www.jpl.nasa.gov/spaceimages/images/wallpaper/PIA19653-640x350.jpg | |
| 8 | 724 | www.jpl.nasa.gov/edu/images/news/habitable_worlds.jpg | |
| 9 | 798 | www.jpl.nasa.gov/edu/images/home/intern.jpg |
NewerOlder