Remove "Picked for you" pins from Pinterest.

Update: Pinterest now lets you disable Picked For You pins! Go to your profile, then press the settings button (a hexagonal bolt). Scroll down to "Home feed", then switch 'Show "Picked for you" Pins in your home feed' to 'No'.

Thank you all for your kind comments and bug fixing for this script. I hope it was useful.
Remove Picked For You pins from Pinterest
It's no secret that I love Pinterest more than is really okay. They've started doing this thing where they show you "Picked for you" pins on your homepage, interspersed with your friends' pins. I quite like the curated pins they choose, but sometimes I like to just see what my friends have been up to.

You have the option to go through and deselect all of your boards, which I assume would prevent you from getting "Picked for you" pins at all. However, I wanted something a little less permanent, so I've made a bookmarklet.

The easiest way to use it is to drag the following link onto your bookmarks toolbar:

Remove Picked For You

Then, if you go to pinterest.com and click on your new bookmark, the "Picked for you" and "Promoted by" pins will have disappeared.

To keep the pins hidden, you have to click on the bookmark every time you load the page. However, there's a browser add-on for Firefox (or Iceweasel) called Greasemonkey, which lets you run little bits of javascript all the time. First, install Greasemonkey. Then, copy the text below:

// ==UserScript==
// @name        Remove Picked For You
// @namespace   bethmcmillan.com
// @include     *
// @version     2
// @grant       none
// ==/UserScript==

function hide_picked_for_you() {
divs=document.getElementsByClassName("creditFooter");
  for(i=0;i<divs.length;i++)
  {if (divs[i].innerHTML.indexOf('Picked for') != -1)
  {divs[i].parentNode.parentNode.parentNode.style.visibility='hidden';}
  }
divs=document.getElementsByClassName('creditName');
  for(i=0;i<divs.length;i++)
  {if (divs[i].innerHTML.indexOf('Promoted') != -1)
  {divs[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.visibility='hidden';}
  }
}

window.setInterval(function(){
  hide_picked_for_you();
}, (5000));

Next, click on the Greasemonkey icon in your browser (usually in the top right), go to "New User Script", then "Use Script From Clipboard". Now, when you go to Pinterest and click on the Greasemonkey icon again, there should be the option "Remove Picked For You". If you tick it, you'll see that the pins disappear. For Google Chrome, there's an extension called Tampermonkey, which works in the same way.

If the script or bookmark aren't working for you, try reinstalling them from this page, as I might have updated the code. If this doesn't fix it, tell me in the comments. The latest code is always available on Github.

...

Playing with Linear Discriminant Analysis

The way that I select which risk category a drug should be in based on the training data I have is called Linear Discriminant Analysis (LDA). I've made a little example of how it works using MATLAB (however, this code also works perfectly on the wonderful, and free, Octave).

You can download my MATLAB/Octave script and try it out yourself (it takes one input, a number). Below, I'll go through it step by step.

function LDA(point)

%% group 1: mean 10, sd 2
%% group 2: mean 3, sd 1
%% group 3: mean 5, sd 0.5

group_1 = 10 + 2*randn(10,1);
group_2 = 3 + randn(10,1);
group_3 = 5 + 0.5*randn(10,1);

These first few lines create a set of training data, by making random numbers based on three normal distributions with different means and standard deviations. In real life, you wouldn't know how your data were generated or what distribution they came from.

%% plot all of the training data
hold off
plot(group_1, zeros(10,1),'o')
hold on
plot(group_2, zeros(10,1),'+')
plot(group_3, zeros(10,1),'.')

Now for visualisation we plot the training data, delineating the different groups by differently shaped markers.

%% find the likelihood of the point given the group
p_x1 = normpdf(point,mean(group_1),std(group_1));
p_x2 = normpdf(point,mean(group_2),std(group_2));
p_x3 = normpdf(point,mean(group_3),std(group_3));

The first thing we need to find is the probability that this point (the input number, in this case 9.5114) would exist given the group that it's a member of, i.e. . In LDA, you assume that the points within each group are normally distributed, so in MATLAB/Octave there's a useful function called normpdf that calculates the probability of a point given the mean and standard deviation of the distribution.

%% find the probability of the group given the point using Bayes' rule
p_i1 = (p_x1*(1/3))/((p_x1+p_x2+p_x3)*1/3);
p_i2 = (p_x2*(1/3))/((p_x1+p_x2+p_x3)*1/3);
p_i3 = (p_x3*(1/3))/((p_x1+p_x2+p_x3)*1/3);

Bayes' rule is that .

is actually the same for all groups, so we can ignore it. Because there are three groups of ten items, we know that is always . This means that we could have simplified these calculations by just comparing the likelihoods ().

%% which one has the maximum probability?
[a b] = max([p_i1,p_i2,p_i3]);

if b==1
    dotshape = 'o';
elseif b==2
    dotshape = '+';
else
    dotshape = '.';
end

%% plot to see if we're right
plot(point,0,strcat(dotshape,'r'))
hold off

end

We end by picking the group that has the highest probability, i.e. the highest , and then plot that on the graph.

If you have more than one set of data points (i.e. if you are classifying based on two features), you can assume that the covariances in different groups are all equal, which simplifies the calculations for that system.

...

Journal Club: a Quantitative Analysis of the Activation and Inactivation Kinetics of HERG Expressed in Xenopus Oocytes

Monday's journal club was on this Wang et al. 1997 paper. They took the hERG gene, which was thought to be responsible for the rapid delayed rectifier potassium current in humans, and put it into unfertilised frog eggs, then used patch clamping to find out its properties.

I think a lot about how the membrane potential is affected by the currents that are flowing across it, but sometimes it is good to remember that the currents themselves are modified by the membrane voltage. In cardiac models, the currents tend to be modelled as:

where is the conductance, is the proportion of channels that are active, is the membrane voltage, and the reversal potential. is often affected by the membrane potential, as well, so the membrane voltage plays a key role in regulating current flow.

Usually, the voltage across the membrane of a cardiac cell looks a bit like this:



If we're doing a patch clamp then we stick an electrode to the outside of the cell, which means that we can control what the membrane potential does. We could make it do this:



... or use the same shape, but don't bring the voltage up as far:



In the case of hERG, this lets us see what happens when the current is activated, because hERG switches on at high voltages. By comparing the activation time at lots of different potential steps, you can begin to understand the activation kinetics of the channel. In this paper, they were able to put together a model of what happens, by taking models with various numbers of closed states and comparing their predictions to the real data.

Activation kinetics are important, but so are deactivation kinetics. The hERG channels close when the membrane potential decreases, so if we activate them and then let the voltage drop down again, we should be able to see what happens when they close:



Again, we can try lots of different voltages:



... and from this, build up a model of the deactivation of this current. Inactivation (which is distinct from deactivation, because it stops the channels from being openable for a period of time) happens very quickly, so they had to cut open the cells for their patch clamp. I'd never come across this method before, but I came across quite a good review article.

In addition to creating a mathematical model of this current, the authors also talk a little bit about possible molecular reasons for the behaviour of the channel. This isn't something I've seen a lot in electrophysiology modelling papers, and I think it's really important to keep an eye on the fact that in addition to being a model component, what we're modelling is a real, physical protein, and mechanistic understanding of how that works can feed back into modelling work.

...