# Algorithm: multi label classification

I am a biologist and I have an algorithm question, I asked on stack exchange but was suggested to come here. Also, I have really tried to explain my problem using simple toy data; note that in real life I have thousands of students/exams; not just the three as in this example.

For example, let's say there are only three students in a class; and from class records, I know their what their #attendance days per year (#), average punctuality (%), class engagement (not good, good, very good) (* = no recorded value)

Over the years:

Student1 = [100, *, not good]
Student2 = [50, 60, good]
Student3 = [200, 100, very good]


These three students only study three subjects: maths, english and history. I can see that the class exam results for maths, english and history are changing throughout the year.

Student1 = [maths increasing, english decreasing, history decreasing]
Student2 = [maths increasing, english stable, *]
Student3 = [maths increasing, english increasing, history increasing]


My question: "What student properties are most strongly correlated with changes in exam results"?

My output: A list of students and their properties that are most strongly correlated with changes in exam results, to identify which traits we woul For this, someone suggested that I look at "multi-label classification methods", since each of the data sets have a number of different class labels to be predicted (where each label is an exam score change in a particular subject?) So my questions are:

Do you agree that multi-label classification is the method to address this problem?

Do you know where I should start (remember that I'm a biologist)? I have found this: http://scikit-learn.org/stable/modules/multiclass.html ; but I'm not sure where to start? Would someone have an example of basic code that I would use to do this correlation for this toy data set? Or should I use a different package/software?

I'm highlighting feature correlation as possible solution to your problem - which is different to multilabel classification, but might be able to give you a simple answer to your question.

I guess that a simple feature correlation between your students attributes (attendance, etc.) and the one-hot encoded labels of their performance on certain exams/subjects (Math increasing, etc.) will answer your question. Here's a short example with some explanation on how this could look like (I'm using R and a dataset from another domain, namely the mtcars dataset, to make everything reproducible):

At first I need to artificially generate fake student records:

d <- data.frame(row.names = 1:nrow(mtcars))
d$engagement <- factor(ifelse(mtcars[,11] %in% c(1,3), 'good', ifelse(mtcars[,11] %in% c(2,6), 'average', 'bad'))) d$attendance <- as.integer(mtcars[,3])
d$punctuality <- mtcars[,5]/max(mtcars[,5]) d$math <- factor(mtcars$cyl, labels = c('increasing', 'decreasing', 'stable')) d$history <- factor(mtcars$gear, labels = c('increasing', 'decreasing', 'stable'))  This is what our fake student records look like (the data might have a senseless correlation here, but it should serve the purpose): > print(d) engagement attendance punctuality math history 1 bad 160 0.7910751 decreasing decreasing 2 bad 160 0.7910751 decreasing decreasing 3 good 108 0.7809331 increasing decreasing 4 good 258 0.6247465 decreasing increasing 5 average 360 0.6389452 stable increasing  We can now one-hot encode students' categorial attributes and performance in exams/subjects: > library(caret) > d2 <- data.frame(predict(dummyVars("~ .", data=d), newdata=d)) > print(d2) engagement.average engagement.bad engagement.good attendance punctuality math.increasing math.decreasing math.stable 1 0 1 0 160 0.7910751 0 1 0 2 0 1 0 160 0.7910751 0 1 0 3 0 0 1 108 0.7809331 1 0 0 4 0 0 1 258 0.6247465 0 1 0 5 1 0 0 360 0.6389452 0 0 1  Having one-hot encoded information allows feature correlation between your students' attributes and the labels: library(corrplot) corrplot(cor(d2), type = 'lower')  This gives you the correlation between students' recorded attributes and their performance on certain exams/subjects, and therefore should probably answer your question. Update: On a second thought, as your students' attributes and exam performances can be considered to have ordered levels, converting those categorial variables just into (ordered) numeric values instead of one-hot encoding them should work too. This reduces the size of the resulting correlation matrix - and might emphasize the correlation between specific variables a bit better: d2 <- d d2$engagement <- as.numeric(as.character(factor(d$engagement, labels = 1:3))) d2$math <- as.numeric(as.character(factor(d$math, labels = 1:3))) d2$history <- as.numeric(as.character(factor(d\$history, labels = 1:3)))


...which will result in a simpler d2:

> print(d2)

engagement attendance punctuality math history
1           2        160   0.7910751    2       2
2           2        160   0.7910751    2       2
3           3        108   0.7809331    1       2
4           3        258   0.6247465    2       1
5           1        360   0.6389452    3       1

> library(corrplot)
> corrplot(cor(d2), type = 'lower')


• I REALLY appreciate the response. Unfortunately, I'm not talking about per-subject, but rather what properties affect student's grades changing with time overall. I assume this method would not work for that question. One again though, I REALLY appreciate the effort you went to. I apologise if the question was misleading, perhaps it should have said "What student properties are most strongly correlated with changes in exam results overall, not per subject"? – user1288515 Jun 16 '16 at 8:42
• OK, I replaced "subjects" with math and history in the example for clarification. In case you are referring to using a single value for representing change in performance over different exams: how you you want this value to be calculated? What if a student is increasing in one subject but decreasing in another? From my understanding "change" is everything except "stable", right? (E.g. "change" per student being the ratio of non-stable over non-stable+stable?) – geekoverdose Jun 16 '16 at 9:27
• Thank you. In the example, it does seem strange to correlate a trait such as punctuality with a student increasing in one subject, but decreasing in another. In reality, I have gene expression data, where it is normal that for example, in different tissues, gene expression may increase and decrease with time (i.e. the different subjects marks increasing and decreasing with time in the example is like the reality that the gene expression in different – user1288515 Jun 16 '16 at 14:27
• tissues increasing and decreasing with time). So for thousands of genes, I have say 2 gene properties: gene function and gene length (in reality, I have lots of properties; some numerical, some categorical; this is like the student properties in the example). I have a set of changes occurring in the body with time, let's call it development (e.g. changes in protein levels, changes in gene expression; again I have lots of changes, this is just for – user1288515 Jun 16 '16 at 14:27
• example; this is the changing student marks with time in the example). My question I want to address is "Which genes and which specific properties of those genes are most strongly correlated with development, as a whole process?" (not the individual parts of the process, like disease incidence). So I know I want my input to be 2 lists: (1) a list of genes and their – user1288515 Jun 16 '16 at 14:27