Programming

Hosting a Flask App on Heroku

Following the steps here –> https://realpython.com/flask-by-example-part-1-project-setup/ I managed to deploy my python flask app in Heroku. from flask import Flask app = Flask(name) @app.route(‘/’) def hello(): return "Hello World!" @app.route(‘/<name>’) def hello_name(name): return "Hello {}!".format(name) if name == ‘main‘: app.run() You may visit the following link –>https://jirong-stage.herokuapp.com/ & add a suffix to it. Example https://jirong-stage.herokuapp.com/jirong & this will return Hello jirong! Possibilites are immense! I can easily create APIs or host dashboard here.

Sampling With Replacement Through First Principles

Sampling with replacement Hello! It’s me once again attempting to explain things from first principles - a term popularized by Elon Musk. I will use some psudeo code - on sampling with replacement for weights - to aid my explanation. Earlier in the week, I attempted to write a simple function from scratch but I gave up after realising that it will take me more than 15 mins! Difficulties lies in the multiple switch statements in defining the intervals.

Building a decision tree algorithm from scratch

Building a decision tree from scratch Sometimes to truly understand and internalise an algorithm, it’s always useful to build from scratch. Rather than relying on a module or library written by someone else. I’m fortunate to be given the chance to do it in 1 of my assignments for decision trees. From this exercise, I had to rely on my knowledge on recursion, binary trees (in-order traversal) and object oriented programming.

Martingale Strategy - Double Down

Martingale Strategy In this post, I will simulate a martingale strategy in Roulette’s context to highlight the potential risks associated with this strategy. Double down! That’s essentially the essence of it. Here’s a simple explanation of the strategy, The croupier spins the ball. If it’s red you win the amount you bet, black you lose the same amount If you win, you continue to bet the same amount (same as your 1st bet amount) If you lose, you double your bet amount And if your accumulated winnings hits a certain amount, you stop and leave the casino So how would the strategy fare?

How to Create a Python Environment in Ubuntu or any Debian-based system

Often, certain projects or classes involving python require a set of modules/packages for the code to work. 1 solution is to create a Python Environment dedicated to that project. First set up a folder, and include a .yml file with the specific modules and environment that you wish to install. Here is an example (env.yml), name: env channels: !!python/tuple - !!python/unicode ‘defaults’ dependencies: - nb_conda=2.2.0=py27_0 - python=2.7.13=0 - cycler=0.10.0 - functools32=3.

Translating Ernest Chan Kalman Filter Strategy Matlab and Python Code Into R

Translating Ernest Chan Kalman Filter Strategy Matlab and Python Code Into R I’m really intrigued by Ernest Chan’s approach in Quant Trading. Often in the retail trading space, what ‘gurus’ preach often sounds really dubious. But Ernest Chan is different. He’s sincere, down-to-earth and earnest (meant to be a pun here). In my first month of deploying algo trading strategies, I focus mainly on mean-reversion strategies - paricularly amongst pairs.

Summary of My Computational Photography Module From Georgia Tech Computer Science Masters

Colorization

Colorization The following is a high level project pipeline of my Computational Photography Colorization report. The project scope involves minimizing a quadratic cost function. An artist would only need to make a few colour scribble on a grey photograph and the algorithm will automatically populate the entire photograph with the associated colours. 1.Input: I first read in the image using imread function. 2.Find the difference: Next I compute the difference between the marked and grey scale image.

Architecture and Process Flow for My Algorithmic Trading

Seam Carving

Snippet of my Seam Carving Report from my Msc Computer Science Georgia Tech’s Computational Photography module Besides removing of streams, we can also add streams. We identify k streams for removal and duplicate by averaging the left and right neighbours. The computation of these averages is done by convolving the following matrix with the images’ colour channels. kernel = np.array([[0, 0, 0], [0.5, 0, 0.5], [0, 0, 0]]) In the implementation of my scaling_up algorithm, I first remove k streams (depending on ratio set by user) and recorded the coordinates and cumulative energy values of the original picture in each removal.