Sunday, January 28, 2024

Trombone

One thing I've added to my routine is practicing trombone, just maybe ten minutes a day. (I'll time myself today to see how long I'm actually going for.)

Currently, I'm working through "40 Progressive Etudes for Trombone" by Sigmund Hering plus some scales and a medley of Christmas music.

I'm looking forward to starting to take a look at Arban's famous method for slide and valve trombone and baritone (bass clef) soon, which I found based on the recommendation of a longterm family friend and trombone player. He also pointed out that he enjoys playing the Bach cello concertos, transcribed to trombone. I'm taking inspiration from this performance of them: SUITE Nº1 IN G MAJOR (BWV 1007) J. S. BACH FOR TROMBONE ALONE BY JAVIER YERA (though I'm so far off from this level at the moment). I think this portion of it will be a good place for me to start: Cello Suite No.1 in G major BWV1007:I Präludium For Trombone.

I'm looking forward to making progress, to learning from the larger trombone community. Another thing I'm looking at is Douglas Yeo's FAQ.

If you have any favorite resources for improving your trombine skills, I'd love to hear about them. Thank you.

Saturday, January 27, 2024

"The Five Parts of Every Business"

I'm enjoying The Personal MBA, though I don't think I'll be able to finish it before I have to return it to the library.
Roughly defined, a business is a repeatable process that:
  1. Creates and delivers something of value ...
  2. That other people want or need ...
  3. At a price they're willing to pay ...
  4. In a way that satisfies the customer's needs and expectations ...
  5. So that the business brings in enough Profit to make it worthwhile for the owners to continue operation.
One point that caught my attention: while it means more competition, the fact that other businesses are succeeding in an area at least means that there is demand for what they're producing. So, if there's existing competition, it at least indicates there are some potential customers, avoiding one pitfall.

Sunday, December 17, 2023

Boethius defined chance in terms of epistemic uncertainty

Reading Boethius's "The Consolation of Philosophy", I've been repeatedly struck by Boethius showing knowledge of ideas that I'd wrongly assumed only had a later origin. This reminds me that we should not underestimate the "ancients", although he is far closer to us than the true ancients, two hundred thousand years or more before.

Here he is defining "chance" in terms of epistemic uncertainty, after nodding to arguments from the ancients that there are not chance occurrences:
We can define chance, then, as the unexpected result of causes that come together of things that were done for some other purpose.
(Emphasis added by me.) He credits Aristotle's Physics as the source of this idea.

Another example that surprised me was him mentioning the problem of evil -- how can an omnipotent God allow there to be evil in the world? His answer, at least in the translation I'm looking at from David Slavin, is that "evil is nothing".

This other translation captures the same thing:
‘Nobody would care to doubt that God is all-powerful?’
‘At any rate, no sane man would doubt it.’
‘Being, then, all-powerful, nothing is beyond His power?’ ‘Nothing.’
‘Can, then, God do evil?’
‘No.’
‘Then evil is nothing, since it is beyond His power, and nothing is beyond His power?’
He also makes many arguments that at least have the flavor of an ontological argument. Again from that other translation:
‘Now consider,’ she continued, ‘where it lies. The universally accepted notion of men proves that God, the fountain-head of all things, is good. For nothing can be thought of better than God, and surely He, than whom there is nothing better, must without doubt be good. Now reason shews us that God is so good, that we are convinced that in Him lies also the perfect good. For if it is not so, He cannot be the fountain-head; for there must then be something more excellent, possessing that perfect good, which appears to be of older origin than God: for it has been proved that all perfections are of earlier origin than the imperfect specimens of the same: wherefore, unless we are to prolong the series to infinity, we must allow that the highest Deity must be full of the highest, the perfect good. But as we have laid down that true happiness is perfect good, it must be that true happiness is situated in His Divinity.’

The reasoning in these sections bothers me because it seems to trade on different meanings of the terms involved: "existence", "nothingness", etc. I don't recall Boethius addressing this possibility, but he does recognize the counterintuitivenss of some of his conclusions; he notes that if you cannot question either the premises or the reasoning from them, then you should accept the conclusion, which is something I heard one of my intro philosophy professors say around 1500 years later.

Do we need to define evil away to "remain Stoic"? I think there are good practical reasons to remain calm in the face of adversity, as in the Serenity Prayer:
God, grant me the serenity to accept the things I cannot change,
the courage to change the things I can,
and the wisdom to know the difference.
Before reading Boethius, I had a vague idea Stoicism was about this, maintaining calm despite the circumstances, a practical philosophy. But Boethius ultimately seems to be arguing that there is no such thing as adversity? To me, that weakens the appeal a bit.

Wednesday, October 11, 2023

Meow

