# Phil 11.15.19

7:00 – ASRC GOES

• Dissertation – starting the discussion section
• I’m thinking about objective functions and how individual and group objectives work together, particularly in extreme conditions.
• In extreme situations, the number of options available to an agent or group is diminished. There may be only one move apparently available in a chess game. A race car at the limits of adhesion has only one path through a turn. A boxer has a tiny window to land a blow. As the floodwaters rise, the range of options diminish. In a tsunami, there is only one option – run.
• Here’s a section from article 2 of the US Military Code of Conduct (from here):
• Surrender is the willful act of members of the Armed Forces turning themselves over to enemy forces when not required by utmost necessity or extremity. Surrender is always dishonorable and never allowed. When there is no chance for meaningful resistance, evasion is impossible, and further fighting would lead to their death with no significant loss to the enemy, members of Armed Forces should view themselves as “captured” against their will versus a circumstance that is seen as voluntarily “surrendering.”
• If a machine is trained for combat, will it have learned the concept of surrender? According to the USCoC, no, surrender is never allowed. A machine trained to “win”, like Google’s Alpha Go, do not learn to resign. That part has to be explicitly coded in (from Wired):
• According to David Silver, another DeepMind researcher who led the creation of AlphaGo, the machine will resign not when it has zero chance of winning, but when its chance of winning dips below 20 percent. “We feel that this is more respectful to the way humans play the game,” Silver told me earlier in the week. “It would be disrespectful to continue playing in a position which is clearly so close to loss that it’s almost over.”
• Human organizations, like armys and companies are a kind of superhuman intelligence, made up of human parts with their own objective functions. In the case of a company, that objective is often to maximise shareholder value (NYTimes by Milton Friedman):
• But the doctrine of “social responsibility” taken seriously would extend the scope of the political mechanism to every human activity. It does not differ in philosophy from the most explicitly collectivist doctrine. It differs only by professing to believe that collectivist ends can be attained without collectivist means. That is why, in my book “Capitalism and Freedom,” I have called it a “fundamentally subversive doctrine” in a free society, and have said that in such a society, “there is one and only one social responsibility of business – to use its resources and engage in activities designed to increase its profits so long as it stays within the rules of the game, which is to say, engages in open and free competition without deception fraud.”
• When any kind of population focuses singly on a particular goal, it creates shared social reality. The group aligns with the goal and pursues it. In the absence of the awareness of the environmental effects of this orientation, it is possible to stampede off a cliff, or shape the environment so that others deal with the consequences of this goal.
• It is doubtful that many people deliberately choose to be obese. However, markets and the profit motive have resulted in a series of innovations, ranging from agriculture to aisles of high-fructose corn syrup-based drinks at the local supermarket. The logistics chain that can create and sell a 12oz can of brand-name soda for about 35 cents is a modern miracle, optimized to maximize income for every link in the chain. But in this case, the costs of competition have created an infinite supply of heavily marketed empty calories. Even though we are aware at some level that we should rarely – if ever – have one of these beverages, they are consumed by the billions
• The supply chain for soda is a form of superintelligence, driven by a simple objective function. It is resilient and adaptive, capable of dealing with droughts, wars, and changing fashion. It is also contributing to the deaths of approximately 300,000 Americans annually.
• How is this like combat? Reflexive vs. reflective. Low-diversity thinking are a short-term benefit for many organizations, they enable first-mover advantage, which can serve to crowd out more diverse (more expensive) thinking. More here…

# Phil 11.14.19

7:00 – 3:30 ASRC GOES

• Dissertation – Done with Human Study!
• Evolver
• Work on parameter passing and function storing
• You can use the * operator before an iterable to expand it within the function call. For example:
timeseries_list = [timeseries1 timeseries2 ...]
r = scikits.timeseries.lib.reportlib.Report(*timeseries_list)
• Here’s the running code with variable arguments
def plus_func(v1:float, v2:float) -> float:
return v1 + v2

def minus_func(v1:float, v2:float) -> float:
return v1 - v2

def mult_func(v1:float, v2:float) -> float:
return v1 * v2

