Skip to content

Instantly share code, notes, and snippets.

View SoloSynth1's full-sized avatar
💨
Moved to GitLab

Orix Au Yeung SoloSynth1

💨
Moved to GitLab
View GitHub Profile
@SoloSynth1
SoloSynth1 / PCA_Part_1.ipynb
Created May 11, 2023 07:24
principal-component-analysis
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SoloSynth1
SoloSynth1 / monty-hall-monte-carlo.py
Last active February 20, 2023 07:16
Solving the Monty Hall Problem by using Monte Carlo Method
# This is a short script to use Monte Carlo method to estimate
# the win rate of different strategies taken in the famous Monty Hall Problem -
# Because my wife had a hard time understanding the rationale behind it ;)
import random
rounds = 1_000_000
def main():
@SoloSynth1
SoloSynth1 / gist:7f855a6556fb0379e4aa58673c561950
Created November 20, 2021 07:03
TF Object Detection API scripts
# train-test partition
python3 ../../scripts/preprocessing/partition_dataset.py -i images -o images -x
# compile TFRecords - Train
python3 ../../scripts/preprocessing/generate_tfrecord.py --xml_dir=images/train --labels_path=annotations/label_map.pbtxt --output_path=annotations/train.record --csv_path=annotations/train.csv
# compile TFRecords - Test
python3 ../../scripts/preprocessing/generate_tfrecord.py --xml_dir=images/test --labels_path=annotations/label_map.pbtxt --output_path=annotations/test.record --csv_path=annotations/test.csv
# actual training
@SoloSynth1
SoloSynth1 / raysgd_demo.py
Last active October 3, 2021 18:14
RaySGD Distributed Training & Tuning Demo (Tensorflow/Keras) - IMDb text classification w/ multi-head attention Transformer
import argparse
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import numpy as np
import ray
from ray import tune
from ray.util.sgd.tf.tf_trainer import TFTrainer, TFTrainable
curl -X POST http://localhost:5555/api/experimental/dags/{your-dag-name-here}/dag_runs -H 'Cache-Control: no-cache' -H 'Content-Type: application/json' -d '{"conf": ""}'