Logo J. Marcus Hughes
    Logo Inverted Logo
    • Posts
    • Digital Garden
    • Welcome
    • Anomaly Detection
      • Atypicality
      • Axis-aligned RRCF artifacts
      • goal of nonstationary
      • Mostly noise training
    • Assorted Coding
      • flood
      • inclusion check
      • mood tracking
      • np.sum speeds in Cython
      • sliding puzzles
      • truncating numbers
      • Ulam Warburton
    • Assorted ML
      • fake APOD generation
      • TSS vs f1
    • Denoising
      • denoising autoencoder
    • Paper Reading
      • State of Astro-informatics
    • Photography
      • New Instagram
    • Solar
      • AIA temporal coloring
      • automatic solar YouTube
      • EUI artifact
      • HEK thematic maps
      • SUVI calendar heatmap
      • Thematic Map Paper
    • Teaching
      • peer review activity
    Hero Image
    Efficient Inclusion Check

    Problem Statement I recently stumbled upon a cute problem where you have three sets of numbers $$A, B, C \subseteq \lbrace 0, \dots, n \rbrace.$$ You want to answer if there exists $$a \in A, b \in B \text{ such that } c = a + b \in C.$$ It’s a conceptually simple problem: are there two numbers from the first two sets that sum to a number in the third set?

    March 25, 2022 Read
    Hero Image
    Mood tracking: first plots

    For some time now, I’ve been using the app Daylio to track my mood. It allows me to rate my mood on a 5 point scale: awful, bad, meh, good, and rad. I can also put pictures, notes, or log what activities are related to that mood at the same time. It’s quite a nifty little app. I just decided to download the data and start examining it more critically. I hope to build a small set of tools to automatically process all the data and interpret conclusions.

    February 6, 2022 Read
    Hero Image
    Sliding puzzles: my beginning

    I recently have become interested in sliding puzzles. You can read all about them on Wikipedia. In undergraduate AI, I was ask to implement a solver for the rush-hour game, a version of a sliding puzzle. I forgot all about it until recently when I was preparing an AI lesson to teach for Code Connects, a coding education non-profit. I stumbled upon the 8-puzzle. Difficulty of AI At first, it seemed pretty simple, and I thought an AI would do easy on it for bigger boards, but I was sorely mistaken.

    January 27, 2022 Read
    Hero Image
    Comparison of speed of np.sum in Cython

    I was curious how much the overhead of np.sum impacted Cython code. That is, should you write your own sum method that loops or use np.sum? So, I wrote up a little test definition of the two approaches, as shown below: import numpy as np cimport numpy as np cpdef double sum_np(np.ndarray[double] a): return np.sum(a) cpdef double sum_loop(double[:] a) nogil: cdef size_t i, I cdef double total = 0.0 I = a.

    May 11, 2021 Read
    Hero Image
    Truncate to specified number of significant figures

    It’s a simple request. You have a number, e.g. 1.25, and want to truncate it to say 2 significant figures. You specifically need to truncate instead of rounding, i.e. you need to get 1.2 instead of 1.3. How do you do that quickly in Python? Check out this code snippet: from math import log10, floor import decimal decimal.getcontext().rounding = decimal.ROUND_DOWN def truncate_sig(x, sig=2): x = float(x) # make sure it's a float or decimal throws an error if x == 0: # can't take log10(0) so just return 0 return 0 elif x <= 0: # if it's negative, determine sigfigs of positive and multiply by -1 return -1 * truncate_sig(np.

    May 10, 2021 Read
    Hero Image
    Flood

    I stumbled upon a game called Flood. It’s a simple enough game. You start with a grid of random colors. Then, you change the color of contiguous region formed from the upper left corner until you have flooded the entire grid with one color. I wrote some code and have been tinkering around some. The most naive solver is a breadth first search. So, I did that. Below you see the solution length for a grid size of varying size with only three colors.

    September 16, 2019 Read
    Hero Image
    Ulam–Warburton automaton inquiry

    The Ulam-Warburton automaton is a simple growing pattern. See Wikipedia or this great Numberphile video for more information. For the more technical see this paper too. Ulam-Warburton animation from Wikipedia I was curious what you’d get under various other versions of it, using the same basic rule of “turn on cells with exactly one neighbor” but with a tweak. For example, what happens if you a cell turns off after being activated for a few cycles?

    April 24, 2019 Read
    Navigation
    • About
    Contact me:
    • hughes.jmb@gmail.com

    Toha Theme Logo Toha
    © 2023 Copyright James Marcus Hughes
    Powered by Hugo Logo