def div_func(v1:float, v2:float) -> float:
return v1 / v2

if __name__ == '__main__':
func_array = [plus_func, minus_func, mult_func, div_func]

vf = EvolveAxis("func", ValueAxisType.FUNCTION, range_array=func_array)
v1 = EvolveAxis("X", ValueAxisType.FLOAT, parent=vf, min=-5, max=5, step=0.25)
v2 = EvolveAxis("Y", ValueAxisType.FLOAT, parent=vf, min=-5, max=5, step=0.25)

for f in func_array:
result = vf.get_random_val()
print("------------\nresult = {}\n{}".format(result, vf.to_string()))
• And here’s the output
------------
result = -1.0
func: cur_value = div_func
X: cur_value = -1.75
Y: cur_value = 1.75
------------
result = -2.75
func: cur_value = plus_func
X: cur_value = -0.25
Y: cur_value = -2.5
------------
result = 3.375
func: cur_value = mult_func
X: cur_value = -0.75
Y: cur_value = -4.5
------------
result = -5.0
func: cur_value = div_func
X: cur_value = -3.75
Y: cur_value = 0.75
• Now I need to get this to work with different functions with different arg lists. I think I can do this with an EvolveAxis containing a list of EvolveAxis with functions. Done, I think. Here’s what the calling code looks like:
# create a set of functions that all take two arguments
func_array = [plus_func, minus_func, mult_func, div_func]
vf = EvolveAxis("func", ValueAxisType.FUNCTION, range_array=func_array)
v1 = EvolveAxis("X", ValueAxisType.FLOAT, parent=vf, min=-5, max=5, step=0.25)
v2 = EvolveAxis("Y", ValueAxisType.FLOAT, parent=vf, min=-5, max=5, step=0.25)

# create a single function that takes no arguments
vp = EvolveAxis("random", ValueAxisType.FUNCTION, range_array=[random.random])

# create a set of Axis from the previous function evolve args
axis_list = [vf, vp]
vv = EvolveAxis("meta", ValueAxisType.VALUEAXIS, range_array=axis_list)

# run four times
for i in range(4):
result = vv.get_random_val()
print("------------\nresult = {}\n{}".format(result, vv.to_string()))
• Here’s the output. The random function has all the decimal places:
------------
result = 0.03223958125899473
meta: cur_value = 0.8840652389671935
------------
result = -0.75
meta: cur_value = -0.75
------------
result = -3.5
meta: cur_value = -3.5
------------
result = 0.7762888191296017
meta: cur_value = 0.13200324934487906
• Verified that everything still works with the EvolutionaryOptimizer. Now I need to make sure that the new mutations include these new dimensions

• I think I should also move TF2OptimizationTestBase to TimeSeriesML2?
• Starting Human Compatible

# Phil 11.12.19

7:00 – 4:00 ASRC GOES

• Dissertation – Human study discussion
• “Degrees of Freedom” are different from “dimensions”. Dimensions, as used in machine learning, mean a single parameter that can be varied, discretely or continuously. Degrees of freedom define a continuous space that can contain things that are not contained in the dimensions. Latitude and Longitude do not define the globe. They serve as a way to show relationships between regions on the globe.
• How news media are setting the 2020 election agenda: Chasing daily controversies, often burying policy
• Our topic analysis of ~10,000 news articles on the 2020 Democratic candidates, published between March and October in an ideological diverse range of 28 news outlets, reveals that political coverage, at least this cycle, tracks with the ebbs and flows of scandals, viral moments and news items, from accusations of Joe Biden’s inappropriate behavior towards women to President Trump’s phone call with Ukraine. (A big thanks to Media Cloud.)
• Neat visualization – a heatmap plus a mean. I’d like to try adding things like variance to this. From Large scale and information effects on cooperation in public good games. Looks like the Seaborn library might be able to do this.

