Skip to content

Instantly share code, notes, and snippets.

View djfan's full-sized avatar

Dongjie Fan djfan

  • NY, NY
View GitHub Profile
import inspect
import ast
from textwrap import dedent
import tensorflow as tf
def escape_op_name(name):
"""
It has to match with "^[A-Za-z0-9.][A-Za-z0-9_.\\-/]*$"
"""
@ayman
ayman / .hadoop_alias
Last active August 12, 2017 08:25
My friend Jake hates typing `hdfs dfs -` so he made these aliases. Enjoy!
alias happendToFile='hdfs dfs -appendToFile'
alias hcat='hdfs dfs -cat'
alias hchecksum='hdfs dfs -checksum'
alias hchgrp='hdfs dfs -chgrp'
alias hchmod='hdfs dfs -chmod'
alias hchown='hdfs dfs -chown'
alias hcopyFromLocal='hdfs dfs -copyFromLocal'
alias hcopyToLocal='hdfs dfs -copyToLocal'
alias hcount='hdfs dfs -count'
alias hcp='hdfs dfs -cp'
@joyrexus
joyrexus / README.md
Last active February 24, 2024 15:16
collapsible markdown

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@rtbs-dev
rtbs-dev / pmml_bayesnet.ipynb
Last active March 24, 2023 16:43
Bayesian Network Models in PyMC3 and NetworkX
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@4rzael
4rzael / main.md
Last active April 25, 2024 04:41
GIS with pySpark.
NOTE : Take a look at the comments below !

GIS with pySpark : A not-so-easy journey

Why would you do that ?

Today, many datas are geolocalised (meaning that they have a position in space). They're named GIS datas.

It's not rare that we need to do operations on those, such as aggregations, and there are many optimisations existing to do that.

@danijar
danijar / blog_tensorflow_sequence_labelling.py
Last active January 12, 2024 15:18
TensorFlow Sequence Labelling
# Example for my blog post at:
# http://danijar.com/introduction-to-recurrent-networks-in-tensorflow/
import functools
import sets
import tensorflow as tf
def lazy_property(function):
attribute = '_' + function.__name__
@danijar
danijar / blog_tensorflow_sequence_classification.py
Last active December 24, 2021 03:53
TensorFlow Sequence Classification
# Example for my blog post at:
# https://danijar.com/introduction-to-recurrent-networks-in-tensorflow/
import functools
import sets
import tensorflow as tf
def lazy_property(function):
attribute = '_' + function.__name__
@danijar
danijar / blog_tensorflow_scope_decorator.py
Last active January 17, 2023 01:58
TensorFlow Scope Decorator
# Working example for my blog post at:
# https://danijar.github.io/structuring-your-tensorflow-models
import functools
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
def doublewrap(function):
"""
A decorator decorator, allowing to use the decorator to be used without
@Cospel
Cospel / rbm_MNIST_test.py
Last active October 27, 2017 11:13 — forked from myme5261314/rbm_MNIST_test.py
RBM procedure using tensorflow
#http://blog.echen.me/2011/07/18/introduction-to-restricted-boltzmann-machines/
#https://www.tensorflow.org/versions/r0.7/api_docs/python/constant_op.html#random_uniform
import tensorflow as tf
import numpy as np
import input_data
import Image
from util import tile_raster_images
@ottokart
ottokart / nn.py
Last active August 27, 2021 05:52
3-layer neural network example with dropout in 2nd layer
# Tiny example of 3-layer nerual network with dropout in 2nd hidden layer
# Output layer is linear with L2 cost (regression model)
# Hidden layer activation is tanh
import numpy as np
n_epochs = 100
n_samples = 100
n_in = 10
n_hidden = 5