Getting Setup: Follow the instruction on https://gym.openai.com/docs
git clone https://github.com/openai/gym
cd gym
pip install -e . # minimal install
Basic Example using CartPole-v0:
import numpy as np | |
import os | |
class NeuralNetwork: | |
def __init__(self): | |
# Our training data | |
self.X = np.array([[0, 0, 1], [1, 1, 1], [1, 0, 1], [0, 1, 1]]) | |
self.y = np.transpose(np.array([[0, 1, 1, 1]])) | |
# Seed random number generator to produce the same |
class iter_shuffle_batch_tensors(Iterator): | |
"""Combine `iter_tensors_slice` and `iter_shuffle_batch_range`. | |
Args: | |
See `iter_tensors_slice` and `iter_shuffle_batch_range`. | |
Output: | |
See `iter_shuffle_batch_range`. | |
""" |
Getting Setup: Follow the instruction on https://gym.openai.com/docs
git clone https://github.com/openai/gym
cd gym
pip install -e . # minimal install
Basic Example using CartPole-v0:
#!/usr/bin/env python | |
## | |
# This example shows how to apply an vtkImageData texture to an sphere | |
# vtkPolyData object. | |
# Note: Input jpg file can be located in the VTKData repository. | |
# | |
# @author JBallesteros | |
## |
import tensorflow as tf | |
import numpy as np | |
from google.protobuf import json_format | |
import json | |
np.random.seed(12345) | |
def tensorflow_get_weights(): | |
""" |
# Author: Kyle Kastner | |
# License: BSD 3-Clause | |
# Implementing http://mnemstudio.org/path-finding-q-learning-tutorial.htm | |
# Q-learning formula from http://sarvagyavaish.github.io/FlappyBirdRL/ | |
# Visualization based on code from Gael Varoquaux gael.varoquaux@normalesup.org | |
# http://scikit-learn.org/stable/auto_examples/applications/plot_stock_market.html | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.collections import LineCollection |
##VGG16 model for Keras
This is the Keras model of the 16-layer network used by the VGG team in the ILSVRC-2014 competition.
It has been obtained by directly converting the Caffe model provived by the authors.
Details about the network architecture can be found in the following arXiv paper:
Very Deep Convolutional Networks for Large-Scale Image Recognition
K. Simonyan, A. Zisserman
In the following gist I'm going to guide you through the process of installing and booting an entire linux distribution with full desktop environment just like you would have with a classical VM, but with much better performance and much worse isolation :)
The reason why I did this was mainly because it's cool, but also to test new distros with decent graphics performance without actually booting them on my PC.
If you "try this at home" just keep in mind a container is not as secure as a VM, and some of the option we're going to explore will weaken container isolation from "a bit risky" to "totally unsafe" depending on what you choose.
Also, we're going to use systemd-nspawn for containers as it's probably the best fit for our use case and can also boot any linux partition without needing to prepare an apposite container image.
Less go!
"""Script to illustrate usage of tf.estimator.Estimator in TF v1.3""" | |
import tensorflow as tf | |
from tensorflow.examples.tutorials.mnist import input_data as mnist_data | |
from tensorflow.contrib import slim | |
from tensorflow.contrib.learn import ModeKeys | |
from tensorflow.contrib.learn import learn_runner | |
# Show debugging output |