# A Bot to Log Discord Voice Events

Discord is a great platform for text and voice chatting. However, one feature has been seriously lacking for a while now: the ability to see a log of people joining and leaving voice chat rooms.

Luckily, Discord provides a way to create bots. These bots have access to a variety of events occurring on a Discord server, including voice chat events. Of specific interest to us, bots can track events of people joining and leaving voice chat rooms.

I set out to create a simple bot able to log these events to a specific Discord channel. I programmed the bot in Python, using the discord.py library (v0.16.7). My code is open source and available on github. See the bot in action in the video below:

If you’d like to use this bot, feel free to use the code provided; you’ll probably need to create a new developer application on Discord and turn it into a bot user, and read the read-me.

# Machine Translation Turing Test

The U.S. government spent 4.5 billion USD from 1990 through 2009 on outsourcing translations and interpretations [4]. If these translations were automated, much of this money could have been spent elsewhere. The research field of Machine Translation (MT) tries to develop systems capable of translating verbal language (i.e. speech and writing) from a certain source language to a target language.

Because verbal language is broad, allowing people to express a great number of things, one must take into account many factors when translating text from a source language to a target language. Three main difficulties when translating are proposed in [6]: the translator must distinguish between general vocabulary and specialized terms, as well as various possible meanings of a word or phrase, and must take into account the context of the source text.

Machine Translation systems must overcome the same obstacles as professional human translators in order to accurately translate text. To try to achieve this, researchers have had a variety of approaches over the past decades, such as [3, 2, 5]. At first, the knowledge-based paradigm was dominant. After promising results on a statistical-based system ([2, 1]), the focus shifted towards this new paradigm.

[1] P. F. Brown, V. D. J. Pietra, S. D. A. Pietra, and R. L. Mercer, “The mathematics of statistical machine translation: parameter estimation,” Computational linguistics, vol. 19, iss. 2, p. 263–311, 1993.
[Bibtex]
@article{Brown1993,
title={The mathematics of statistical machine translation: Parameter estimation},
author={Brown, Peter F and Pietra, Vincent J Della and Pietra, Stephen A Della and Mercer, Robert L},
journal={Computational linguistics},
volume={19},
number={2},
pages={263--311},
year={1993},
publisher={MIT Press}
}
[2] P. F. Brown, J. Cocke, S. D. A. Pietra, V. D. J. Pietra, F. Jelinek, J. D. Lafferty, R. L. Mercer, and P. S. Roossin, “A statistical approach to machine translation,” Computational linguistics, vol. 16, iss. 2, p. 79–85, 1990.
[Bibtex]
@article{Brown1990,
title={A statistical approach to machine translation},
author={Brown, Peter F and Cocke, John and Pietra, Stephen A Della and Pietra, Vincent J Della and Jelinek, Fredrick and Lafferty, John D and Mercer, Robert L and Roossin, Paul S},
journal={Computational linguistics},
volume={16},
number={2},
pages={79--85},
year={1990},
publisher={MIT Press}
}
[3] D. A. Gachot, “The systran renaissance,” in Mt summit ii, 1989, p. 66–71.
[Bibtex]
@inproceedings{Gachot1989,
title={The SYSTRAN renaissance},
author={Gachot, Denis A},
booktitle={MT SUMMIT II},
pages={66--71},
year={1989}
}
[4] D. Isenberg, Translating For Dollars, 2010.
[Bibtex]
@misc{USSpend,
author = {David Isenberg},
title = {{Translating For Dollars}},
howpublished = "\url{http://www.huffingtonpost.com/david-isenberg/translating-for-dollars_b_735752.html}",
year = {2010},
note = "[Online; accessed 2-October-2013]"
}
[5] P. Koehn, F. J. Och, and D. Marcu, “Statistical phrase-based translation,” in Proceedings of the 2003 conference of the north american chapter of the association for computational linguistics on human language technology-volume 1, 2003, p. 48–54.
[Bibtex]
@inproceedings{Koehn2003,
title={Statistical phrase-based translation},
author={Koehn, Philipp and Och, Franz Josef and Marcu, Daniel},
booktitle={Proceedings of the 2003 Conference of the North American Chapter of the Association for Computational Linguistics on Human Language Technology-Volume 1},
pages={48--54},
year={2003},
organization={Association for Computational Linguistics}
}
[6] A. K. Melby, Some difficulties in translation, 1999.
[Bibtex]
@misc{TTT1999,
author = {Alan K. Melby},
title = {{Some difficulties in translation}},
howpublished = "\url{http://www.ttt.org/theory/difficulties.html}",
year = {1999},
note = "[Online; accessed 2-October-2013]"
}

