Skip to content

Instantly share code, notes, and snippets.

View vaibhawvipul's full-sized avatar
💻
If you want to change the world, become a teacher

Vipul Vaibhaw vaibhawvipul

💻
If you want to change the world, become a teacher
View GitHub Profile
@vaibhawvipul
vaibhawvipul / gist:6ec7cad2a137c69a03e5ad6062ffcaab
Created March 1, 2019 10:48
BigQuery 101: All the Basics You Need to Know - Code for Velotio Blog Part - 2
CREATE MODEL `velotio_tutorial.sample_model`
OPTIONS(model_type='logistic_reg') AS
SELECT
IF(totals.transactions IS NULL, 0, 1) AS label,
IFNULL(device.operatingSystem, "") AS os,
device.isMobile AS is_mobile,
IFNULL(geoNetwork.country, "") AS country,
IFNULL(totals.pageviews, 0) AS pageviews
FROM
`bigquery-public-data.google_analytics_sample.ga_sessions_*`
@vaibhawvipul
vaibhawvipul / gist:5241f7123aa91c1e13b18838ee2ce531
Created March 1, 2019 10:35
BigQuery 101: All the Basics You Need to Know - Code for Velotio Blog
WITH question_answers_join AS (
SELECT *
, GREATEST(1, TIMESTAMP_DIFF(answers.first, creation_date, minute)) minutes_2_answer
FROM (
SELECT id, creation_date, title
, (SELECT AS STRUCT MIN(creation_date) first, COUNT(*) c
FROM `bigquery-public-data.stackoverflow.posts_answers`
WHERE a.id=parent_id
) answers
, SPLIT(tags, '|') tags
import csv
import random
import math
def loadDataset(filename, split):
training_data = []
test_data = []
with open(filename, 'rb') as csvfile:
lines = csv.reader(csvfile)
dataset = list(lines)
@vaibhawvipul
vaibhawvipul / README.md
Created March 27, 2018 14:53 — forked from avalcarce/README.md
Solving MountainCar-v0

Synopsis

This is a Deep Reinforcement Learning solution to some classic control problems. I've used it to solve MountainCar-v0 problem, CartPole-v0 and [CartPole-v1] (https://gym.openai.com/envs/CartPole-v1) in OpenAI's Gym. This code uses Tensorflow to model a value function for a Reinforcement Learning agent. I've run it with Tensorflow 1.0 on Python 3.5 under Windows 7.

Some of the hyperparameters used in the main.py script to solve MountainCar-v0 have been optained partly through exhaustive search, and partly via Bayesian optimization with Scikit-Optimize. The optimized hyperparameters and their values are:

  • Size of 1st fully connected layer: 198
  • Size of 2nd fully connected layer: 96
  • Learning rate: 2.33E-4
  • Period (in steps) for the update of the target network parameters as per the DQN algorithm: 999