• Evolver – more GPU allocation and threading
• Updating EvolutionaryOptimizer
• Added enums, which meant that I had to handle enum key values in my ExcelUtils class
• Updated the TimeSeriesML2 whl
• Started folding gpu management into PyBullet. Making sure that everything still works first… It does!
• Ok, back to TimeSeriesML2 to make nested genomes
• Added a parent/child relationship to EvolveAxis so that it’s possible to a top-level parent (self.parent == None) to step down the tree of all the children to get the new appropriate values. These will need to be assembled into an argument string. Figure that part out tomorrow.
• Predicting – load and use models in real time

# Phil 11.8.19

7:00 – 3:00 ASRC GOES

• Dissertation
• Usability study! Done!
• Discussion. This is going to take some framing. I want to tie it back to earlier navigation, particularly the transition from stories and mappaemundi to isotropic maps of Ptolemy and Mercator.
• Sent Don and Danilo sql file
• Start satellite component list
• Evolver
• Adding threads to handle the GPU. This looks like what I want (from here):
import logging
import concurrent.futures
import time

time.sleep(2)

if __name__ == "__main__":
num_gpus = 1
format = "%(asctime)s: %(message)s"
logging.basicConfig(format=format, level=logging.INFO,
datefmt="%H:%M:%S")

logging.info("Main    : all done")

As you can see, it’s possible to have a thread for each gpu, while having them iterate over a larger set of tasks. Now I need to extract the gpu name from the thread info. In other words,  ThreadPoolExecutor-0_0 needs to map to gpu:1.

• Ok, this seems to do everything I need, with less cruft:
import concurrent.futures
import time
from typing import List
import re

last_num_in_str_re = '(\d+)(?!.*\d)'
prog = re.compile(last_num_in_str_re)

gpu_str = "gpu:{}".format(int(num.group(0))+1)
print("{}: starting on  {}".format(args["name"], gpu_str))
time.sleep(2)
print("{}: finishing on  {}".format(args["name"], gpu_str))

if __name__ == "__main__":
num_gpus = 5

print("Finished Main")

And that gives me:

task_0: starting on  gpu:1
task_0: finishing on  gpu:1, after sleeping 2.0 seconds
task_1: finishing on  gpu:2, after sleeping 2.1 seconds
task_2: finishing on  gpu:1, after sleeping 2.2 seconds
task_3: finishing on  gpu:2, after sleeping 2.3 seconds
task_4: finishing on  gpu:1, after sleeping 2.4 seconds
Finished Main

So the only think left is to integrate this into TimeSeriesMl2

# Phil 11.7.19

7:00 – 5:00 ASRC GOES

• Dissertation
• ML+Sim
• Save actual and inferred efficiency to excel and plot
• Create an illustration that shows how the network is trained, validated against the sim, then integrated into the operating system. (maybe show a physical testbed for evaluation?)
• Demo at the NSOF
• Went ok. Next steps are a sufficiently realistic model that can interpret an actual malfunction
• Put together a Google Doc/Sheet that has the common core elements that we can model most satellites (LEO, MEO, GEO, and HEO?). What are the common components between cubesats and the James Webb?
• Detection of station-keeping failure is a possibility
• Also, high-dynamic phases, like orbit injection might be low-ish fruit
• Tomorrow, continue on the GPU assignment in the evolver

# Phil 10.5.19

“Everything that we see is a shadow cast by that which we do not see.” – Dr. King

ASRC GOES 7:00 – 4:30

• Dissertation – more human study. Pretty smooth progress right now!
• Cleaning up the sim code for tomorrow – done. All the prediction and manipulation to change the position data for the RWs and the vehicle are done in the inference section, while the updates to the drawing nodes are separated.
• I think this is the code to generate GPT-2 Agents?: github.com/huggingface/transformers/blob/master/examples/run_generation.py

# Phil 11.4.19

7:00 – 9:00 ASRC GOES