# The Future of Big Data in Healthcare

In the United States and other countries, healthcare service providers are rapidly adopting Electronic Health Records (EHRs). These records are real-time, digital versions of patients’ charts. They provide a variety of patient-centered information such as medical history, diagnoses, and medications. In 2014, 83% of physicians in the United States utilized EHRs, compared to just 42% in 2004 [1]. A number of other countries already have better adoption of the technology, with over 90% of healthcare service providers in Australia, the Netherlands, New Zealand, Norway and the United Kingdom having adopted EHRs in 2012 [4].

Additionally, through progress in healthcare and technology, and the ensuing societal changes, people are becoming more conscious of their health and actively seek to better manage their health and lifestyle [3]. With improvements in computer technology, mobile health monitoring devices are available; both through dedicated devices and through “apps” on personal mobile phones.

Most importantly, these developments are generating extensive datasets of previously unattainable proportions. As a result, hospital-centered healthcare is changing to patient-centered care. Where the goal formerly was to find general treatments for ailments, the goal is now shifting towards early detection of risks, prevention of further complications, and improvement of treatments through patient feedback. Though reducing costs should not be a primary motivator in healthcare, it has been estimated that usage of big data methods in healthcare could cause a 12% reduction of the baseline United States’ healthcare costs [2]. In this essay we will look at leading-edge developments related to big data in healthcare. Recognizing those developments, we will consider which near-future accomplishments can be expected and we will reflect on the desirability thereof.

[1] D. Heisey-Grove and V. Patel, “Any, certified, and basic: quantifying physician ehr adoption through 2014,” Onc data brief, vol. 28, p. 1–10, 2015.
[Bibtex]
@article{heisey2015any,
title={Any, Certified, and Basic: Quantifying Physician EHR Adoption through 2014},
author={Heisey-Grove, Dustin and Patel, Vaishali},
journal={ONC Data Brief},
volume={28},
pages={1--10},
year={2015}
}
[2] B. Kayyali, D. Knott, and S. Van Kuiken, “The big-data revolution in us health care: accelerating value and innovation,” Mc kinsey & company, 2013.
[Bibtex]
@article{kayyali2013big,
title={The big-data revolution in US health care: Accelerating value and innovation},
author={Kayyali, Basel and Knott, David and Van Kuiken, Steve},
journal={Mc Kinsey \& Company},
year={2013}
}
[3] A. Lymberis, “Smart wearables for remote health monitoring, from prevention to rehabilitation: current r&d, future challenges,” in Information technology applications in biomedicine, 2003. 4th international ieee embs special topic conference on, 2003, p. 272–275.
[Bibtex]
@inproceedings{lymberis2003smart,
title={Smart wearables for remote health monitoring, from prevention to rehabilitation: current R\&D, future challenges},
author={Lymberis, A},
booktitle={Information Technology Applications in Biomedicine, 2003. 4th International IEEE EMBS Special Topic Conference on},
pages={272--275},
year={2003},
organization={IEEE}
}
[4] C. Schoen, R. Osborn, D. Squires, M. Doty, P. Rasmussen, R. Pierson, and S. Applebaum, “A survey of primary care doctors in ten countries shows progress in use of health information technology, less in other areas,” Health affairs, vol. 31, iss. 12, p. 2805–2816, 2012.
[Bibtex]
@article{schoen2012survey,
title={A survey of primary care doctors in ten countries shows progress in use of health information technology, less in other areas},
author={Schoen, Cathy and Osborn, Robin and Squires, David and Doty, Michelle and Rasmussen, Petra and Pierson, Roz and Applebaum, Sandra},
journal={Health Affairs},
volume={31},
number={12},
pages={2805--2816},
year={2012},
publisher={Health Affairs}
}