"Meow", said the old cat. Her yellow green eyes were dulled with age, but still they glowed as the setting sun caught them. Steadfast, the eyes of a warrior, of a leader. The wind rustled the tufts of hair at the tops of her ears and her whiskers but the rest of her short gray fur moved only as her steely muscles rippled beneath. She turned to the younger at her side, a tabby. "Meow meow, meow meow meow," he said, his head bowing slightly. "Meow!" she said. "Meow?" he replied. "Meow, meow, meow, meow. Meow meow", she said. The tabby nodded and walked off into the forest. "Meow", the old warrior cat said to herself. Meow indeed.

Sunday, July 16, 2023

Boston Housing dataset ethical/data quality problems

I'm not sure if I've worked with the Boston Housing dataset previously -- maybe? -- but I've at least heard of it, I'm pretty sure. I was surprised to see this message when attempting to import it today as part of working through "TensorFlow 2.0: Quick Start Guide":
ImportError: 
`load_boston` has been removed from scikit-learn since version 1.2.

The Boston housing prices dataset has an ethical problem: as
investigated in [1], the authors of this dataset engineered a
non-invertible variable "B" assuming that racial self-segregation had a
positive impact on house prices [2]. Furthermore the goal of the
research that led to the creation of this dataset was to study the
impact of air quality but it did not give adequate demonstration of the
validity of this assumption.

The scikit-learn maintainers therefore strongly discourage the use of
this dataset unless the purpose of the code is to study and educate
about ethical issues in data science and machine learning.

In this special case, you can fetch the dataset from the original
source::

    import pandas as pd
    import numpy as np

    data_url = "http://lib.stat.cmu.edu/datasets/boston"
    raw_df = pd.read_csv(data_url, sep="\s+", skiprows=22, header=None)
    data = np.hstack([raw_df.values[::2, :], raw_df.values[1::2, :2]])
    target = raw_df.values[1::2, 2]

Alternative datasets include the California housing dataset and the
Ames housing dataset. You can load the datasets as follows::

    from sklearn.datasets import fetch_california_housing
    housing = fetch_california_housing()

for the California housing dataset and::

    from sklearn.datasets import fetch_openml
    housing = fetch_openml(name="house_prices", as_frame=True)

for the Ames housing dataset.

[1] M Carlisle.
"Racist data destruction?"


[2] Harrison Jr, David, and Daniel L. Rubinfeld.
"Hedonic housing prices and the demand for clean air."
Journal of environmental economics and management 5.1 (1978): 81-102.

