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
in_training_mode = tf.placeholder(tf.bool) | |
hidden = tf.keras.layers.Dense(n_units, | |
activation=None)(X) # no activation function, yet | |
batch_normed = tf.keras.layers.BatchNormalization()(hidden, training=in_training_mode) | |
output = tf.keras.activations\ | |
.relu(batch_normed) # ReLu is typically done after batch normalization | |
# optimizer code here … | |
extra_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS) |
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 sys | |
reload(sys) # Reload does the trick! | |
sys.setdefaultencoding('UTF8') |
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
pipeline_id: 2 | |
model_training: | |
model_args: | |
generations: 300 | |
population_size: 50 | |
verbosity: 2 | |
max_time_mins: 80 | |
model: tpot.TPOTClassifier | |
extract_features: | |
column_id: example_id |
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 inspect | |
import pandas.io.sql as psql | |
def parametrized(dec): | |
def layer(*args, **kwargs): | |
""" | |
Wrapper for creating plpython functions. Argument types are provided in the docstring | |
:param conn: Psycopg connection object |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
from pyspark.sql.types import StructType | |
def max_time(df): | |
df['Time'] = pd.to_datetime(df['Time']) | |
return str(df.Time.max()) | |
def apply_to_group(group_col, fxn): | |
# @spark_udf(IntegerType()) | |
# def _apply_fxn(struct_col): |
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
<!DOCTYPE html> | |
<html> | |
<head><meta charset="utf-8" /> | |
<title>sql_magic_API2</title><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> | |
<style type="text/css"> | |
/*! | |
* | |
* Twitter Bootstrap |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 argparse | |
import threading | |
import pandas as pd | |
import pandas.io.sql as psql | |
from IPython.core.display import display, HTML, Image, Javascript | |
from IPython.core.magic import register_cell_magic, register_line_cell_magic, register_line_magic, cell_magic, magics_class | |
from IPython.core.magic import Magics, magics_class, cell_magic, line_magic | |
try: |
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
from threading import Thread | |
import time | |
from IPython.core.display import display, HTML, Image | |
import sql_magic | |
def print_hello(): | |
print 'hello world' | |
def notify_complete(del_time, return_name, return_shape): | |
pretty_time = time.strftime('%I:%M:%S %p %Z') |