# Inductively Defined Lists and Proofs

In this post, we will explore an inductive data structure as a type for lists of elements. We define two recursive functions that can be applied to lists of this type; namely, an operation to append two lists and an operation to reverse a list. With these definitions, we set out to mathematically prove a number of properties that should hold for these functions by means of induction.

A list is a data structure of a collection of elements in a certain order. A list can be defined in multiple ways. One way is to define a list as being an element (the “head” of the list) followed by another list (the “tail” of the list). Inductively, this could be formalized as follows:

Inductive list a := cons a list | nil.

This means that a list l with elements of type a is either cons x tail, with x of type a and with tail of type list a, or l is the empty list nil. Let’s look at some example lists with elements of the whole numbers.

// Empty list; []
l = nil

// List with one element; [1]
l = cons 1 nil

// Different list with one element; [2]
l = cons 2 nil

// List with two elements; [1,2]
l = cons 1 (cons 2 nil)

// List with three elements; [1,2,3]
l = cons 1 (cons 2 (cons 3 nil))

Note that because we have lists of integers, following our definition the list l is of type list integer.

Multiple list operations can be defined, such as append and reverse. We defined our list inductively, and so it would make sense to define these operations inductively (also known as recursively) as well. Because of our neat data structure and operations, we should then be able to prove that certain properties of the operations hold.

# Illogical Reasoning and Reasonable Illogicality: The Differences Between Logic and Reason

What is reasonable is not necessarily logical. One can believe two things and realize that they imply a third thing. Instead of coming to believe the third thing, that person might find they should stop believing one of the first two if they have a good reason to believe the third is false. Similarly, a person with those beliefs, except without a good reason to believe the third is false, might still not infer that the third is true: they might be utterly uninterested in whether it is true or not. There are many things one believes, and though it would be logical to follow those beliefs to their logical conclusions, this would result in one’s mind being filled with trivialities; a consequence that makes the action unreasonable.

In order to understand the difference between reason and logic, I think it is important to first understand reason more deeply.

Reason is traditionally split into two types. Theoretical reasoning is a type of thought to come to a certain belief, whereas practical reasoning is a type of thought to change plans or intentions. What is reasonable in one type, is not necessarily reasonable in the other. For example, in practical reasoning one might be presented with multiple, equally satisfactory options. It would be rational to choose an arbitrary option; otherwise one would be stalled through inaction. The same does not hold for theoretical reasoning: when presented with multiple, equally satisfactory beliefs it would not be rational to arbitrarily choose one to believe. However, it is possible to rationally choose which beliefs or questions one evaluates with theoretical reason. The conclusions remain unaffected.

Ordinarily, reasoning is applied in a conservative manner. One’s current beliefs and intentions are changed if there is a special reason to do so, and conserved otherwise. This is in contrast with foundational reasoning, where a belief should only be continued to be held if there is a justification to do so. In such a reasoning system, there are some foundational beliefs that require no further justification, such as current perceptions and logical axioms. In general, humans reason conservatively.

Logical processes can be divided into three modes. One such mode is deduction, where logical conclusions are reached from premises. A proof that some conclusion is true through deduction starts with the premises, then consists of a series of steps where each step follows logically from the prior steps or the premises, and finally leads to the conclusion. This proof is sometimes called “deductive reasoning”.

In reality, it is not actually a type of reasoning. In constructing such a proof, one can have many different considerations. One first determines what they are setting out to prove, upon which they might consider which intermediate steps could be useful. They then aim to prove these intermediate steps, and only then prove the conclusion is true using those intermediate results. The reasoning behind constructing a logical proof does not necessarily follow the same structure as the proof itself: the deductive rules must be satisfied for the proof, but are not necessarily followed in the proof’s construction.

As such, something that is reasonable is not necessarily logical, and something that is logical is not necessarily reasonable. One can reason about deductions, but deduction is not a kind of reasoning. Logic, at least its deductive mode, is not a theory of reasoning and does not tell us how we govern our beliefs and intentions.