It was interesting reading M Carlisle's investigation and the scikit-learn discussion around it. I also found Fairlearn's discussion enlightening. (I One other surprise for me in this is the existence of an Ames, Iowa, housing dataset. Article describing it: Ames, Iowa: Alternative to the Boston Housing Data as an End of Semester Regression Project [PDF] (2011) by the original creator of the dataset, Dean DeCock.

Saturday, June 3, 2023

Drawing with all the fonts available in Colab

import os
import unicodedata

from PIL import Image, ImageDraw, ImageFont

def get_fonts(default_size=20):
  fonts = []
  for root, dirs, files in os.walk('/usr/share/fonts/truetype/'):
    for file in files:
      if file.endswith('.ttf'):
        fonts.append(ImageFont.truetype(os.path.join(root, file), default_size))
  return fonts

TARGET_ALPHABET = [c for c in map(chr, range(128))
  if not unicodedata.category(c).startswith('C')]
FONTS = get_fonts()
WIDTH = 500

out = Image.new("RGB", (WIDTH, 2000), (255, 255, 255))

d = ImageDraw.Draw(out)

x = 0
y = 0
for c in TARGET_ALPHABET:
  for font in FONTS:
    d.text((x, y), c, font=font, fill=(0, 0, 0))
    left, top, right, bottom = d.textbbox((x, y), c, font=font)
    if right < WIDTH - 20:
      x = right + 5
    else:
      x = 0
      y = bottom + 5
out.show()
UNICODE CHARACTER DATABASE: General_Category Values ImageDraw.textbbox

Monday, May 29, 2023

Handwriting recognition links

One project I'm curious: handwriting recognition. Dumping a list of resources I've come across: I guess there must be some more recent stuff that I'm missing? Recent articles citing the Graves and Schmidhuber article.

Wednesday, May 3, 2023

Jokes from Sidney Morgenbesser

I'm enjoying reading David Edmonds's Parfit: A Philosopher and His Mission to Save Morality. Recounting Parfit's time in New York with a Harkness Fellowship, the author squeezes in some jokes from the philosopher Sidney Morgenbesser, new to me, who was teaching at Columbia. The jokes:
  • On pragmatism: "It's all very well in theory, but it doesn't work in practice."
  • J.L. Austin is saying that while there are double negatives to express a positive -- "she is not uninteresting" -- there are no double positives to express a negative. Morgenbesser interrupts: "Yeah, yeah".
  • Eating dinner at a restaurant, the waitress says there are two choices for pie: apple or blueberry. Morgenbesser says he'll have the apple. The waitress comes back a minute later to say there's actually a third choice, cherry. Morgenbesser: "In that case, I'll have the blueberry pie."

Saturday, February 11, 2023

Impressed with sympy

I know this doesn't even come close to scratching the surface of what's possible with it, but I was impressed with this little interaction with sympy already:
import sympy
from sympy import Rational

a = sympy.symbols('a')
e = Rational(13, 4) * (5 - 6 * a) - Rational(1, 4) * (Rational(1, 3) * a - 3)
print(sympy.latex(e))
$$22 - \frac{307 a}{12}$$

Tuesday, August 30, 2022

The Bitter Lesson

The Bitter Lesson by Richard Sutton

One thing that should be learned from the bitter lesson is the great power of general purpose methods, of methods that continue to scale with increased computation even as the available computation becomes very great. The two methods that seem to scale arbitrarily in this way are search and learning.

The second general point to be learned from the bitter lesson is that the actual contents of minds are tremendously, irredeemably complex; we should stop trying to find simple ways to think about the contents of minds, such as simple ways to think about space, objects, multiple agents, or symmetries. All these are part of the arbitrary, intrinsically-complex, outside world. They are not what should be built in, as their complexity is endless; instead we should build in only the meta-methods that can find and capture this arbitrary complexity. Essential to these methods is that they can find good approximations, but the search for them should be by our methods, not by us. We want AI agents that can discover like we can, not which contain what we have discovered. Building in our discoveries only makes it harder to see how the discovering process can be done.

Are there any lessons for the social sciences here? E.g., should economists give up on trying to find general laws and instead create systems to find those patterns, perhaps in incomprehensible form? Of course, a machine found model doesn't need to be incomprehensible... even with an ordinary least squares regression model, the parameters are still "found by the machine". Also, Sutton is speaking to AI researchers so the "bitter lesson" may not be for everyone. Even if speech synthesis based on linguistic expertise wasn't competitive, linguistics is still useful, right?

Sunday, August 14, 2022

Cochrane Collaboration and Campbell Collaboration

I'm enjoying reading Tim Harford's book The Data Detective. (Looking at that link for it, I'm amused to see a blurb from Malcolm Gladwell on the cover; if I didn't already know Harford, I would consider this a negative endorsement.) Harford mentions two groups I'd like to keep in mind, both of which aim to do systemic reviews of the literature:
  • Cochrane: "Cochrane is for anyone interested in using high-quality information to make health decisions... We are an independent, diverse, global organization that collaborates to produce trusted synthesized evidence, make it accessible to all, and advocate for its use."
  • Campbell Collaboration: "The Campbell Collaboration is an international social science research network that produces high quality, open and policy-relevant evidence syntheses, plain language summaries and policy briefs."
What other groups are there like these, doing systematic reviews to try to produce consensus docs? (I know it's pretty common to see survey articles in journals.)

Tuesday, January 4, 2022

Factorial in Forth

I've been enjoying playing with Forth. Here's what I came up with to implement factorial:
: fact dup 2 < if drop 1 else dup 1 - recurse * then ;

3 fact . 6  ok
6 fact . 720  ok
This looks pretty similar to the example code here: http://progopedia.com/example/factorial/253/.

Tuesday, June 8, 2021

Finding years on which December 5th was a Friday in Squeak

2000 to: 2021 do: [ :year |
  date := Date year: year month: 12 day: 5.
  date weekday == #Friday ifTrue:
    [Transcript print: year; cr; flush.]
]
Answer:
2003
2008
2014

Wednesday, May 19, 2021

Playing with Racket: random lines GIF

I'm enjoying playing with Racket. Takes me back to some good old college days writing Scheme, but I don't think creating a GIF was so easy in any of the Scheme systems we were using then. (Which ecosystem -- language + standard libraries -- provides the nicest environment for making animated GIFs?)
#lang racket

(require mrlib/gif)
(require racket/draw)

(define (random-lines-bitmap width height line-count)
  (let* ([target (make-bitmap width height)]
         [dc (new bitmap-dc% [bitmap target])])
    (begin
      (send dc draw-rectangle
       0 0   ; Top-left at (0, 10), 10 pixels down from top-left
       (- width 1) (- height 1))
      (for ([i line-count])
        (send dc draw-line
              (random width) (random height)
              (random width) (random height)))
      target)))

(define (write-random-lines-gif width height line-count frame-count filename)
  (write-animated-gif
   (for/list ([i frame-count])
     (random-lines-bitmap width height line-count))
   10
   filename
   #:loop? true))

(write-random-lines-gif 300 200 50 10 "random-lines.gif")

"Why Concatenative Programming Matters"

I enjoyed reading Why Concatenative Programming Matters. I'd like to do more with Factor sometime. Is it still under active development? I see that new binaries are still getting generated for it anyway.
"https://evincarofautumn.blogspot.com/2012/02/why-concatenative-programming-matters.html" >url http-get* length
...
261104
(This seems to work. Am I leaving extra stuff on the stack?)

Sunday, May 16, 2021

Clojure!

https://clojure.org/guides/getting_started emphasizes Homebrew, but MacPorts has it too. I also had to install OpenJDK too. I think for me, the minimal set of commands could have looked like:
sudo port install clojure +rlwrap
sudo port install openjdk11
clj
user=> (+ 1 1)
2
Woohoo!

Friday, April 30, 2021

Notes on "Mythical Man-Month": "Why did the tower of Babel fall?"

Brooks uses the metaphor of the tower of Babel to again emphasize the importance of but difficulties with communication. Several times he (again) brings up problems with potential superlinear complexity owing to to the number of pairs or other groupings of workers.

"How, then, shall teams communicate with one another? In as many ways as possible: Informally... Meetings... Workbook..."

He goes into some detail talking about the workbook and processing surrounding it. It seems that online documentation has solved a lot of his problems though introducing new ones. He talks about the introduction of microfiche to avoid printing out an unwieldy number of pages, but notes the lack of ability to add notes as an important limitation. We have that problem too with online docs -- no margins to write in as an individual reader. Also, support for showing diffs in documentation is pretty uneven.

"If there are n workers on a project, there are (n^2 - n)/2 interfaces across which there may be communication, and there are potentially almost 2^n teams within which coordination must occur. The purpose of organization is to reduce the amount of communication and coordination necessary... The means by which communication is obviated are division of labor and specialization of function."

A tree structure arises because no one should have two bosses. Brooks also notes even if the reporting change forms a tree, plenty of communication outside this is necessary, forming a network.

Necessaries for any subtree:
  1. a mission
  2. a producer
  3. a technical director or architect
  4. a schedule
  5. a division of labor
  6. interface definitions among the parts

What Brooks calls "producer" sounds very much just like "manager" or "technical lead manager" to me while "technical director" seems to map very closely to what I think I know of as "tech lead". (In the group I'm reading this with, we had noted some of the roles he described seemed a bit unfamiliar, but here even if the names are different, the roles seem pretty close to what we have today.)

He talks about three possible arrangements between producer and director: same person, director reports to producer, or producer reports to director. He illustrates the 3rd arrangement, which I don't believe I've seen in real life, with a quote from Heinlein's "The Moon is a Harsh Mistress" where the top engineer is happy to be freed from management work.

Monday, April 19, 2021

x XOR y MOD 9 in R

I was curious what it would take to reproduce the x XOR y MOD 9 plot in R. Here's one way:
x <- 1:32
image(x, x,
    outer(x, x, FUN=function(x, y) (bitwXor(x, y) %% 9) != 0),
    col=c("white", "black"))
dev.copy(png, "~/x_xor_y_mod_9.png")
dev.off()
Looking forward to creating a GIF using the gifski package, which I learned about from gganimate, which I'm also looking forward to exploring.

Friday, April 16, 2021

Zooming out on x ^ y % 9

Having some more fun in Autoplot:
I was happy to be able to move the GIF-writing code into a library. (To keep things neat, I added a "contrib" directory in the "jython" directory within "autoplot_data". Looking at sys.path, you can see that "autoplot_data/jython" is included.)
import os.path

from contrib import gif
from org.das2.graph import DasColorBar

def xor_mod_plot(n=256, modulus=9):
  x = outerProduct(linspace(0, n - 1, n), ones(n))
  plot(gt(bitwiseXor(x, transpose(x))  % modulus, zeros(n, n)), renderType='nnSpectrogram>rebin=noInterpolate')
  dom.plots[0].setColortable(DasColorBar.Type.GRAYSCALE)

gif.plot_to_gif(xor_mod_plot, os.path.expanduser('~/autoplot/xor_mod_zoom.gif'),
   keyword_params=[dict(n=n) for n in range(4, 513)],  delay_tenths_sec=5)
The only change required for the GIF-writing code was the call to writeToBufferedImage(), which required an explicit import when used within the library:
from org import autoplot
...
        images.append(autoplot.ScriptContext.writeToBufferedImage())