<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Indian Statistical Institute, Kolkata at PR-SOCO 2016 : A Simple Linear Regression Based Approach</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Kripabandhu Ghosh</string-name>
          <email>kripa.ghosh@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Swapan Kumar Parui</string-name>
          <email>swapan.parui@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Indian Statistical Institute</institution>
          ,
          <addr-line>Kolkata</addr-line>
          ,
          <country country="IN">India</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>We participated in the PR-SOCO task hosted in FIRE 2016 and tried some basic approaches which we look to improve in the future. We de ned some simple features from the source code which, in our opinion, were indicative of the manner in which the code was written and which might give some clues about the personality of the programmer. We built a multiple linear regression model from the training data and applied this model on the test data. The results show that our method produces good prediction performances for Neuroticism, Extroversion and Openness.</p>
      </abstract>
      <kwd-group>
        <kwd>BIG5 personality</kwd>
        <kwd>Source code</kwd>
        <kwd>Linear regression</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. INTRODUCTION</title>
      <p>
        Much work has been done on predicting user
personality based on text written in a natural language (e.g,
Facebook status updates [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]). The task of predicting age,
gender, and personality traits of Twitter users has also been
attempted in the author pro ling task [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] as one of the tasks
of PAN/CLEF 2015 [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. However, the PR-SOCO 2016 [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]
task presents a different and possibly, a more challenging
problem. The main challenge lies in the fact that in this
task, the BIG5 personality traits [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] need to be predicted
from the source code which is written within the strict
lexical and syntactic bounds of a programming language. This
is likely to limit the usual vocabulary of the programmer
which she could have used in a natural language
composition. So, we looked to employ simple means to judge the
quality of the program code and hope to gain insights about
the personality of the programmer. Firstly, we tried to
evaluate the \readability" of the code by automatically detecting
the tendency of the programmer to provide useful comments
in the code. By useful comments we mean the ones which
describe the functionality and purpose of different segments
of the code. However, we considered that the presence of
commented lines of code in the source le to be not
desirable. We also considered the judicious use of spaces in the
code to be a good programming practice and this was also
supposed to improve the readability. For the readibility
aspect, three features (MLC, SLC and NES) are de ned in the
next section. Secondly, we tried to judge the efficiency of the
code. Since we were not provided with the problem
statement or input data for which the source codes were written,
we had no way to evaluate the algorithmic efficiency of the
code. However, we noticed that a particular feature can be
used to understand the efficiency of the code, to some
extent. For the efficiency aspect, one feature (IS) is de ned
in the next section. We believe that these four features can
predict the personality of a person. For example, a person
with prominent Neuroticism1 exhibits low emotional
stability and so is likely to be less methodical in writing a code.
Persons with high Extroversion,2 on the other hand, are
likely to express themselves and possibly provide
meaningful comments in their code. We discuss these features in the
following section. Next we use these features for predicting
the personality traits. We model a multiple linear
regression3 for each BIG5 personality trait. That is, each BIG5
personality value, for a given user, is predicted from these
features extracted from her program code. In the multiple
linear regression framework, each of the BIG5 traits is the
dependent variable and the four features are the explanatory
variables.
      </p>
      <p>The rest of the paper is arranged as follows: We describe
the proposed methodology in Section 2. We present the
results in Section 3. We conclude in Section 4.
2.
2.1</p>
    </sec>
    <sec id="sec-2">
      <title>METHODOLOGY</title>
    </sec>
    <sec id="sec-3">
      <title>Feature selection</title>
      <p>We used four features (explanatory variables) for multiple
linear regression. Here each of the BIG5 traits is the
dependent variable. The feature values were extracted from the
source code of each program le. The features are as follows
(examples are shown in Table 1):
1. Multi-line comments (MLC): This is the number
of genuine comment words in multi-line comments, i.e.,
between /* and */ found in the program code. In
Table 1, we see a case of genuine comment under Positive
example. We have not considered the cases where lines
of code were commented, as shown under Negative
example. To extract this feature from a source code le,
1https://en.wikipedia.org/wiki/Neuroticism as seen on 26th
October, 2016
2https://en.wikipedia.org/wiki/Extraversion and
introversion as seen on 26th October, 2016
3https://en.wikipedia.org/wiki/Linear regression as seen on
26th October, 2016
we rst read the lines within /* and */. Then we
eliminated any instances of program code by
searching for a regular expression containing ;= as symbols
and functions of the form [a-zA-Z][a-zA-Z]*[ ]*( (e.g.,
System.out.println(\Even");) used in a Java code. This
feature value was normalized by dividing it by the total
number of words in the program le.
2. Single-line comments (SLC): This is the number of
genuine single-line comment words in single line
comments, i.e., comments following \//" (as shown in
Table 1, under Positive example). Here also, we have
not considered the cases where lines of code were
commented (as shown in Table 1, under Negative example).
To extract this feature value, we simply determined
the number of words following \//" in the code. Then
we eliminated the occurrences of program code by the
procedure used for the feature MLC. This feature value
was normalized by dividing it by the total number of
words in the program le.
3. Non-existent spaces (NES): This is the number of
lines containing non-existent spaces, e.g., i=1; i&lt;=casos;
as shown in Table 1, under Negative example as
opposed to i = 1; i&lt; = casos; as shown in Table 1,
under Positive example. We have considered this feature
since the presence of spaces is supposed to be a good
programming practice. This feature was extracted by
identifying the lines of code satisfying the regular
expression [a-z][a-z]* [a-z][a-z]*[=&lt;&gt;+] (e.g., int i=1).
This feature value was normalized by dividing it by
the total number of lines in the program le.
4. Import Speci c (IS): This is the number of instances
where the programmer exported the speci c libraries
only (e.g., cases of
import java.io.FileNotFoundException as opposed to
import java.io.*). These examples are also shown in
Table 1. We have considered this feature as this is
supposed to be a good programming practice to use
speci c libraries which reduce compilation time. In
addition, the choice of speci c libraries may indicate
the experience and pro ciency in programming. This
is because a good programmer is supposed to know the
speci c libraries which will be useful. On the other
hand, an inexperienced programmer is more likely to
\import" all the libraries to somehow get the job done.
This feature was extracted by considering all the
instances of \import" not ending with a \*". This feature
value also was normalized with respect to the total
number of lines in the program le.
2.2</p>
    </sec>
    <sec id="sec-4">
      <title>Multiple linear regression model</title>
      <p>For each BIG5 trait, we de ne a multiple linear regression
model4 for a program code p, given as follows:
scoreBIG5(p) =</p>
      <p>+ 1M LC(p) + 2SLC(p)
+ 3N ES(p) + 4IS(p)
(1)</p>
      <p>We calculate the values of parameters and i, i = 1, 2,
3, 4 from the training data using the linear regression
imple4https://en.wikipedia.org/wiki/Linear regression as seen on
11th October, 2016
mentation in R.5 Here, scoreBIG5 is the dependent variable
and MLC, SLC, NES and IS are the explanatory variables.
3.</p>
    </sec>
    <sec id="sec-5">
      <title>RESULTS</title>
      <p>We submitted two runs as follows:
1. Run1.txt: The values of the dependent variables were
generated on the test data using the regression
equation (1) learned from the training data.
2. Run2.txt: For this run, for each BIG5 trait, we
calculated the values of the dependent variables given by
the linear regression equation (1) on the training set.
We then calculated the error between the predicted
value and the actual value for each of the 49 training
samples. We removed the samples in the training set
with the three highest error values. We then trained
the linear regression on the new training set and
calculated the regression coefficients. Finally, values of the
dependent variables were calculated on the test data.
The purpose of this run is to remove some outliers from
the training set.</p>
      <p>The performances of these two runs are shown in Tables
2 and 3. Table 2 reports the results in terms of RMSE. The
table also reports two official baselines (bow and mean) and
the best results reported among all the submitted runs
(Reported best ).6 In RMSE, our run Run1.txt produced the best
performance for Extroversion. This run also produced good
performances for Neuroticism and Openness when compared
with the baselines.</p>
      <p>Table 3 reports the results in terms of Pearson
ProductMoment Correlation (PC). The table also reports two
official baselines (bow and mean) and the best results reported
among all the submitted runs (Reported best ). In PC, our
run Run1.txt produced the best performance for
Neuroticism. This run produced good performances also for
Extroversion and Openness when compared with the baselines.</p>
      <p>Table 4 shows the regression coefficient values learned
from the training data for each BIG5 trait, used for Run1.
Since our predictions for Neuroticism, Extroversion and
Openness are promising, we try to draw some inferences from
Table 4 for these traits, as follows.</p>
      <p>Neuroticism: The negative value of high magnitude of
2 indicates that a person who frequently provides Single
Line Comments (SLC) in her code is likely to exhibit a low
level of Neuroticism. This agrees with our intuition that a
Neurotic person is not organized in her coding. However a
positive value (though of relatively lower magnitude) of 1
indicates that a person who provides Multi Line Comments
(MLC) is likely to have a high level of Neuroticism. Also,
a negative value of 3 indicates that a person who does not
provide necessary spaces in the code is likely to have a low
level of Neuroticism. These two coefficient values somewhat
contradict our intuition that a Neurotic person is necessarily
chaotic in nature while writing a code. But negative value
of high magnitude of 4 indicates that a person who tends
to import libraries selectively, is likely to have a low level of
Neuroticism, which again agrees with our intuition.
5https://www.r-bloggers.com/
r-tutorial-series-multiple-linear-regression/
6These values are reported at http://www.autoritas.es/
prsoco/evaluation/</p>
      <p>Extroversion: The positive values of 1, 2 and 4
indicates that a person who tends to provide genuine comments
(both Multi Line and Single Line) and import speci c
libraries in her code is likely to have high Extrovertion. But,
the positive value 3 indicates that an Extrovert may not
provide appropriate spaces in her code. The value of 2 is
much higher than the other coefficients, which implies that
a person with a tendency of providing genuine Single Line
Comments is likely to have high Extrovertion.</p>
      <p>Openness: The observations about Openness are similar
to those about Extroversion.</p>
      <p>However, the prediction results show that our features are
possibly not suitable indicators for Agreeableness and
Conscientiousness.
4.</p>
    </sec>
    <sec id="sec-6">
      <title>CONCLUSION</title>
      <p>We see that these simple and intuitive features yield
promising prediction results for Neuroticism, Extroversion and
Openness, as inferred from samples of written program code.</p>
      <p>We gain some interesting insights into the relationship of
these three traits with these features. For example,
Neuroticism has a strong negative correlation with the tendency
of writing genuine Single Line Comments, Extroversion has
a strong (positive) correlation with the tendency of writing
genuine Single Line Comments etc. We look to explore other
features in future. However, these features are not adequate
for predicting Agreeableness and Conscientiousness.
5.
SLC
NES
IS</p>
      <p>Positive example Negative example</p>
      <p>/** /*System.out.println(\Even");
* Make the hash table logically empty. printQ(qEven);
*/ System.out.println(\Odd");
printQ(qOdd);*/
// Create a new double-sized, empty table //String[] ss = linea.readLine().split(\ ");
for (int i=1; i&lt;=casos; i++) for (int i = 1; i&lt; = casos; i++)
import java.io.FileNotFoundException import java.io.*</p>
      <p>Method
Run1.txt</p>
      <p>Run2.txt
Baseline (bow)
Baseline (mean)
Reported best</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>P.</given-names>
            <surname>Costa</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>McCrae. The Revised NEO Personality Inventory (NEO-PI-R)</surname>
          </string-name>
          .
          <source>In The SAGE Handbook of Personality Theory and Assessment</source>
          , pages
          <volume>179</volume>
          {
          <fpage>198</fpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>G.</given-names>
            <surname>Farnadi</surname>
          </string-name>
          , G. Sitaraman,
          <string-name>
            <given-names>S.</given-names>
            <surname>Sushmita</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Celli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Kosinski</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Stillwell</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Davalos</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.-F. Moens</surname>
          </string-name>
          , and
          <string-name>
            <surname>M. De Cock</surname>
          </string-name>
          .
          <article-title>Computational personality recognition in social media. User Modeling and User-Adapted Interaction</article-title>
          , pages
          <volume>1</volume>
          {
          <fpage>34</fpage>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>F. M. R.</given-names>
            <surname>Pardo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Celli</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Rosso</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Potthast</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Stein</surname>
          </string-name>
          , and
          <string-name>
            <given-names>W.</given-names>
            <surname>Daelemans</surname>
          </string-name>
          .
          <article-title>Overview of the 3rd author pro ling task at PAN 2015</article-title>
          . In Working Notes of CLEF 2015 -
          <article-title>Conference and Labs of the Evaluation forum</article-title>
          , Toulouse, France, September 8-
          <issue>11</issue>
          ,
          <year>2015</year>
          .,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>F.</given-names>
            <surname>Rangel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Gonzalez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Restrepo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Montes</surname>
          </string-name>
          , and
          <string-name>
            <given-names>P.</given-names>
            <surname>Rosso</surname>
          </string-name>
          . Pan at re:
          <article-title>Overview of the pr-soco track on personality recognition in source code</article-title>
          .
          <source>In Working notes of FIRE 2016 - Forum for Information Retrieval Evaluation</source>
          , Kolkata, India, December 7-
          <issue>10</issue>
          ,
          <year>2016</year>
          ,
          <string-name>
            <given-names>CEUR</given-names>
            <surname>Workshop</surname>
          </string-name>
          <article-title>Proceedings</article-title>
          . CEUR-WS.org,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>E.</given-names>
            <surname>Stamatatos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Potthast</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F. M. R.</given-names>
            <surname>Pardo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Rosso</surname>
          </string-name>
          , and
          <string-name>
            <given-names>B.</given-names>
            <surname>Stein</surname>
          </string-name>
          .
          <article-title>Overview of the PAN/CLEF 2015 evaluation lab</article-title>
          .
          <source>In Experimental IR Meets Multilinguality</source>
          , Multimodality, and Interaction - 6th
          <source>International Conference of the CLEF Association, CLEF</source>
          <year>2015</year>
          , Toulouse, France, September 8-
          <issue>11</issue>
          ,
          <year>2015</year>
          , Proceedings, pages
          <volume>518</volume>
          {
          <fpage>538</fpage>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>