• Cool thing: Our World in Data
• The goal of our work is to make the knowledge on the big problems accessible and understandable. As we say on our homepage, Our World in Data is about Research and data to make progress against the world’s largest problems.
• Dissertation – more human study
• This is super-cool: The Future News Pilot Fund: Call for ideas
• Between February and June 2020 we will fund and support a community of changemakers to test their promising ideas, technologies and models for public interest news, so communities in England have access to reliable and accurate news about the issues that matter most to them.
• October status report
• Sim + ML next steps:
• I can’t do ensemble realtime inference because I’d need a gpu for each model. This means that I need to get the best “best” model and use that
• Run the evolver to see if something better can be found
• Add “flywheel mass” and “vehicle mass” to dictionary and get rid of the 0.05 value – done
• Set up a second model that uses the inferred efficiency to move in accordance with the actual commands. Have them sit on either side of the origin
• Graphics are done
• Need to make second control system and ‘sim’ that uses inferred efficiency. Didn’t have to do all that. What I’m really doing is calculating rw angles based on the voltage and inferred efficiency. I can take the commands from the control system for the ‘actual’ satellite.

• ML seminar
• Showed the sim, which runs on the laptop. Then everyone’s status reports
• Meeting with Aaron
• Really good discussion. I think I have a handle on the paper/chapter. Added it to the ethical considerations section

# Phil 11.1.19

7:00 – 3:00 ASRC GOES

• Hugging Face: State-of-the-Art Natural Language Processing in ten lines of TensorFlow 2.0
• Hugging Face is an NLP-focused startup with a large open-source community, in particular around the Transformers library. 🤗/Transformers is a python-based library that exposes an API to use many well-known transformer architectures, such as BERTRoBERTaGPT-2 or DistilBERT, that obtain state-of-the-art results on a variety of NLP tasks like text classification, information extraction, question answering, and text generation. Those architectures come pre-trained with several sets of weights.
• Dissertation
• Starting on Human Study section!
• For once there was something there that I could work with pretty directly. Fleshing out the opening
• OODA paper:
• Maximin (Cass Sunstein)
• For regulation, some people argue in favor of the maximin rule, by which public officials seek to eliminate the worst worst-cases. The maximin rule has not played a formal role in regulatory policy in the Unites States, but in the context of climate change or new and emerging technologies, regulators who are unable to conduct standard cost-benefit analysis might be drawn to it. In general, the maximin rule is a terrible idea for regulatory policy, because it is likely to reduce rather than to increase well-being. But under four imaginable conditions, that rule is attractive.
1. The worst-cases are very bad, and not improbable, so that it may make sense to eliminate them under conventional cost-benefit analysis.
2. The worst-case outcomes are highly improbable, but they are so bad that even in terms of expected value, it may make sense to eliminate them under conventional cost-benefit analysis.
3. The probability distributions may include “fat tails,” in which very bad outcomes are more probable than merely bad outcomes; it may make sense to eliminate those outcomes for that reason.
4. In circumstances of Knightian uncertainty, where observers (including regulators) cannot assign probabilities to imaginable outcomes, the maximin rule may make sense. (It may be possible to combine (3) and (4).) With respect to (3) and (4), the challenges arise when eliminating dangers also threatens to impose very high costs or to eliminate very large gains. There are also reasons to be cautious about imposing regulation when technology offers the promise of “moonshots,” or “miracles,” offering a low probability or an uncertain probability of extraordinarily high payoffs. Miracles may present a mirror-image of worst-case scenarios.
• Reaction wheel efficiency inference
• Since I have this spiffy accurate model, I think I’m going to try using it before spending a lot of time evolving an ensemble
• Realized that I only trained it with a voltage of +1, so I’ll need to abs(delta)
• It’s working!

• Next steps:
• I can’t do ensemble realtime inference because I’d need a gpu for each model. This means that I need to get the best “best” model and use that
• Run the evolver to see if something better can be found
• Add “flywheel mass” and “vehicle mass” to dictionary and get rid of the 0.05 value
• Set up a second model that uses the inferred efficiency to move in accordance with the actual commands. Have them sit on either side of the origin
• Committed everything. I think I’m done for the day

# Phil 10.31.19

8:00 – 4:00 ASRC

