Skip to content

Instantly share code, notes, and snippets.

View OneRaynyDay's full-sized avatar

Ray Zhang OneRaynyDay

View GitHub Profile
@OneRaynyDay
OneRaynyDay / gist:fb4dfae0fd88ae519550
Created November 24, 2014 01:25
Optimization Game Plan
graph - have graph of each individual color
greedy algorithm
Start at the lowest result from # of orbs calculated w/ the distance - hardest combo to make.
longest path algorithm - djikstra's backward
find localized solutions as the answer goes towards the solution
LBHRLB
HRRGRR
BDHHGR
HRHDRG
"""Softmax."""
scores = [2.0, 1.0, 0.1]
import numpy as np
def softmax(x):
"""Compute softmax values for each sets of scores in x."""
#We want to find the e^y_i/(sum(e^y)
''' Long way
import numpy as np
import module
SEEDED = False # for .not_seeded. For .seeded, this is True.
NUM_TRIALS = 10
if SEEDED:
module.init()
for i in range(NUM_TRIALS):
@OneRaynyDay
OneRaynyDay / Makefile
Created February 20, 2020 19:45
Tensorflow C++ API sandboxing
# Change BASE_DIR accordingly.
BASE_DIR=/Users/ray_zhang/home/tensorflow/bazel-bin
INC=-I$(BASE_DIR)/tensorflow/include -I$(BASE_DIR)/tensorflow -I$(BASE_DIR)/tensorflow/include/src/
LIB=-L$(BASE_DIR)/tensorflow -rpath $(BASE_DIR)/tensorflow -ltensorflow_cc -ltensorflow_framework
FLAGS=-std=c++14
main: deserialize.cpp
g++ $(FLAGS) $(INC) $(LIB) -o deserialize $^
@OneRaynyDay
OneRaynyDay / clustering.py
Created May 7, 2022 21:59
3-Approxmation Clustering Algorithm
from scipy.stats import random_correlation
from typing import List, Set
import seaborn as sb
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (10, 10)
# --- Specifying correlation matrix distribution and shape ---
rng = np.random.default_rng()