Skip to content

Instantly share code, notes, and snippets.

@KaiyangZhou
KaiyangZhou / Install NVIDIA Driver and CUDA.md
Created February 19, 2019 13:56 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
@KaiyangZhou
KaiyangZhou / knapsack.py
Last active February 12, 2022 17:21
Python Implementation of 0/1 Knapsack Algorithm Based on Dynamic Programming
import numpy as np
'''
------------------------------------------------
Use dynamic programming (DP) to solve 0/1 knapsack problem
Time complexity: O(nW), where n is number of items and W is capacity
------------------------------------------------
knapsack_dp(values,weights,n_items,capacity,return_all=False)
Input arguments:
@KaiyangZhou
KaiyangZhou / pg-pong.py
Created June 3, 2017 06:37 — forked from karpathy/pg-pong.py
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@KaiyangZhou
KaiyangZhou / install_and_using.md
Created May 4, 2017 05:50 — forked from sangheestyle/install_and_using.md
Install and using numba on mac

Install and using numba on mac

  • Mac version: 10.11.3
  • Python version: 3.5.1

Install

$ brew tap homebrew/versions
$ brew install llvm37