• Got my dissertation paperwork in!
• To Persuade As an Expert, Order Matters: ‘Information First, then Opinion’ for Effective Communication
• Participants whose stated preference was to follow the doctor’s opinion had significantly lower rates of antibiotic requests when given “information first, then opinion” compared to “opinion first, then information.” Our evidence suggests that “information first, then opinion” is the most effective approach. We hypothesize that this is because it is seen by non-experts as more trustworthy and more respectful of their autonomy.
• This matters a lot because what is presented and the order of presentation is itself, an opinion. Maps lay out the information in a way that provides a larger, less edited selection of information.
• Working on RW training set. Got the framework methods working. Here’s a particularly good run – 99% accuracy for 50 “functions” repeated 20 times each:
• Tomorrow I’ll roll them into the optomizer. I’ve already built the subclass, but had to flail a bit to find the right way to structure and scale the data

# Phil 10.25.19

7:00 – 4:00 ASRC GOES

# Phil 10.24.19

Janelle Shane’s website

7:00 – ASRC GOES

• Dissertation
• Nice chapter on force-directed graphs here
• Explaining Strava heatmap.
• Also, added a better transition from Moscovici to Simon’s Ant and mapping. This is turning into a lot of writing…
• Explain approach for cells (sum of all agent time, and sum all unique agent visits)
• Explain agent trajectory (add to vector if cur != prev)
• Good discussion with Aaron about time series approaches to trajectory detection

# Phil 10.21.19

7:00 – 8:00 ASRC / Phd

The Journal of Design and Science (JoDS), a joint venture of the MIT Media Lab and the MIT Press, forges new connections between science and design, breaking down the barriers between traditional academic disciplines in the process.

There is a style of propaganda on the rise that isn’t interested in persuading you that something is true. Instead, it’s interested in persuading you that everything is untrue. Its goal is not to influence opinion, but to stratify power, manipulate relationships, and sow the seeds of uncertainty.

Unreal explores the first order effects recent attacks on reality have on political discourse, civics & participation, and its deeper effects on our individual and collective psyche. How does the use of media to design unreality change our trust in the reality we encounter? And, most important, how does cleaving reality into different camps—political, social or philosophical—impact our society and our future?

This looks really nice: The Illustrated GPT-2 (Visualizing Transformer Language Models)

# Phil 10.16.19

7:00 – ASRC GOES

• Listening to Rachel Maddow on City Arts and Lectures. She’s talking about the power of oil and gas, and how they are essentially anti-democratic. I think that may be true for most extracting industries. They are incentivised to take advantage of the populations that are the gatekeepers to the resource. Which is why you get corruption – it’s cost effective. This also makes me wonder about advertising, which regards consumers as the source to extract money/votes/etc from.
• Dissertation:
• Something to add to the discussion section. Primordial jumps are not just on the parts of an individual on a fitness landscape. Sometimes the landscape can change, as with a natural disaster. The survivors are presented with an entirely new fitness landscape,often devoid of competition, that they can now climb.
• This implies that sustained stylistic change creates sophisticated ecosystems, while primordial change disrupts that, and sets the stage for the creation of new ecosystems.
• Had a really scary moment. Everything with \includegraphics wouldn’t compile. It seems to be a problem with MikTex, as described here. The fix is to place this code after \documentclass:
\makeatletter
\def\set@curr@file#1{%
\begingroup
\escapechar\m@ne
\xdef\@curr@file{\expandafter\string\csname #1\endcsname}%
\endgroup
}
\def\quote@name#1{"\quote@@name#1\@gobble""}
\def\quote@@name#1"{#1\quote@@name}
\def\unquote@name#1{\quote@@name#1\@gobble"}
\makeatother
• Finished the intro simulation description and results. Next is robot stampedes, then adversarial herding
• Evolver
• Check on status
• Write abstract for GSAW if things worked out
• GOES-R AI/ML Meeting
• Lots of AIMS deployment discussion. Config files, version control, etc.
• AIMS / A2P Meeting
• Walked through report
• Showed video of the Deep Mind robot Rubik’s cube to drive homethe need for simulation
• Send an estimate for travel expenses for 2020

# Phil 10.15.19

7:00 – ASRC GOES