If you would like to explore logic and reasoning in more detail, I highly recommend reading the article Internal critique: A logic is not a theory of reasoning and a theory of reasoning is not a logic, by G. Harman (2002).

# An Introduction to Turing Machines

A Turing machine is a mathematical model of a mechanical machine. At its roots, the Turing machine uses a read/write head to manipulate symbols on a tape. It was invented by the computer scientist Alan Turing in 1936. Interestingly, according to the Church-Turing thesis this simple machine can do everything any other computer can do; including our contemporary computers. Though these machines are not a practical or efficient means to calculate something in the real world, they can be used to reason about computability and other properties of computer programs.

# Alan Turing Quote from Computing Machinery and Intelligence

The view that machines cannot give rise to surprises is due, I believe, to a fallacy to which philosophers and mathematicians are particularly subject. This is the assumption that as soon as a fact is presented to a mind all consequences of that fact spring into the mind simultaneously with it. It is a very useful assumption under many circumstances, but one too easily forgets that it is false.

— Alan Turing, 1950

# Why You Should Never Go Data Fishing

Most likely you will have heard that you should never go data fishing, meaning that you should not repeatedly test data. In the case of statistical significance tests, perhaps you will have heard that because of the nature of these tests you will find an effect at the 5% significance level in 5% of cases when there actually is no effect, and an effect at the 2% significance level in 2% of cases when there actually is no effect, and so on. It is less likely you will have heard not to continue looking for an effect after your current test concluded there was none. Here is why.

# Competing in the ESA Moon Challenge

I have recently joined a group of people to form a team for competing in the ESA Moon Challenge. This challenge is held in light of recent plans to set up an inhabited station near the far-side of the Moon; specifically, at the second Lagrangian point of the Earth-Moon system ($latex \text{EML}_{2}$). In this orbit, the station will remain in a stable position relative to both the Earth and the Moon. This position brings great advantages, such as excellent Lunar research capabilities, as well as being relatively easy to reach with a rocket from Earth.

Additionally, due to this useful orbit, the station could be used as an “Exploration Gateway Platform“. This Gateway would allow for a great number of scientific missions, and would pave the way for sustainable Lunar exploration. Other long-term goals of the Gateway include exploration of asteroids and, ultimately, Mars. See the Global Exploration Roadmap (2013) for more information about the Gateway and potential missions.

The goal of the challenge is to design a number of missions in an international group of university students. The missions should be based on the rough architecture named “Human-Enhanced Robotic Architecture and Capabilities for Lunar Exploration and Science” (HERACLES); this architecture describes a number of landers, ascent modules, robots, etc, that will work in concert to provide an unprecedented opportunity for exploring the Moon.

I am really excited to be participating in this challenge, and I think it was a great idea of ESA to organize it. Good luck to all competing teams, and have fun!

# Plotting a Heat Map Table in MATLAB

A little while ago I found myself needing to plot a heat map table in MATLAB. Such a plot is a table where the cells have background colors; the colors depend on the value in the cell, e.g. a higher value could correspond with a warmer color. I found no existing function to do this easily, so I set out to create my own solution.

The code to plot a heat map table can be found here.

Usage is pretty simple. If you have a matrix $latex A$, just pass it into the function and it will do the rest! For example:

A = zeros(7,7);
for i = 1:7
for j = 1:7
A(i,j) = i+j-2;
end
end
tabularHeatMap(A);

There are a number of options available. See the documentation in the code for more information about the options. To further adjust the generated figure, such as to add labels, proceed as you would with other plotting functions. For example:

confusion = crosstab(responses, correctAnswers);
h = tabularHeatMap(confusion, 'Colormap', 'winter');
title('Confusion Matrix');
xlabel('Correct');
ylabel('Response');
h.XAxisLocation = 'top';
h.XTick = [1 2 3];
h.XTickLabel = {'A', 'B', 'C'};
h.YTick = [1 2 3];
h.YTickLabel = {'A', 'B', 'C'};