This file contains 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
CREATE OR REPLACE MODEL `ecommerce.classification_model` | |
OPTIONS | |
( | |
model_type='logistic_reg', | |
labels = ['will_buy_on_return_visit'] | |
) | |
AS | |
#standardSQL | |
SELECT |
This file contains 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
#!/usr/bin/env python | |
""" | |
Copyright Google Inc. 2016 | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
This file contains 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 Agent(): | |
"""Interacts with and learns from the environment.""" | |
def __init__(self, state_size, action_size, random_seed, memory): | |
"""Initialize an Agent object. | |
Params | |
====== | |
state_size (int): dimension of each state | |
action_size (int): dimension of each action |
This file contains 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
# Simple function approximators | |
def hidden_init(layer): | |
fan_in = layer.weight.data.size()[0] | |
lim = 1. / np.sqrt(fan_in) | |
return (-lim, lim) | |
class Actor(nn.Module): | |
"""Actor (Policy) Model.""" |
This file contains 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 Agent(): | |
"""Interacts with and learns from the environment.""" | |
def __init__(self, state_size, action_size, random_seed): | |
"""Initialize an Agent object. | |
Params | |
====== | |
state_size (int): dimension of each state | |
action_size (int): dimension of each action |
This file contains 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 hidden_init(layer): | |
fan_in = layer.weight.data.size()[0] | |
lim = 1. / np.sqrt(fan_in) | |
return (-lim, lim) | |
class Actor(nn.Module): | |
"""Actor (Policy) Model.""" | |
def __init__(self, state_size, action_size, seed, fc1_units=400, fc2_units=300): |
This file contains 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 Agent(): | |
def __init__(self, state_size, action_size, seed): | |
self.state_size = state_size | |
self.action_size = action_size | |
self.seed = random.seed(seed) | |
# Q-Network | |
self.qnetwork_local = QNetwork(state_size, action_size, seed).to(device) | |
self.qnetwork_target = QNetwork(state_size, action_size, seed).to(device) |
This file contains 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 QNetwork(nn.Module): | |
"""Actor (Policy) Model.""" | |
def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=64): | |
super(QNetwork, self).__init__() | |
self.seed = torch.manual_seed(seed) | |
self.fc1 = nn.Linear(state_size, fc1_units) | |
self.fc2 = nn.Linear(fc1_units, fc2_units) | |
self.fc3 = nn.Linear(fc2_units, action_size) |
This file contains 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
#!/bin/bash | |
# Set environment variables | |
export DRONE_SERVER_HOST=${DRONE_SERVER_HOST} # i.e drone.mydomain.io | |
export DRONE_RPC_SECRET=${DRONE_RPC_SECRET} # i.e correct-horse-batter-staple | |
export DRONE_GITHUB_CLIENT_ID=${DRONE_GITHUB_CLIENT_ID} # i.e di2450-3huchuy-fdhu378-k24556892 | |
export DRONE_GITHUB_CLIENT_SECRET=${DRONE_GITHUB_CLIENT_SECRET} # i.e dx19x3-3o44h0y-id6uf7h-q4fg5hkp2 |
This file contains 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
--- | |
- hosts: droneci | |
become: true | |
vars: | |
ansible_python_interpreter: "/usr/bin/env python3" | |
environment: | |
DRONE_SERVER_HOST: '{{ lookup("env", "DRONE_SERVER_HOST") }}' | |
DRONE_RPC_SECRET: '{{ lookup("env", "DRONE_RPC_SECRET") }}' | |
DRONE_GITHUB_CLIENT_ID: '{{ lookup("env", "DRONE_GITHUB_CLIENT_ID") }}' | |
DRONE_GITHUB_CLIENT_SECRET: '{{ lookup("env", "DRONE_GITHUB_CLIENT_SECRET") }}' |
NewerOlder