• Well, I’m pretty sure I missed the filing deadline for a defense in February. Looks like April 20 now?
• Dissertation – More simulation. Nope, worked on making sure that I actually have all the paperwork done that will let me defend in February.
• Evolver? Test? Done! It seems to be working. Here’s what I’ve got
• Ground Truth: Because the MLP is trained on a set of mathematical functions, I have a definitive ground truth that I can extend infinitely. It’s simple a set of ten sin(x) waves of varying frequency:

• All Predictions: If you read back through my posts, I’ve discovered how variable a neural network can be when it has the same architecture and training parameters. This variation is based solely on the different random initialization  of the weights between layers.
• I’ve put together a genetic-algorithm-based evolver to determine the best hyperparameters, but because of the variation due to initialization, I have to train an ensemble of models and do a statistical analysis just to see if one set of hyperparameters is truly better than another. The reason is easy to see in the following image. What you are looking at is the input vector being run through ten models that are used to calculate the statistical values of the ensemble. You can see that most values are pretty good, some are a bit off, and some are pretty bonkers.

• Ensemble Average: On the whole though, if you take the average of all the ensemble, you get a pretty nice result. And, unlike the single-shot method of training, the likelihood that another ensemble produced with the same architecture will be the same is much higher.

• This is not to say that the model is perfect. The orange curve at the top of the last chart is too low. This model had a mean accuracy of 67%. I’ve just kicked off a much longer run to see if I can find a better architecture using the evolver over 50 generations rather than just 2.
• Ok, it’s now tomorrow, and I have the full run of 50 generation. Things did get better. We end with a higher mean, but we also have a higher variance. This means that it’s possible that the architecture around generation 23 might actually be better:

• Because all the values are saved in the spreadsheet, I can try that scenario, but let’s see what the best mean looks like as an ensemble when compared to the early run:

• Wow, that is a lot better. All the models are much closer to each other, and appear to be clustered around the right places. I am genuinely surprised how tidy the clustering is, based on the previous “All Predictions” plot towards the top of this post. On to the ensemble average:

• That is extremely close to the “Ground Truth” chart. The orange line is in the right place, for example. The only error that I can see with a cursory visual inspection is that the height of the olive line is a little lower than it should be.
• Now, I am concerned that there may be two peaks in this fitness landscape that we’re trying to climb. The one that we are looking for is a generalized model that can fit approximate curves. The other case is that the network has simply memorized the curves and will blow up when it sees something different. Let’s test that.
• First, let’s revisit the training set. This model was trained with extremely clean data. The input is a sin function with varying frequencies, and the evaluation data is the same sin function, picking up where we cut off the training data. Here’s an example of the clean data that was used to train the model:

• Now let’s try noising that up, so that the model has to figure out what to do based on data that model has never seen before:

• Let’s see what happened! First, let’s look at all the predictions from the ensemble:

• The first thing that I notice is that it didn’t blow up. Although the paths from each model are somewhat different, each one got all the paths approximately right, and there is no wild deviation. The worst behavior (as usual?) is the orange band, and possibly the green band. But this looks like it should average well. Let’s take a look:

• That seems pretty good. And the orange / green lines are in the right place. It’s the blue, olive, and grey lines that are a little low. Still, pretty happy with this.
• So, ensembles seem to work very well, and make for resilient, predictable behavior in NN architectures. The cost is that there is much more time required to run many, many models through the system.
• Work on AI paper
• Good chat with Aaron – the span of approaches to the “model brittleness problem” can be described using three scenarios:
• Military: Models used in training and at the start of a conflict may not be worth much during hostilities
• Waste, Fraud, and Abuse. Clever criminals can figure out how not to get caught. If they know the models being used, they may be able to thwart them better
• Facial recognition and protest. Currently, protesters in cultures that support large-scale ML-based surveillance try to disguise their identity to the facial recognizers. Developing patterns that are likely to cause errors in recognizers and classifiers may support civil disobedience.
• Solving Rubik’s Cube with a Robot Hand (openAI)
• To overcome this, we developed a new method called Automatic Domain Randomization (ADR), which endlessly generates progressively more difficult environments in simulation. This frees us from having an accurate model of the real world, and enables the transfer of neural networks learned in simulation to be applied to the real world.