<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ubc.ca/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=RitikaJain</id>
	<title>UBC Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ubc.ca/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=RitikaJain"/>
	<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/Special:Contributions/RitikaJain"/>
	<updated>2026-06-03T15:31:59Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Variable_Elimination&amp;diff=466924</id>
		<title>Course:CPSC522/Variable Elimination</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Variable_Elimination&amp;diff=466924"/>
		<updated>2017-09-24T22:23:47Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* End of civilization? or Not? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:CPSC522]]&lt;br /&gt;
== Variable Elimination ==&lt;br /&gt;
Variable elimination(VE) is an algorithm to perform inference on Bayesian networks by manipulating conditional probabilities in the form of factors.&lt;br /&gt;
&lt;br /&gt;
Principal Author: Ritika Jain&lt;br /&gt;
&lt;br /&gt;
Collaborators: Tanuj Kr Aasawat, Prithu Banerjee&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
The most common type of query we often need to find the probabilities for; is of the form P(Y|E=e) where Y  is the set of variables that need to be queried and E is the set of observations we have made. &lt;br /&gt;
This can be computed using any entry of the full joint probability distribution table, given the conditional probability tables in the network and then do inference by enumeration as shown below.&lt;br /&gt;
&amp;lt;!--This should be a brief summary that tells us what is covered in this page. --&amp;gt;&lt;br /&gt;
;Given:&lt;br /&gt;
: a prior joint probability distribution(JPD) on a set of variables X.&lt;br /&gt;
: specific values &#039;e&#039; for the evidence variable E (subset of X).&lt;br /&gt;
;We need to compute:&lt;br /&gt;
: posterior joint distribution of query variables Y (a subset of X) given evidence &#039;e&#039;.&lt;br /&gt;
;Method:&lt;br /&gt;
:Step 1: condition to get distribution P(X|e).&lt;br /&gt;
:Step 2: marginalize to get distribution P(Y|e).&lt;br /&gt;
However, this method is extremely inefficient and does not scale well. We can perform better by taking advantage of variables independence. We can represent the joint probability distribution as a product of marginal distributions and simplify some terms when the variables involved are independent or conditionally independent. &lt;br /&gt;
== Background knowledge==&lt;br /&gt;
To understand variable elimination, we will first introduce the concept of [[Course:CPSC522/Variable_Elimination#Factors|factors]] and understand the [[Course:CPSC522/Variable_Elimination#Assigning_a_variable|operations]] that can be performed on them. This will be followed by the variable elimination algorithm, explained with an example. &lt;br /&gt;
===Factors=== &lt;br /&gt;
A factor is a function from a tuple of random variables to the real numbers R&lt;br /&gt;
We write a factor on variables X&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;,… ,X&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt; as f(X&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;,… ,X&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt;) &lt;br /&gt;
A factor denotes one or more (possibly partial) distributions over the given tuple of variables, e.g., P(X1,X2) is a factor f(X1,X2). We shall look at three basic operations on factors: assigning a variable, summing out a variable and multiplying factors.&lt;br /&gt;
====Assigning a variable====&lt;br /&gt;
We can assign values to some or all variables of an existing factor to create a new factor.&lt;br /&gt;
[[File:Factor1.png|right|Assigning a variable for factors]]&lt;br /&gt;
The value of variables which are not satisfied are not considered in the new factor.&lt;br /&gt;
&lt;br /&gt;
====Summing out a variable====&lt;br /&gt;
We can marginalize out (or sum out) a variable. Marginalizing out a variable X from a factor f(X&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;,...,X&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;) yields a new factor defined on {X&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;,...,X&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;} \ {X}&lt;br /&gt;
[[File:Factor2.png|Summing out a variable]]&lt;br /&gt;
&lt;br /&gt;
====Multiplying factors====&lt;br /&gt;
Two factors can be multiplied on the basis of a common variable to get a new factor. The product of factor f&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;(A,B) and f&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;(B,C) where B is the variable in common, is the factor (f&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; x f&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)(A,B,C) defined by: (f&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; x f&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;)(A,B,C) = f&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; (A,B) f&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;(B,C). The domain of f&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; x f&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; is AυBυC. This is shown in the figure below.&lt;br /&gt;
[[File:Factor3.png|600px|Multiplying factors]]&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
We can express the joint probability as a factor of observed variables and other variables not involved in the query. &lt;br /&gt;
f(Y, &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;E&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;,...,E&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt;,  &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt; Z&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;,...,Z&amp;lt;sub&amp;gt;k&amp;lt;/sub&amp;gt;&amp;lt;/span&amp;gt;). &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;E&amp;lt;/span&amp;gt;&#039;s are the observed variables and &amp;lt;span style=&amp;quot;color:blue&amp;quot;&amp;gt; Z&amp;lt;/span&amp;gt;&#039;s are the other variables not involved in the query.&lt;br /&gt;
We can compute P(Y, E&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;=e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;,....,E&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt;=e&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt;) by assigning E&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;=e&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;,....,E&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt;=e&amp;lt;sub&amp;gt;j&amp;lt;/sub&amp;gt; and marginalizing out variables Z&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;,...,Z&amp;lt;sub&amp;gt;k&amp;lt;/sub&amp;gt; one at a time. This is represented as:&lt;br /&gt;
[[File:F4.png|center|500px|Joint probability distribution as factors]]&lt;br /&gt;
The order in which the marginalization of variables is done is called the elimination order. Finding the [[Course:CPSC522/Variable_Elimination#Complexity|optimal elimination order]] is a NP complete problem.&lt;br /&gt;
&lt;br /&gt;
We know the joint probability distribution of a Bayesian network as:&lt;br /&gt;
[[File:Fig5.png|center|550px|Joint probability distribution]]&lt;br /&gt;
We can express the joint factor as a product of factors, one for each conditional probability.&lt;br /&gt;
[[File:Fig6.png|550px|center]]&lt;br /&gt;
Inference in Bayesian networks thus reduces to computing the above sum of products. This can be easily computed by &lt;br /&gt;
*partitioning factors into those that contain a particular &#039;Z&amp;lt;sub&amp;gt;k&amp;lt;/sub&amp;gt;&#039; and that do not.&lt;br /&gt;
*summing out &#039;Z&amp;lt;/sub&amp;gt;k&amp;lt;/sub&amp;gt;&#039; over all the factors that contain &#039;Z&amp;lt;sub&amp;gt;k&amp;lt;/sub&amp;gt;&#039;. We explain this by the following example.&lt;br /&gt;
[[File:Figex.png|center|400px|Example]]&lt;br /&gt;
In the example above, we initially have four factors f1(C,D), f2(A,B,D), f3(E,A) and f4(D). We have one unobserved variable A that we need to sum over. We partition the factors into the sets that contain A: f2(A,B,D) and f3(E,A) and that do not contain a: f1(C,D) and f4(D). We sum over only the factors that contain A. From previous operation  of [[Course:CPSC522/Variable_Elimination#Multiplying_factors| multiplication of factors]], we compute a new factor f5(A,B,D,E). [[Course:CPSC522/Variable_Elimination#Summing_out_a_variable|Summing out the variable]] A, we get a new factor f6(B,D,E).&lt;br /&gt;
===General case===&lt;br /&gt;
Decomposition of sum of products can be seen as a general case as follows:&lt;br /&gt;
[[File:Generalcase.png|500px|center|General_case]]&lt;br /&gt;
&lt;br /&gt;
==Algorithm==&lt;br /&gt;
To compute the conditional probability P(Y=y&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; | E=e), where E are the observed variables and Z are the variables not involved in the query, variable elimination algorithm[http://artint.info/html/ArtInt_148.html] dictates as follows:&lt;br /&gt;
1. Construct a factor for each conditional probability.&lt;br /&gt;
2. For each factor, assign the observed variables E to their observed values&lt;br /&gt;
&lt;br /&gt;
3. Given an elimination ordering, decompose sum of products.&lt;br /&gt;
&lt;br /&gt;
4. Sum out all variables Z&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt; not involved in the query.&lt;br /&gt;
&lt;br /&gt;
5.Multiply the remaining factors.&lt;br /&gt;
&lt;br /&gt;
6. Normalize by dividing the resulting factor f(Y) by Σ&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;f(Y) over all y.&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
Consider the following Bayesian network and the query P(G | H=h&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;). We consider a given elimination order A,C,E,I,B,D,F.&lt;br /&gt;
&lt;br /&gt;
[[File:Mainex.png|left|150px]]&lt;br /&gt;
&lt;br /&gt;
Essentially we need to compute Σ&amp;lt;sub&amp;gt;A,B,C,D,E,F,I&amp;lt;/sub&amp;gt;P(A,B,C,D,E,F,G,H,I). We sum over all the variables not involved in the query-A,B,C,D,E,F,I. Considering Bayesian independence, i.e., the current node depends only on its parent node, we can rewrite the above summation as: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(G,H)=\sum_{A,B,C,D,E,F,I} P(A) P(B | A) P(C) P(D | B,C) P(E | C) P(F | D) P(G | F,E) P(H | G) P(I | G). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&#039;&#039;&#039;Step 1: Construct a factor for each conditional probability.&#039;&#039;&#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Writing the probabilities as factors we get,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(G,H)=\sum_{A,B,C,D,E,F,I} f_0(A) f_1(B | A) f_2(C) f_3(D,B,C) f_4(E,C) f_5(F,D) f_6(G,F,E) f_7(H,G) f_8(I,G). &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&#039;&#039;&#039;Step 2: Assign to observed variables their observed values.&#039;&#039;&#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We start by observing H=h&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; as given in the query which changes the factor f&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; to f&amp;lt;sub&amp;gt;9&amp;lt;/sub&amp;gt;. Therefore we get, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(G,H=h_1)=\sum_{A,B,C,D,E,F,I} f_0(A) f_1(B | A) f_2(C) f_3(D,B,C) f_4(E,C) f_5(F,D) f_6(G,F,E) \color{red} {f_9(G)} \color{black}{f_8(I,G).} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&#039;&#039;&#039;Step 3: Decompose sum of products.&#039;&#039;&#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
According to the elimination order provided to us, we need to perform product and sum out A first, then C, then E and so on. All factors involving A will be considered in the summation of A as shown below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(G,H=h_1)=   f_9(G)  \sum_F  \sum_D f_5(F,D)  \sum_B \sum_If_8(I,G)  \sum_E f_6(G,F,E)  \sum_C f_2(C) f_3(D,B,C)f_4(E,C)  \color{blue}{\sum_A f_0(A) f_1(B | A)}. &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&#039;&#039;&#039;Step 4: Sum out non query variables (one at a time).&#039;&#039;&#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Performing product of f&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;(A) and f&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;(B,A) we get, f&amp;lt;sub&amp;gt;10&amp;lt;/sub&amp;gt;(B,A). Summing out A, we get f&amp;lt;sub&amp;gt;11&amp;lt;/sub&amp;gt;(B). This factor will be considered under the summing variable B as it does not depend on C,E,I (according to the elimination order) and therefore will be pushed outside of these sums.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(G,H=h_1)=  f_9(G)  \sum_F  \sum_Df_5(F,D)  \sum_B\color{red}{f_{11}(B)} \color{black}{\sum_If_8(I,G)  \sum_E f_6(G,F,E)  \sum_C f_2(C) f_3(D,B,C)f_4(E,C). }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Performing the product and summing out C, we get the factor f&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;(D,B,E). This factor will be pushed under the summation of E as E comes before B and D in the elimination order. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(G,H=h_1)=  f_9(G)  \sum_F  \sum_Df_5(F,D)  \sum_Bf_{11}(B) \sum_If_8(I,G)  \sum_E\color{blue}{f_{12}(D,B,E)} \color{black}{f_6(G,F,E).} &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly multiplying f&amp;lt;sub&amp;gt;12&amp;lt;/sub&amp;gt;(D,B,E)&amp;lt;/span&amp;gt;f&amp;lt;sub&amp;gt;6&amp;lt;/sub&amp;gt;(G,F,E) and summing out E, we get the factor f&amp;lt;sub&amp;gt;13&amp;lt;/sub&amp;gt;(B,D,F,G),&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(G,H=h_1)=  f_9(G)  \sum_F  \sum_Df_5(F,D)  \sum_Bf_{11}(B)\color{red}{f_{13}(B,D,F,G)} \color{black} { \sum_If_8(I,G).}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Continuing on these lines, we finally end up with;&lt;br /&gt;
&amp;lt;math&amp;gt;P(G,H=h_1)=  f_9(G)f_{14}(G)f_{17}(G).&amp;lt;/math&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&#039;&#039;&#039;Step5: Multiply remaining factors.&#039;&#039;&#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Multiplying all the remaining factors in G, we get,&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(G,H=h_1)=  f_{18}(G)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&#039;&#039;&#039;Step 6: Normalize&#039;&#039;&#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P(G=g | H=h_1) = \frac{P(G=g, H=h_1)}{\sum_{g&#039; \in dom(G)} P(G=g&#039;,H=h_1)} = \frac{f_{17}(g)}{\sum_{g&#039; \in dom(G)} f_{17}(g&#039;)}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Further optimizations===&lt;br /&gt;
In the previous example we did not take advantage of the conditional independence in the Bayesian network. &lt;br /&gt;
 &lt;br /&gt;
#Conditional Independence:&amp;lt;br /&amp;gt;Before we run variable elimination, we can reduce the nodes we need to consider by pruning all variables Z that are conditionally independent of the query Y given evidence E: Z &amp;lt;math&amp;gt; \perp\!\!\!\perp&amp;lt;/math&amp;gt; Y | E. &amp;lt;br&amp;gt;&#039;&#039;&#039;Example:&#039;&#039;&#039; Considering the same Bayesian network, for the query P(G=g | C=c&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, F=f&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;, H=h&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;); we can prune elements A,B and D because both paths from these nodes to G are blocked.&amp;lt;/br&amp;gt; &lt;br /&gt;
#*F is observed node. &lt;br /&gt;
#*C is an observed common parent.&lt;br /&gt;
#Unobserved Leaf Nodes:&amp;lt;br/&amp;gt;We can also prune the unobserved leaf nodes since they are unobserved and also not the predecessors of the query nodes, they will not have any effect on the posterior probability of the query nodes.Therefore in the above example, we can prune variable I. We only need to run Variable Elimination on this reduced subnetwork as shown below.[[File:Subnet.png|150px|center|Subnetwork]]This makes the entire process more efficient and reduces the runtime complexity.&lt;br /&gt;
&lt;br /&gt;
===Complexity===&lt;br /&gt;
A factor over n binary variables needs to store 2&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt; numbers. The initial factors are usually small because variables have only a few parents in the Bayesian network, but after product, the factors tend to get large. The complexity of Variable Elimination is exponential in the maximum number of variables in any factor during its execution. This is also called the treewidth of a graph (along a particular variable elimination order). Finding the most optimal variable elimination order (i.e the one which gives the minimum treewidth) is NP complete. However, heuristics such as ordering the least connected variables first work well in practice.&lt;br /&gt;
&lt;br /&gt;
==AISpace Demo==&lt;br /&gt;
===End of civilization? or Not?===&lt;br /&gt;
We look at a demo example from AISpace[http://www.aispace.org/exercises/exercise6-c-1.shtml] which uses variable elimination to answer some interesting questions- Is it the end of civilization? &lt;br /&gt;
&lt;br /&gt;
The scenario is:&lt;br /&gt;
Bill has noticed that his morning newspaper delivery has been sporadic. There are several relevant variables relating to whether or not the paper is delivered. Delivery is dependent on the paper having been successfully printed the previous night. Possible explanations for a paper not having been printed are a malfunction at the printing press, or the end of civilization as we know it.&lt;br /&gt;
&lt;br /&gt;
The probabilities assigned are:&lt;br /&gt;
The prior probability of a printer malfunction is 0.05. Bill has been noticing some ominous signs of the apocalypse and so expects the end of civilization with a relatively high probability of 0.001. If the end of civilization is here, then the paper not be printed for sure. If there is a printing malfunction and no end of civilization, there is a probability of 0.05 that the paper will be printed (this is non-zero because the malfunction might be fixed in time). If there is no malfunction and no end of civilization, there is a probability of 0.99 that the paper will be printed. If the paper is not printed it will not be delivered. If it is printed, there is a probability of 0.9 that it will be delivered. The fact that this probability is not 1 suggests that there are other possible causes for the paper not being delivered that we should eventually add to our belief network (e.g. the paperboy being sick).&lt;br /&gt;
A short demo[https://www.youtube.com/watch?v=qA3RJbaYqaY] that I have created can be viewed here:&lt;br /&gt;
{{#widget:YouTube|id=qA3RJbaYqaY|height=315|width=420}}&lt;br /&gt;
&lt;br /&gt;
==Applications==&lt;br /&gt;
Variable elimination[https://www.cs.cmu.edu/~epxing/Class/10708.../scribe_note_lecture4.pdf] is a general technique for constraint processing. When combined with other techniques, it can be extremely useful for solving many problems arising in domains such as resource allocation, combinatorial auctions, bioinformatics and probabilistic reasoning that can be naturally modelled as constraint satisfaction and optimization problems. &lt;br /&gt;
Finding the posteriori belief has multiple applications in statistical analysis and learning. Given a causal trail, calculating the conditional probability of effects given causes is called prediction. In this case, the query node is a descendant of the evidence. Diagnosis is calculating the conditional probability of causes given effects, and this is useful in finding the probability of a disease given the symptoms. In this case, the query node is an ancestor of the evidence node in the trail. While learning under partial observation, posteriori belief of the unobserved variables given the observed ones is calculated.&lt;br /&gt;
Variable elimination works equally well for both Bayesian networks and Markovian networks.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
1.  [http://artint.info/html/ArtInt_149.html David Poole &amp;amp; Alan Mackworth, &amp;quot;Artificial Intelligence: Foundations of Computational Agents&amp;quot;,]&amp;lt;br/&amp;gt;&lt;br /&gt;
2. [http://www.aispace.org/exercises/exercise6-c-1.shtml AISpace]&amp;lt;br/&amp;gt;&lt;br /&gt;
3. [https://www.youtube.com/watch?v=qA3RJbaYqaY Youtube demo]&amp;lt;br/&amp;gt;&lt;br /&gt;
4. [https://www.cs.cmu.edu/~epxing/Class/10708.../scribe_note_lecture4.pdf CMU lecture notes]&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==To add==&lt;br /&gt;
-Link to Bayesian network&lt;br /&gt;
-&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=466923</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=466923"/>
		<updated>2017-09-24T22:19:36Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this [http://www.wired.com/2014/01/how-to-hack-okcupid/ Math geek]&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create an almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives me the option to find matches according to preferred age, orientation, and location of who I want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just &#039;&#039;&#039;multiply&#039;&#039;&#039; your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error&#039;&#039;&#039;. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an &#039;&#039;&#039;OkCupid scraping bot&#039;&#039;&#039; written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The attributes are the questions that users have answered and the rows correspond to answers by each user to those questions.&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062),i.e. choosing those questions which have been answered by all the users (having 0% missing data) &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt; I select the four attributes from the left pane and remove the rest of the attributes, and then i click on the cluster tab to perform k-means clustering on this selected data.&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
Broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
&amp;lt;/br&amp;gt;                                  Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as: &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;                             For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410709</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410709"/>
		<updated>2016-04-23T07:06:25Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Training */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this [http://www.wired.com/2014/01/how-to-hack-okcupid/ Math geek]&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just &#039;&#039;&#039;multiply&#039;&#039;&#039; your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error&#039;&#039;&#039;. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an &#039;&#039;&#039;OkCupid scraping bot&#039;&#039;&#039; written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The attributes are the questions that users have answered and the rows correspond to answers by each user to those questions.&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062),i.e. choosing those questions which have been answered by all the users (having 0% missing data) &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt; I select the four attributes from the left pane and remove the rest of the attributes, and then i click on the cluster tab to perform k-means clustering on this selected data.&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
Broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
&amp;lt;/br&amp;gt;                                  Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as: &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;                             For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410707</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410707"/>
		<updated>2016-04-23T07:01:36Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Crawling data from OkCupid&amp;#039;s website */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this [http://www.wired.com/2014/01/how-to-hack-okcupid/ Math geek]&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just &#039;&#039;&#039;multiply&#039;&#039;&#039; your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error&#039;&#039;&#039;. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an &#039;&#039;&#039;OkCupid scraping bot&#039;&#039;&#039; written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The attributes are the questions that users have answered and the rows correspond to answers by each user to those questions.&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
Broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
&amp;lt;/br&amp;gt;                                  Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as: &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;                             For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Analyzing_online_dating_trends_with_Weka/Critique/reply&amp;diff=410706</id>
		<title>Thread:Course talk:CPSC522/Analyzing online dating trends with Weka/Critique/reply</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Analyzing_online_dating_trends_with_Weka/Critique/reply&amp;diff=410706"/>
		<updated>2016-04-23T06:59:48Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: Reply to Critique&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi Tanuj,&amp;lt;/br&amp;gt;&lt;br /&gt;
I&#039;m glad you liked my page. Thank you so much for your feedback. I have tried elaborating upon the figures to make it easy for the reader to understand. &amp;lt;/br&amp;gt;&lt;br /&gt;
Thank you again for your inputs.&amp;lt;/br&amp;gt;&lt;br /&gt;
Ritika&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Analyzing_online_dating_trends_with_Weka/Comments/reply&amp;diff=410704</id>
		<title>Thread:Course talk:CPSC522/Analyzing online dating trends with Weka/Comments/reply</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Analyzing_online_dating_trends_with_Weka/Comments/reply&amp;diff=410704"/>
		<updated>2016-04-23T06:57:56Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: Reply to Comments&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi Yan Zhao,&amp;lt;/br&amp;gt;&lt;br /&gt;
Thanks so much for your feedback. I have tried to elaborate upon the figures for users not familiar with Weka. And I&#039;ve also worked on my results. &amp;lt;/br&amp;gt;&lt;br /&gt;
Thanks again,&amp;lt;/br&amp;gt;&lt;br /&gt;
Ritika&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Analyzing_online_dating_trends_with_Weka/Feedback/reply&amp;diff=410701</id>
		<title>Thread:Course talk:CPSC522/Analyzing online dating trends with Weka/Feedback/reply</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Analyzing_online_dating_trends_with_Weka/Feedback/reply&amp;diff=410701"/>
		<updated>2016-04-23T06:55:10Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: Reply to Feedback&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi Ricky,&amp;lt;/br&amp;gt;&lt;br /&gt;
* I did not respond to Deadpoolz2 :P &amp;lt;/br&amp;gt;&lt;br /&gt;
* I guess I kept my page a little informal to keep things interesting and the readers engaged. Don&#039;t know if that worked well with everyone, but that was my thinking behind it. &amp;lt;/br&amp;gt;&lt;br /&gt;
* So the questions are the attributes and the answers to these questions are my values between which I am calculating the distance. Since the attributes are categorical, my Euclidean distance(in K-means) works like: if they have the same answer, distance is 1; 0 if they have different answers. &amp;lt;/br&amp;gt;&lt;br /&gt;
* I am not defining the error, this is how OkCupid finds your true percentage. The error is with regards to finding the true percentage, not with my experimental error.&amp;lt;/br&amp;gt;&lt;br /&gt;
* So initially I am clustering the data and then checking if the rest of data is actually falling in the clusters. I tried with just training as well; they gave me the same clusters (so that&#039;s positive)&amp;lt;/br&amp;gt;&lt;br /&gt;
* In my first set of experiments, I used just four of the most popular attributes (which everyone had answered, i.e. no missing data). I have extended it to incorporate more attributes (as I did in my presentation and my wikipage now).&amp;lt;/br&amp;gt;&lt;br /&gt;
* With better granularity on the data, with more attributes with higher variance we can get better clusters. Since in the experiment with 4 attributes those questions were answered almost same by everyone. &amp;lt;/br&amp;gt;&lt;br /&gt;
Ritika&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Improving_the_accuracy_of_Affect_Prediction_in_an_Intelligent_Tutoring_System/Suggestions_for_Improving_the_accuracy_of_Affect_Prediction_in_an_Intelligent_Tutoring_System/reply_(2)&amp;diff=410591</id>
		<title>Thread:Course talk:CPSC522/Improving the accuracy of Affect Prediction in an Intelligent Tutoring System/Suggestions for Improving the accuracy of Affect Prediction in an Intelligent Tutoring System/reply (2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Improving_the_accuracy_of_Affect_Prediction_in_an_Intelligent_Tutoring_System/Suggestions_for_Improving_the_accuracy_of_Affect_Prediction_in_an_Intelligent_Tutoring_System/reply_(2)&amp;diff=410591"/>
		<updated>2016-04-23T01:24:07Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: Reply to [[Thread:Course talk:CPSC522/Improving the accuracy of Affect Prediction in an Intelligent Tutoring System/Suggestions for Improving the accuracy of Affect Prediction in an Intelligent Tutoring System/reply|Suggestions for Improving the accura...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Thanks for your clarifications Abed. I am still a little uncomfortable with how the user can be bored and curious at the same time and I don&#039;t see why they should overlap, but I guess those are just model parameters which you chose to use this way, which is perfectly fine. &lt;br /&gt;
&amp;lt;/br&amp;gt;As for the links, I am able to go from within your wiki page to the references and vice versa but not able to go to the actual page on the web. For instance where you have sited the papers, I cannot access those papers from your wikipage. I think the web url is missing in the references. You could refer to my page, &#039;Analysing online dating trends using Weka&#039;; the reference section to see how to link it to the pages outside of wiki. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Rest all looks good!&amp;lt;/br&amp;gt;&lt;br /&gt;
Ritika&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Analyzing_online_dating_trends_with_Weka/Suggestions/reply_(2)&amp;diff=410590</id>
		<title>Thread:Course talk:CPSC522/Analyzing online dating trends with Weka/Suggestions/reply (2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Analyzing_online_dating_trends_with_Weka/Suggestions/reply_(2)&amp;diff=410590"/>
		<updated>2016-04-23T01:18:24Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: Reply to Suggestions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi Samprity,&amp;lt;/br&amp;gt;&lt;br /&gt;
I have made the suggested changes in my page. Thanks so much for your feedback! Let me know if there is anything else that needs modification. &amp;lt;/br&amp;gt;&lt;br /&gt;
Thanks,&amp;lt;/br&amp;gt;&lt;br /&gt;
Ritika&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410589</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410589"/>
		<updated>2016-04-23T01:15:53Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Hypothesis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this [http://www.wired.com/2014/01/how-to-hack-okcupid/ Math geek]&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just &#039;&#039;&#039;multiply&#039;&#039;&#039; your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error&#039;&#039;&#039;. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an &#039;&#039;&#039;OkCupid scraping bot&#039;&#039;&#039; written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
Broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
&amp;lt;/br&amp;gt;                                  Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as: &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;                             For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410588</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410588"/>
		<updated>2016-04-23T01:15:40Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Hypothesis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this [http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
 Math geek]&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just &#039;&#039;&#039;multiply&#039;&#039;&#039; your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error&#039;&#039;&#039;. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an &#039;&#039;&#039;OkCupid scraping bot&#039;&#039;&#039; written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
Broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
&amp;lt;/br&amp;gt;                                  Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as: &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;                             For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410587</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410587"/>
		<updated>2016-04-23T01:15:05Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Examples of matches */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just &#039;&#039;&#039;multiply&#039;&#039;&#039; your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error&#039;&#039;&#039;. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an &#039;&#039;&#039;OkCupid scraping bot&#039;&#039;&#039; written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
Broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
&amp;lt;/br&amp;gt;                                  Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as: &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;                             For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410586</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410586"/>
		<updated>2016-04-23T01:14:23Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Crawling data from OkCupid&amp;#039;s website */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an &#039;&#039;&#039;OkCupid scraping bot&#039;&#039;&#039; written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
Broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
&amp;lt;/br&amp;gt;                                  Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as: &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;                             For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410585</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410585"/>
		<updated>2016-04-23T01:13:12Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
Broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
&amp;lt;/br&amp;gt;                                  Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as: &#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;                             For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410584</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410584"/>
		<updated>2016-04-23T01:12:42Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
Broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
&amp;lt;/br&amp;gt;                                  Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;                             For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410583</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410583"/>
		<updated>2016-04-23T01:12:03Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
Broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
&amp;lt;/br&amp;gt;                                  Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&amp;lt;/br&amp;gt;                             For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410582</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410582"/>
		<updated>2016-04-23T01:11:25Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
&amp;lt;/br&amp;gt;                                  Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&amp;lt;/br&amp;gt;&lt;br /&gt;
Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;                             For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410581</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410581"/>
		<updated>2016-04-23T01:10:54Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
&amp;lt;/br&amp;gt;                                  Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&amp;lt;/br&amp;gt;                             For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410580</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410580"/>
		<updated>2016-04-23T01:10:18Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
                                     Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
&amp;lt;/br&amp;gt;                          For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410579</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410579"/>
		<updated>2016-04-23T01:09:40Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the &#039;&#039;&#039;4 most popular&#039;&#039;&#039; questions: &#039;&#039;&#039;q34113&#039;&#039;&#039;, &#039;&#039;&#039;q85419&#039;&#039;&#039;, &#039;&#039;&#039;q416235&#039;&#039;&#039; and &#039;&#039;&#039;q20062&#039;&#039;&#039; as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;True Match = Calculated Match +/- Reasonable Margin of Error.&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=&#039;&#039;&#039;75%&#039;&#039;&#039;. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose &#039;&#039;&#039;31 attributes&#039;&#039;&#039;, which gives me &#039;&#039;&#039;7 clusters&#039;&#039;&#039;. We calculate the &#039;&#039;&#039;true match rate&#039;&#039;&#039; as 100-(100/31)%=100-3.22%=&#039;&#039;&#039;96.78%&#039;&#039;&#039; which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410578</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410578"/>
		<updated>2016-04-23T01:07:25Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. &amp;lt;/br&amp;gt;&lt;br /&gt;
In my next set of experiments, I chose 31 attributes, which gives me 7 clusters. We calculate the true match rate as 100-(100/31)%=100-3.22%=96.78% which is greater than 90% as proposed in the hypothesis. Therefore I have clustered the dating population into 7 clusters based on the 31 most popular attributes and I claim that answering the questions based on the mean cluster answers for each cluster would get a user match rate higher than 90% for that cluster.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410508</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410508"/>
		<updated>2016-04-22T23:27:02Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Clustering with 31 most popular attributes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q16053:&#039;&#039;&#039; How willing are you to meet someone from OkCupid?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q64664:&#039;&#039;&#039; Do you think it is okay to open old graves to get more knowledge of ancient cultures and their history?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you like to drink outside of a meal(such as for leisure)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q179268:&#039;&#039;&#039; Are you either vegetarian or vegan?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358077:&#039;&#039;&#039; Could you date someone who was really messy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q358084:&#039;&#039;&#039; Do you enjoy intense intellectual conversations?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles? &lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_gender:&#039;&#039;&#039; Man, woman, transgender, transfeminine, agender&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_religion_type:&#039;&#039;&#039; Atheism, Agnosticism, Christianity, Judaism, Catholicism, Buddhism, Hinduism, Islam&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_smokes:&#039;&#039;&#039; No, yes, sometimes, trying to quit, when drinking&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;d_drinks:&#039;&#039;&#039; Socially, rarely, often, not at all, very often, desperately&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q_20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life if your lover asked you to squeal like a dolphin, would you?&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Comparison for some attributes on clusters 4, 5, 6:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Question&lt;br /&gt;
!Cluster 4 ans&lt;br /&gt;
! Cluster 5 ans&lt;br /&gt;
!Cluster 6 ans&lt;br /&gt;
|-&lt;br /&gt;
| Regardless of future plans, what is more important to you right now, love or sex?&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
| Love&lt;br /&gt;
|-&lt;br /&gt;
| How important is religion/God in your life?&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
| Not important&lt;br /&gt;
|-&lt;br /&gt;
| Would you prefer good things happened to you or interesting things?&lt;br /&gt;
| Good&lt;br /&gt;
| Good&lt;br /&gt;
| Interesting&lt;br /&gt;
|-&lt;br /&gt;
| Which would you rather be, normal or weird?&lt;br /&gt;
| Normal&lt;br /&gt;
| Weird &lt;br /&gt;
| Weird&lt;br /&gt;
|-&lt;br /&gt;
| Which describes you better, intense or carefree?&lt;br /&gt;
| Carefree &lt;br /&gt;
| Intense&lt;br /&gt;
| Carefree&lt;br /&gt;
|-&lt;br /&gt;
| What&#039;s your relationship with marijuana?&lt;br /&gt;
| Never&lt;br /&gt;
| Missing&lt;br /&gt;
| Occasionally&lt;br /&gt;
|- &lt;br /&gt;
| What do you prefer, cats or dogs or both?&lt;br /&gt;
| Dogs&lt;br /&gt;
| Dogs&lt;br /&gt;
| Both&lt;br /&gt;
|-&lt;br /&gt;
| Would you consider having an open relationship?&lt;br /&gt;
| No &lt;br /&gt;
| No&lt;br /&gt;
| Yes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410501</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410501"/>
		<updated>2016-04-22T22:32:08Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
====Clustering with 31 most popular attributes====&lt;br /&gt;
In these set of experiments, I consider 31 most popular attributes which have missing data &amp;lt; 34%. The attributes are as follows:&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q35:&#039;&#039;&#039; Regardless of future plans, what&#039;s more interesting to you right now, love or sex?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q41:&#039;&#039;&#039; How important is religion/God in your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q46:&#039;&#039;&#039; Would you prefer good things happened or interesting?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q48:&#039;&#039;&#039; Which would you rather be? Normal or weird?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q49:&#039;&#039;&#039; Which word describes you better? Carefree or intense?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q70:&#039;&#039;&#039; Do you think homosexuality is a sin? yes or no?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q77:&#039;&#039;&#039; How frequently do you drink alcohol?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q79:&#039;&#039;&#039; What&#039;s your relationship with marijuana?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q123:&#039;&#039;&#039; Would you strongly prefer to go out with someone of your own skin color/ racial background?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q325:&#039;&#039;&#039; Would you consider having an open relationship (i.e. one where you can see other people)?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q403:&#039;&#039;&#039; Do you enjoy discussing politics?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q501:&#039;&#039;&#039; Have you smoked cigarette in the last six months?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q553:&#039;&#039;&#039; Do spelling mistakes annoy you?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q997:&#039;&#039;&#039; Are you a cat person or a dog person?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1440:&#039;&#039;&#039; Is jealousy healthy in a relationship?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q1597:&#039;&#039;&#039; Would you consider sleeping with someone on the first date?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q4018:&#039;&#039;&#039; Are you happy with your life?&lt;br /&gt;
&amp;lt;/br&amp;gt;&#039;&#039;&#039;q9688:&#039;&#039;&#039; Could you date someone who does drugs?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The clustering visualization is shown below. Cross validation gives us k of size 7 as shown below. &amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Clusters10.png|thumb|center|700px|Cluster visualization for 31 attributes (7 clusters)]] &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
Clustered instances:&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 0&lt;br /&gt;
| 4%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 1&lt;br /&gt;
| 2%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 2&lt;br /&gt;
| 0%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 3&lt;br /&gt;
| 28%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 4&lt;br /&gt;
| 21%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 5&lt;br /&gt;
| 31%&lt;br /&gt;
|-&lt;br /&gt;
!Cluster 6&lt;br /&gt;
| 12%&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=File:Clusters10.png&amp;diff=410496</id>
		<title>File:Clusters10.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=File:Clusters10.png&amp;diff=410496"/>
		<updated>2016-04-22T22:24:17Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: User created page with UploadWizard&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=={{int:filedesc}}==&lt;br /&gt;
{{Information&lt;br /&gt;
|description={{en|1=Cluster visualization for 31 attributes (10 clusters)}}&lt;br /&gt;
|date=2016-04-22 15:23:24&lt;br /&gt;
|source={{own}}&lt;br /&gt;
|author=[[User:RitikaJain|RitikaJain]]&lt;br /&gt;
|permission=&lt;br /&gt;
|other_versions=&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
=={{int:license-header}}==&lt;br /&gt;
{{self|cc-by-sa-3.0}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Uploaded with UploadWizard]]&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410483</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=410483"/>
		<updated>2016-04-22T22:05:53Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Cluster Visualization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/MarchApril2016&amp;diff=409986</id>
		<title>Course:CPSC522/MarchApril2016</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/MarchApril2016&amp;diff=409986"/>
		<updated>2016-04-21T14:31:12Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Thursday April 21 - Room ICCS 104 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==March/April Assignment==&lt;br /&gt;
Your third and final assignment is to create a hypothesis related to the course and test it. Your result should describe the hypothesis and whether it works. The reader should be able to understand the background, what the the hypothesis is, whether the hypothesis is true, and the evidence you used to come to this conclusion. Your hypothesis can be theoretical or practical. &lt;br /&gt;
&lt;br /&gt;
==Extra Rules==&lt;br /&gt;
* You need to follow the rules on the main page and you should follow the guidelines there.&lt;br /&gt;
* Each page should have a principle author. You do not need co-authors but can have co-authors; co-authorship is encouraged. If others help you with your page, you should help them too.&lt;br /&gt;
* You need to add your page to the table of contents in a position that makes sense. Fell free to edit and change the structure of the table of content to give it a coherent structure.&lt;br /&gt;
* You will need to give a presentation of approximately 6 minutes + 2 minutes for questions; do not go over!  If you would like to give a presentation during term time please contact David. For those who do not want to present during class time, we will have a presentation session during exam time.&lt;br /&gt;
* If you want to choose a topic that is related to other previous or current  courses you need to negotiate with the instructor(s) to make sure you are not counting the same work multiple times. &lt;br /&gt;
* You should refer to wiki pages and to other research papers as appropriate. &lt;br /&gt;
===Key Dates===&lt;br /&gt;
* March 23 - create a pages that including an explicit statement of your hypothesis, and how you intend to test your hypothesis. &lt;br /&gt;
* April 17 - First Draft ready for critiquing&lt;br /&gt;
* April 20 - Critiques due&lt;br /&gt;
* April 22 - Final pages ready for marking&lt;br /&gt;
* April 27 - Marking Completed&lt;br /&gt;
&lt;br /&gt;
===Marking Scheme===&lt;br /&gt;
Here are some questions to take into account marking. This is subject to change. Feel free to add questions, and edit the questions if they do not make sense.&lt;br /&gt;
&lt;br /&gt;
* The topic is relevant for the course.&lt;br /&gt;
* The writing is clear and the English is good.&lt;br /&gt;
* The page is written at an appropriate level for CPSC 522 students (where the students have diverse backgrounds).&lt;br /&gt;
* The formalism (definitions, mathematics) was well chosen to make the page easier to understand.&lt;br /&gt;
* The abstract is a concise and clear summary.&lt;br /&gt;
* There were appropriate (original) examples that helped make the topic clear.&lt;br /&gt;
* There was appropriate use of (pseudo-) code.&lt;br /&gt;
* It had a good coverage of representations, semantics, inference and learning (as appropriate for the topic).&lt;br /&gt;
* It is correct.&lt;br /&gt;
* It was neither too short nor too long for the topic.&lt;br /&gt;
* It was an appropriate unit for a page (it shouldn&#039;t be split into different topics or merged with another page).&lt;br /&gt;
* It links to appropriate other pages in the wiki.&lt;br /&gt;
* The references and links to external pages are well chosen.&lt;br /&gt;
* I would recommend this page to someone who wanted to find out about the topic.&lt;br /&gt;
* This page should be highlighted as an exemplary page for others to emulate.&lt;br /&gt;
&lt;br /&gt;
If I was grading it out of 20, I would give it:&lt;br /&gt;
&lt;br /&gt;
Justification for the mark that will help the student in the future:&lt;br /&gt;
&lt;br /&gt;
===Presentation Schedule===&lt;br /&gt;
&lt;br /&gt;
==Tuesday April 19 - Room ICCS 144==&lt;br /&gt;
cancelled&lt;br /&gt;
&lt;br /&gt;
==Thursday April 21 - Room ICCS 104==&lt;br /&gt;
* Samprity Kashyap&lt;br /&gt;
* Ke Dai&lt;br /&gt;
* Arthur Sun&lt;br /&gt;
* Prithu Banerjee&lt;br /&gt;
* Ritika Jain&lt;br /&gt;
* Bahare Fatemi&lt;br /&gt;
* Adnan Reza&lt;br /&gt;
* Abed Rahman&lt;br /&gt;
* Junyuan Zheng&lt;br /&gt;
* Mehrdad Ghomi&lt;br /&gt;
* Ricky Chen&lt;br /&gt;
* Yu Yan&lt;br /&gt;
* Jordon Johnson&lt;br /&gt;
* Yan Zhao&lt;br /&gt;
* Dandan Wang&lt;br /&gt;
* Jiahong Chen&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course_talk:CPSC522/Titanic:_Machine_Learning_from_Disaster&amp;diff=409709</id>
		<title>Course talk:CPSC522/Titanic: Machine Learning from Disaster</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course_talk:CPSC522/Titanic:_Machine_Learning_from_Disaster&amp;diff=409709"/>
		<updated>2016-04-20T20:02:24Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: Talk page autocreated when first thread was posted&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Titanic:_Machine_Learning_from_Disaster/Suggestions_for_Titanic:_Machine_Learning_from_Disaster&amp;diff=409708</id>
		<title>Thread:Course talk:CPSC522/Titanic: Machine Learning from Disaster/Suggestions for Titanic: Machine Learning from Disaster</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Titanic:_Machine_Learning_from_Disaster/Suggestions_for_Titanic:_Machine_Learning_from_Disaster&amp;diff=409708"/>
		<updated>2016-04-20T20:02:24Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: New thread: Suggestions for Titanic: Machine Learning from Disaster&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi Junyuan,&amp;lt;/br&amp;gt;&lt;br /&gt;
I enjoyed going through your page. I think you have very clearly explained the hypothesis, problem description and how you proceed towards solving it. Some suggestions and queries I had are outlined below:&amp;lt;/br&amp;gt;&lt;br /&gt;
1. It would be great if you could proof read once because there are typos and grammatical errors; some of which hinder in understanding what you are trying to convey.&amp;lt;/br&amp;gt;&lt;br /&gt;
2. You might want to explain the attributes: for instance for the attribute Embarked, what do S,C and Q stand for? What does Parch stand for?&lt;br /&gt;
Under your section, Using probability method to fill missing age value; you might want to explain what PMM-predictive mean matching stands for and maybe in a line or two explain how it works.&amp;lt;/br&amp;gt;&lt;br /&gt;
3. I think it was really clever how you used title and relevant attributes to guess the age of the person. In rare title, do you mean titles like Dr.? &amp;lt;/br&amp;gt;&lt;br /&gt;
4. You could give links to refer to RMSE and &amp;lt;math&amp;gt;R_2&amp;lt;/math&amp;gt; because a layman user might not know these standards of comparison.&amp;lt;/br&amp;gt;&lt;br /&gt;
5. If my understanding of ensemble methods is correct, it creates and combines multiple models to sort of average out the errors. I am not sure how multiple models are created and combined in your ensemble NN. And why do you chose to ignore the attribute FamilyID in your second set of implementations. You could probably explain this more explicitly in your page.&amp;lt;/br&amp;gt;&lt;br /&gt;
6. So if i understand correctly; in conclusion, because of insufficient unique data you are unable to train your neural network properly because of which you cannot use it to give a good prediction on your age attribute&#039;s missing values. You could consider adding a Conclusion, Discussion and Future work section to give the readers a better idea of what you have established and what could be further checked.   &amp;lt;/br&amp;gt;&lt;br /&gt;
Thanks for a great page!&amp;lt;/br&amp;gt;&lt;br /&gt;
Ritika&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course_talk:CPSC522/Improving_the_accuracy_of_Affect_Prediction_in_an_Intelligent_Tutoring_System&amp;diff=409603</id>
		<title>Course talk:CPSC522/Improving the accuracy of Affect Prediction in an Intelligent Tutoring System</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course_talk:CPSC522/Improving_the_accuracy_of_Affect_Prediction_in_an_Intelligent_Tutoring_System&amp;diff=409603"/>
		<updated>2016-04-20T06:38:23Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: Talk page autocreated when first thread was posted&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Improving_the_accuracy_of_Affect_Prediction_in_an_Intelligent_Tutoring_System/Suggestions_for_Improving_the_accuracy_of_Affect_Prediction_in_an_Intelligent_Tutoring_System&amp;diff=409602</id>
		<title>Thread:Course talk:CPSC522/Improving the accuracy of Affect Prediction in an Intelligent Tutoring System/Suggestions for Improving the accuracy of Affect Prediction in an Intelligent Tutoring System</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Improving_the_accuracy_of_Affect_Prediction_in_an_Intelligent_Tutoring_System/Suggestions_for_Improving_the_accuracy_of_Affect_Prediction_in_an_Intelligent_Tutoring_System&amp;diff=409602"/>
		<updated>2016-04-20T06:38:23Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: New thread: Suggestions for Improving the accuracy of Affect Prediction in an Intelligent Tutoring System&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi Abed,&amp;lt;/br&amp;gt;&lt;br /&gt;
I liked the concept of your project and I also think you have structured your page very well. It has a very neat and clean layout. Some suggestions and queries that I had are outlined below:&amp;lt;/br&amp;gt;&lt;br /&gt;
1. I think there is some typing error in your hypothesis. You were probably meaning to say that PCA and wrapper features have previously been used but now you try to increase the accuracy  of the model by using Logistic with L1 and ensemble methods?&amp;lt;/br&amp;gt;&lt;br /&gt;
2. I am unable to access any of your references. You might want to double check your links. &lt;br /&gt;
3. You could probably add a line or two on Intelligent Tutoring Systems(ITSs) and make this abbreviation explicit.&lt;br /&gt;
4. When you mention that the you try to avoid the use of sensors to make the study as unobtrusive as possible so that the user is not distracted, don’t you think when you ask the user to take regular self-report prompts by clicking on the radio button; that is more distracting and might even annoy the test takers?&lt;br /&gt;
5. How was the data collected from the undergraduate students? was it like a questionnaire or was it like a radio button they had to click while gazing at a screen?&lt;br /&gt;
6. Its not very clear to me why both emotions boredom and curiosity are treated separately? Because how can a user be bored and curious at the same time?&lt;br /&gt;
7. I don’t know if its possible, but you might want to show some snapshots of what your dataset looks like. How did you attribute numerical values to features like boredom and curiosity? Was it the number of people who clicked on boredom in some time interval were accounted for? Also have you considered levels of boredom’ for instance ‘a little bored, very bored, dying to get out bored’; maybe as a future work. &lt;br /&gt;
8. Why does voting ensemble method have the highest accuracy for boredom but Stacked RBF for curiosity.&amp;lt;/br&amp;gt;&lt;br /&gt;
Also, maybe if you could provide us with a little bit more intuition on your statistical analysis or some background on the terms in one or two lines, because even though you have provided with links to read them; there are too many and without which the whole section is a little hard to understand. &amp;lt;/br&amp;gt;&lt;br /&gt;
Thanks for introducing me to the research work going on in the field of ITSs.&amp;lt;/br&amp;gt;&lt;br /&gt;
Regards,&amp;lt;/br&amp;gt;&lt;br /&gt;
Ritika&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Analyzing_online_dating_trends_with_Weka/Suggestions/reply&amp;diff=409600</id>
		<title>Thread:Course talk:CPSC522/Analyzing online dating trends with Weka/Suggestions/reply</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Analyzing_online_dating_trends_with_Weka/Suggestions/reply&amp;diff=409600"/>
		<updated>2016-04-20T05:27:52Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: Reply to Suggestions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Thanks a lot for your suggestions Samprity. I&#039;m glad you enjoyed going through my page. &amp;lt;/br&amp;gt;&lt;br /&gt;
I shall make the suggested changes and get back to you.&amp;lt;/br&amp;gt;&lt;br /&gt;
Thanks,&lt;br /&gt;
Ritika&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course_talk:CPSC522/Automatic_Classification_of_Morphological_Heart_Arrhythmia&amp;diff=409140</id>
		<title>Course talk:CPSC522/Automatic Classification of Morphological Heart Arrhythmia</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course_talk:CPSC522/Automatic_Classification_of_Morphological_Heart_Arrhythmia&amp;diff=409140"/>
		<updated>2016-04-19T00:51:38Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: Talk page autocreated when first thread was posted&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Automatic_Classification_of_Morphological_Heart_Arrhythmia/Suggestions_for_Automatic_Classification_of_Morphological_Heart_Arrhythmia&amp;diff=409139</id>
		<title>Thread:Course talk:CPSC522/Automatic Classification of Morphological Heart Arrhythmia/Suggestions for Automatic Classification of Morphological Heart Arrhythmia</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Automatic_Classification_of_Morphological_Heart_Arrhythmia/Suggestions_for_Automatic_Classification_of_Morphological_Heart_Arrhythmia&amp;diff=409139"/>
		<updated>2016-04-19T00:51:38Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: New thread: Suggestions for Automatic Classification of Morphological Heart Arrhythmia&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi Mehrdad,&amp;lt;/br&amp;gt;&lt;br /&gt;
This is going to be a rather long message. I found your project really exciting and I have lots of questions. &amp;lt;/br&amp;gt;&lt;br /&gt;
Some initial cosmetic suggestions that I would like to get across are as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
1. In a line or two, right at the beginning you might want to mention that heart arrhythmia is an irregular heart beat. Also which type of arrhythmia are you trying to classify or model? Bradyarrythmias or tachyarrhythmias? &amp;lt;/br&amp;gt;&lt;br /&gt;
2. You might want to add the definition of QRS complex (maybe in brackets where you first mention it) even though i noticed you did include it in your figure but it might not be very obvious. &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Right above your gaussian section, there is no link to click for further information on Hermite basis functions. Same for the Gaussian function ,the KNN algorithm and neural networks. &amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Questions that came up in my mind as I was going through your page are outlined below: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. How did you chop the continuous signals into units containing only one peak? Also, does this mean you extract more than one peak from each patient’s 30 minute ECG signal?&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Is it possible for you to show how you remodelled the 203 intervals to 25 intervals and what was your resulting weighted vector for the combination of Hermite basis functions? &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Using k value as 1 makes me a little uncomfortable. Isn’t it true that larger values of k reduce the effect of noise on classification? Do you think, using k=3 or 5 would improve your results?&amp;lt;/br&amp;gt;&lt;br /&gt;
4. The N training vectors that you are using are continuous variables? Or are they discrete y values at each of the 25 intervals? Would i be right in assuming the dimension of each training vector to be [1x25].&amp;lt;/br&amp;gt;&lt;br /&gt;
I really found your project very interesting and I think you’ve done a very good job explaining your problem description and the hypothesis is also very clear. You could probably add some more input to how you model your problem (for instance you could write your x,k_i and y vectors explicitly. I am really looking forward to you Neural network implementation and how it wold compare to this 1-KNN model as it seems almost everywhere neural nets are taking over. &amp;lt;/br&amp;gt;&lt;br /&gt;
Regards,&amp;lt;/br&amp;gt;&lt;br /&gt;
Ritika&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Regularization_for_Neural_Networks/Suggestions_for_Regularization_for_Neural_Networks/reply_(2)&amp;diff=409134</id>
		<title>Thread:Course talk:CPSC522/Regularization for Neural Networks/Suggestions for Regularization for Neural Networks/reply (2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Regularization_for_Neural_Networks/Suggestions_for_Regularization_for_Neural_Networks/reply_(2)&amp;diff=409134"/>
		<updated>2016-04-19T00:46:05Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: Reply to Suggestions for Regularization for Neural Networks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Oh lol okay. I had it in mind that they were due tomorrow and I was getting all worked up. :P&amp;lt;/br&amp;gt;&lt;br /&gt;
Good luck with the writing!&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Regularization_for_Neural_Networks/Suggestions_for_Regularization_for_Neural_Networks&amp;diff=409099</id>
		<title>Thread:Course talk:CPSC522/Regularization for Neural Networks/Suggestions for Regularization for Neural Networks</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Regularization_for_Neural_Networks/Suggestions_for_Regularization_for_Neural_Networks&amp;diff=409099"/>
		<updated>2016-04-18T23:46:12Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi Ricky,&lt;br /&gt;
Till now whatever I&#039;ve read on your page gives me a good background required on the methods that you&#039;ll be comparing against L2-regularization. But your actual description of the problem, experiments and analysis of the results seem incomplete. I&#039;m guessing you&#039;ll be putting in more material on the page soon. &amp;lt;/br&amp;gt;&lt;br /&gt;
Just as a side note, under your L2-regularization, you might want to look into the math formula. It is not rendered properly. &amp;lt;/br&amp;gt;&lt;br /&gt;
Thanks,&amp;lt;/br&amp;gt;&lt;br /&gt;
Ritika&amp;lt;/br&amp;gt;&lt;br /&gt;
PS: Our critiques are due tomorrow (i.e the 19th), right?&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course_talk:CPSC522/Regularization_for_Neural_Networks&amp;diff=409098</id>
		<title>Course talk:CPSC522/Regularization for Neural Networks</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course_talk:CPSC522/Regularization_for_Neural_Networks&amp;diff=409098"/>
		<updated>2016-04-18T23:45:50Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: Talk page autocreated when first thread was posted&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Regularization_for_Neural_Networks/Suggestions_for_Regularization_for_Neural_Networks&amp;diff=409097</id>
		<title>Thread:Course talk:CPSC522/Regularization for Neural Networks/Suggestions for Regularization for Neural Networks</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Thread:Course_talk:CPSC522/Regularization_for_Neural_Networks/Suggestions_for_Regularization_for_Neural_Networks&amp;diff=409097"/>
		<updated>2016-04-18T23:45:50Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: New thread: Suggestions for Regularization for Neural Networks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi Ricky,&lt;br /&gt;
Till now whatever I&#039;ve read on your page gives me a good background required on the methods that you&#039;ll be comparing against L2-regularization. But your actual description of the problem, experiments and analysis of the results seem incomplete. I&#039;m guessing you&#039;ll be putting in more material on the page soon. &lt;br /&gt;
Just as a side note, under your L2-regularization, you might want to look into the math formula. It is not rendered properly. &lt;br /&gt;
Thanks,&lt;br /&gt;
Ritika&lt;br /&gt;
PS: Our critiques are due tomorrow (i.e the 19th), right?&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408901</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408901"/>
		<updated>2016-04-18T16:32:53Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Almost-fake OkCupid account */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It turns out, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408899</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408899"/>
		<updated>2016-04-18T16:28:13Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Almost-fake OkCupid account */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interestingly enough, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers. The snapshot of people viewing my profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408898</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408898"/>
		<updated>2016-04-18T16:26:47Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Almost-fake OkCupid account */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interestingly enough, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers.&lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
The snapshot for answering questions by going to some other user&#039;s profile is shown below&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;: &lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.&amp;lt;ref name=&amp;quot;snapshots&amp;quot;/&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408894</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408894"/>
		<updated>2016-04-18T16:22:58Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Annotated Bibliography */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interestingly enough, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers.&lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
&lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;snapshots&amp;quot;&amp;gt;[http://www.okcupid.com/ Snapshots taken from my profile on okcupid.com]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408892</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408892"/>
		<updated>2016-04-18T16:20:37Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Discussion and Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interestingly enough, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers.&lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
&lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408891</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408891"/>
		<updated>2016-04-18T16:20:20Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Discussion and Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interestingly enough, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers.&lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
&lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt; [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408890</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408890"/>
		<updated>2016-04-18T16:19:51Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* OkCupid&amp;#039;s question and answers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interestingly enough, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers.&lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already.&amp;lt;ref name=&amp;quot;paper1&amp;quot;/&amp;gt; This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
&lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408889</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408889"/>
		<updated>2016-04-18T16:18:32Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Annotated Bibliography */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interestingly enough, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers.&lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already. This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
&lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408888</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408888"/>
		<updated>2016-04-18T16:18:14Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Discussion and Future Work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interestingly enough, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers.&lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already. This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
&lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
There are various possible directions this project could be extended in. I am currently in talks with the Emil O.W. Kirkegaard and his co-authors of the paper [https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users] to look into the possibility of developing the problem as a recommendation systems problem and developing/improving upon OkCupid&#039;s current algorithms for recommending matches to users. &lt;br /&gt;
I was also interested in doing a country based comparison in online-dating trends to analyze how culture affects online-dating(concerning factors like religion, marriage, food etc). &lt;br /&gt;
Essentially, we have a huge dataset of the online dating world and there are immense opportunities for collaboration with sociologists to find or validate interesting hypothesis.&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper2&amp;quot;&amp;gt;V. K. Singh; R. Piryani ; A. Uddin ; P. Waila [http://ieeexplore.ieee.org/xpl/login.jsp?tp=&amp;amp;arnumber=6526500&amp;amp;url=http%3A%2F%2Fieeexplore.ieee.org%2Fiel7%2F6520973%2F6526372%2F06526500.pdf%3Farnumber%3D6526500 Sentiment analysis of movie reviews: A new feature-based heuristic for aspect-level sentiment classification], Automation, Computing, Communication, Control and Compressed Sensing (iMac4s), 2013 International Multi-Conference on Date of Conference: 22-23 March 2013 Page(s): 712 - 717 Print ISBN: 978-1-4673-5089-1 INSPEC Accession Number: 13567093 Conference Location : Kottayam DOI: 10.1109/iMac4s.2013.6526500 Publisher: IEEE&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408885</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408885"/>
		<updated>2016-04-18T16:03:07Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Evaluation and Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interestingly enough, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers.&lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already. This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
&lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&lt;br /&gt;
===Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously answered as &#039;I can&#039;t answer without a subtitle&#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
I guess broadly, it is safe to say that the online dating community is highly divided on how they feel about government-subsidized food programs.&lt;br /&gt;
To get higher match rates: firstly, it is important to answer the most popular questions and secondly, it is crucial to answer them how the majority in your desired cluster answers them. For instance if you feel, you would like to date someone from cluster 0; you must definitely answer the 4 most popular questions: q34113, q85419, q416235 and q20062 as &#039;Never get a job&#039;, &#039;Rose&#039;(such as White Zinfindel)&#039;,&#039;Can&#039;t answer without a subtitle&#039;,&#039;The best? Maybe...&#039; respectively. This would in expectation match you with someone from the same cluster with a minimum match percentage of 75%. &lt;br /&gt;
Match percentage would be 100% if you answered exactly this and this is what they wanted in their answers which is likely to be the same as the one they have answered (human psyche is bent towards liking options which it itself agrees with). Since I have chosen only 4 most popular attributes for my model here; assuming that you answer only these 4 questions; your calculated match percentage would be 100%. Your true match percentage, however will be calculated as follows: &lt;br /&gt;
&amp;lt;/br&amp;gt;True Match = Calculated Match +/- Reasonable Margin of Error.&lt;br /&gt;
&amp;lt;/br&amp;gt;Reasonable margin of error=100%/4 (since you have 4 questions in common)=25%. &lt;br /&gt;
&amp;lt;/br&amp;gt; Therefore the true match would actually be 100-25=75%. &lt;br /&gt;
For increasing the match rate to 90%(as stated in the hypothesis), I would need to select 10 most popular attributes. Experiments for these are currently under progress.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper2&amp;quot;&amp;gt;V. K. Singh; R. Piryani ; A. Uddin ; P. Waila [http://ieeexplore.ieee.org/xpl/login.jsp?tp=&amp;amp;arnumber=6526500&amp;amp;url=http%3A%2F%2Fieeexplore.ieee.org%2Fiel7%2F6520973%2F6526372%2F06526500.pdf%3Farnumber%3D6526500 Sentiment analysis of movie reviews: A new feature-based heuristic for aspect-level sentiment classification], Automation, Computing, Communication, Control and Compressed Sensing (iMac4s), 2013 International Multi-Conference on Date of Conference: 22-23 March 2013 Page(s): 712 - 717 Print ISBN: 978-1-4673-5089-1 INSPEC Accession Number: 13567093 Conference Location : Kottayam DOI: 10.1109/iMac4s.2013.6526500 Publisher: IEEE&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408879</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408879"/>
		<updated>2016-04-18T14:57:43Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Evaluation and Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interestingly enough, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers.&lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already. This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
&lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&lt;br /&gt;
===Evaluation and Results===&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously &#039;I can&#039;t answer without a subtitle&#039;.&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper2&amp;quot;&amp;gt;V. K. Singh; R. Piryani ; A. Uddin ; P. Waila [http://ieeexplore.ieee.org/xpl/login.jsp?tp=&amp;amp;arnumber=6526500&amp;amp;url=http%3A%2F%2Fieeexplore.ieee.org%2Fiel7%2F6520973%2F6526372%2F06526500.pdf%3Farnumber%3D6526500 Sentiment analysis of movie reviews: A new feature-based heuristic for aspect-level sentiment classification], Automation, Computing, Communication, Control and Compressed Sensing (iMac4s), 2013 International Multi-Conference on Date of Conference: 22-23 March 2013 Page(s): 712 - 717 Print ISBN: 978-1-4673-5089-1 INSPEC Accession Number: 13567093 Conference Location : Kottayam DOI: 10.1109/iMac4s.2013.6526500 Publisher: IEEE&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408878</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408878"/>
		<updated>2016-04-18T14:57:32Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Cluster Visualization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interestingly enough, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers.&lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already. This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
&lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
&lt;br /&gt;
===Evaluation and Results===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper2&amp;quot;&amp;gt;V. K. Singh; R. Piryani ; A. Uddin ; P. Waila [http://ieeexplore.ieee.org/xpl/login.jsp?tp=&amp;amp;arnumber=6526500&amp;amp;url=http%3A%2F%2Fieeexplore.ieee.org%2Fiel7%2F6520973%2F6526372%2F06526500.pdf%3Farnumber%3D6526500 Sentiment analysis of movie reviews: A new feature-based heuristic for aspect-level sentiment classification], Automation, Computing, Communication, Control and Compressed Sensing (iMac4s), 2013 International Multi-Conference on Date of Conference: 22-23 March 2013 Page(s): 712 - 717 Print ISBN: 978-1-4673-5089-1 INSPEC Accession Number: 13567093 Conference Location : Kottayam DOI: 10.1109/iMac4s.2013.6526500 Publisher: IEEE&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
	<entry>
		<id>https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408877</id>
		<title>Course:CPSC522/Analyzing online dating trends with Weka</title>
		<link rel="alternate" type="text/html" href="https://wiki.ubc.ca/index.php?title=Course:CPSC522/Analyzing_online_dating_trends_with_Weka&amp;diff=408877"/>
		<updated>2016-04-18T14:57:00Z</updated>

		<summary type="html">&lt;p&gt;RitikaJain: /* Cluster Visualization */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Analyzing online dating trends with Weka==&lt;br /&gt;
&lt;br /&gt;
Author: Ritika Jain&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract  ==&lt;br /&gt;
A very large OKCupid dataset (with 2620 attributes and over 68,000 instances) has been analyzed to form clusters as an unsupervised learning task. The rationale behind the clustering is that broadly speaking, population can be segmented into clusters based on their behavioural attributes (which in this project are accessed using OkCupid questions and answers) and we can find a representative profile which broadly matches that cluster.&lt;br /&gt;
&amp;lt;/br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Builds on===&lt;br /&gt;
*[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://en.wikipedia.org/wiki/K-means_clustering K means clustering]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Related Pages===&lt;br /&gt;
*[http://www.ted.com/talks/amy_webb_how_i_hacked_online_dating Amy Web: How i hacked online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[http://www.datascienceweekly.org/data-scientist-interviews/how-machine-learning-can-transform-online-dating-kang-zhao-interview How machine learning can transform online dating]&amp;lt;/br&amp;gt;&lt;br /&gt;
*[https://osf.io/hy86q/ The effects of humor and laughter on perceived intelligence and dating success]&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Content ==&lt;br /&gt;
===Hypothesis===&lt;br /&gt;
The goal of this page is to present the analysis on online dating trends (some initial ideas are: form clusters of dating profiles of men and women based on the questions they answer and the values in the partner they cannot compromise on; and then for each cluster try to make an ideal profile  which would achieve greater than 90% match rate). I will be working with OkCupid&#039;s dataset and using Weka to train, cluster and visualize OkCupid&#039;s dataset.&lt;br /&gt;
Inspiration from this Math geek&amp;lt;ref name=&amp;quot;main&amp;quot; /&amp;gt;: http://www.wired.com/2014/01/how-to-hack-okcupid/&lt;br /&gt;
&lt;br /&gt;
===Almost-fake OkCupid account===&lt;br /&gt;
To be able to understand how OkCupid works, the first step was to create a almost-fake account for myself. The reason i say fake is because I&#039;m not actively looking to date online. The reason i say almost is, I still want to be taken as a legit user by the online dating community.&lt;br /&gt;
So here is what my profile looks like:&lt;br /&gt;
&lt;br /&gt;
[[File:My profile.png|thumb|center|700px|This is the screenshot of my OkCupid profile.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, I go on to see how to find matches for myself. OkCupid gives you the option to find matches according to preferred age, orientation, and location of who you want to meet. I make these changes in my &amp;quot;I&#039;m Looking For&amp;quot; settings and this immediately adjusts the matches I see around the site. I can also use the “Order By” dropdown to choose how my matches are ranked and presented to me. Sorting by OkCupid&#039;s “Special Blend” looks at many different things—more than just match percentage and last login time—and show some great matches that might not otherwise have shown up. I however sort by match percentage because that is the parameter I am interested in for this project. &lt;br /&gt;
[[File:Browse matches.png|thumb|center|700px|Browse matches]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Interestingly enough, I don&#039;t need to do much more than this. Being a woman, that too in Vancouver, that&#039;s about all I need to do. I get profile likes, profile visits and messages streaming into my OkCupid inbox.  This validates an interesting article by OkTrends called [https://www.okcupid.com/deep-end/a-womans-advantage| &#039;A Woman&#039;s advantage&#039;].&lt;br /&gt;
[[File:Likes.png| thumb | center|700px| I get profile likes, but I cannot see the people who like me unless i upgrade to A-list.]]&lt;br /&gt;
&lt;br /&gt;
I can also see people who are viewing my profile. I also have the options to browse invisibly at profiles, so they don&#039;t know I am looking at their profiles. I can also hide and unhide &#039;real&#039; stalkers.&lt;br /&gt;
[[File:Stalkers.png|thumb|center|700px|Stalkers: People viewing my profile]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s question and answers====&lt;br /&gt;
The questions on the site are made by users themselves, but some initial questions were made by the staff. Questions concern multitude of topics ranging from questions on Ethics, Sex, Religion, Lifestyle, Dating etc. By default, the questions are presented to users in the order of the questions having the most answers already. This minimizes the number of questions that a new user has to answer out before having many in common with other users, but has the cost of starkly decreasing the diversity of questions answered. Still, because users often answer hundreds if not thousands of questions, a great amount of data is available. It is also possible to answer any question by going directly it to, or finding it in some other user&#039;s profile.&lt;br /&gt;
&lt;br /&gt;
[[File:Qans1.png|thumb|center|700px|Answering questions by going to other user&#039;s profile]]&lt;br /&gt;
&lt;br /&gt;
The more the number of questions I answer, the more are my chances of finding a higher match percentage. For instance, in my profile I have answered 67 questions and the highest match percentage possible is 98.5% (assuming someone answers all my questions exactly how I would like them to and I don&#039;t give wrong answers to the questions important to them). The algorithm for match percentages is detailed below which will make things clearer. &lt;br /&gt;
&lt;br /&gt;
[[File:Qans2.png|thumb|center|700px|Answering a question directly. A question asks you: your response, the other person&#039;s acceptable responses and the question&#039;s importance to you.]]&lt;br /&gt;
&lt;br /&gt;
====OkCupid&#039;s matching algorithm====&lt;br /&gt;
After setting up my profile and understanding my way around the basic functionalities of the site, I go on to explore how OkCupid suggests matches to me. OkCupid has a very interesting matching algorithm. They calculate match percentages by matching your answers to questions with the other person&#039;s expected answers and vice versa.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
1. For each question, three values are collected from a user: &lt;br /&gt;
&lt;br /&gt;
a) Your answer&amp;lt;/br&amp;gt;&lt;br /&gt;
b) How you&#039;d like someone else to answer&amp;lt;/br&amp;gt;&lt;br /&gt;
c) How important the question is to you&amp;lt;/br&amp;gt;&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Calculating the match:&amp;lt;/br&amp;gt;&lt;br /&gt;
Assigning numeric values to the four levels of importance: irrelevant, a little important, somewhat important and very important. &lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Level of Importance&lt;br /&gt;
!Point value&lt;br /&gt;
|-&lt;br /&gt;
|Irrelevant&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|A little important&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|Somewhat important&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|Very important&lt;br /&gt;
|250&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Looking at how each of your answers satisfied the other’s preferences, they use these values to give correct weights to the calculations. Your match percentage with other person is figured by answering the following two questions:&lt;br /&gt;
&lt;br /&gt;
a) How much did other person’s answer make you happy?&lt;br /&gt;
&lt;br /&gt;
b)How much did your answers make the other person happy?&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Examples of matches===&lt;br /&gt;
Let us understand how this works with the help of an example.&amp;lt;/br&amp;gt;&lt;br /&gt;
We shall consider two users: user A and user B and try to find match percentage between them.&amp;lt;/br&amp;gt;&lt;br /&gt;
Say for instance the question that has been answered by both A and B is:&lt;br /&gt;
&#039;&#039;&#039;How messy are you?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Very messy &amp;lt;/br&amp;gt;&lt;br /&gt;
2. Average &amp;lt;/br&amp;gt;&lt;br /&gt;
3. Very organized &amp;lt;/br&amp;gt;&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|Very organized&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|Average or very organized&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|Very important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|Average&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|A little important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Have you ever cheated in a relationship?&#039;&#039;&#039;&amp;lt;/br&amp;gt; The answer options are: &amp;lt;/br&amp;gt;&lt;br /&gt;
1. Yes &amp;lt;/br&amp;gt;&lt;br /&gt;
2. No &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|A&#039;s answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|How A wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to A&lt;br /&gt;
|A little important&lt;br /&gt;
|-&lt;br /&gt;
|B&#039;s answer&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|How B wants someone else to answer&lt;br /&gt;
|No&lt;br /&gt;
|-&lt;br /&gt;
|The question&#039;s importance to B&lt;br /&gt;
|somewhat important&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did B&#039;s answer make A happy?&#039;&#039;&#039;&lt;br /&gt;
A indicated that B’s answer to the first question was very important to you. And that his answer to the second question was not. So we placed 250 importance points on the first question and 1 point on the second question. Of those 251 possible points, B earned 250 by answering the first question how A wanted. So B’s answers were 250/251 = 99.6% satisfactory for A.&amp;lt;ref name=&amp;quot;support&amp;quot; /&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;How much did A&#039;s answer make B happy?&#039;&#039;&#039;&lt;br /&gt;
Well, B placed 1 importance point on A&#039;s answer to the first question and 10 on A&#039;s answer to the second. Of those 11 possible points, A earned 10 points. So A&#039;s answers made B 10/11 = 91% happy.&lt;br /&gt;
&lt;br /&gt;
To get a match percentage for A and B, they just multiply your satisfactions, and then take the square root: sqrt(91% * 99.6%) = ~95%.&lt;br /&gt;
&lt;br /&gt;
But to eliminate the possibility where both A and B just answered one same question and got the answers right to each other&#039;s question; they would be matched 100% even though they practically know nothing about each other, OkCupid uses a reasonable margin of error which is calculated as 1/(size of number of questions answered by both). It believes that True Match = Calculated Match +/- Reasonable Margin of Error. To give users the most confidence in the match process, they always publish the lowest possible percentage your match can be. In this example, that would be 45%(95%-(1/2)*100%).&lt;br /&gt;
&lt;br /&gt;
===What is Weka?===&lt;br /&gt;
Weka is a collection of machine learning algorithms for data mining tasks. The algorithms can either be applied directly to a dataset or called from your own Java code. Weka contains tools for data pre-processing, classification, regression, clustering, association rules, and visualization. It is also well-suited for developing new machine learning schemes. Weka is open source software issued under the GNU General Public License.&amp;lt;ref name=&amp;quot;weka&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Weka can be downloaded from [http://www.cs.waikato.ac.nz/ml/weka/downloading.html  here].&lt;br /&gt;
&lt;br /&gt;
===Methodology===&lt;br /&gt;
&lt;br /&gt;
====Crawling data from OkCupid&#039;s website====&lt;br /&gt;
Since OkCupid&#039;s data is not publicly accessible, I was trying to write a website crawler to scrape data from the OkCupid website. Several issues that I ran into were: OkCupid maintains a dynamically changing html structure which did not allow me to extract elements statically by referencing them through the html hierarchy; I can only see other user profiles answers for questions that I have answered myself (To overcome this issue, I tried to create an automatic form-filling bot which worked fine but with a few limitations). After several failed attempts at being able to perfectly extract questions and answers from the other users&#039; profiles, I ran into a GitHub project which had created an OkCupid scraping bot written in Python based Scrappy. The project can be accessed [https://github.com/Deleetdk/OKCubot2 here]. &amp;lt;/br&amp;gt;&lt;br /&gt;
Trying to extract the amount of data required would take around 10 computers to run the bots on their systems. Because of time and resource constraints, I tried and then decided against running them on different systems with different fake profiles. Instead, I contacted the authors and luckily managed to get a reply from them. They graciously sent me the passwords for the encrypted user data set as well as the question data set. &lt;br /&gt;
The question data set has all the questions as its instances and the attributes are the options of each question. A part of the question data set has been shown in the screenshot below:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Question data.png|thumb|center|700px|A very small part of the question data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
A very small part of the user data set has been shown in the screenshot below:&lt;br /&gt;
[[File:Userdata.png|thumb|center|700px|A very small part of the user data.]]&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====K means clustering====&lt;br /&gt;
K-means clustering is a method of vector quantization, originally from signal processing, that is popular for cluster analysis in data mining. k-means clustering aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean, serving as a prototype of the cluster.&amp;lt;ref name=&amp;quot;wiki&amp;quot;/&amp;gt;&amp;lt;/br&amp;gt;&lt;br /&gt;
It is easy to visualize how K-means algorithm works as shown in this image taken from [https://en.wikipedia.org/wiki/K-means_clustering Wikipedia]. &lt;br /&gt;
[[File:K-means algorithm.png|thumb|center|600px|Pictorial representation of how K-means algorithm works]]&amp;lt;/br&amp;gt;&lt;br /&gt;
Since the objective of my project is to cluster the population into segments and find a representative of that segment which represents that cluster well, K-means serves my purpose. &amp;lt;/br&amp;gt;&lt;br /&gt;
The instances, i.e. the cases that I need to cluster are the answers of users and the attributes I am clustering on (i.e. trying to model their behavioural attributes) are the questions answered by a majority of the population.&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Training====&lt;br /&gt;
Since there are no actual labels we can use, clustering these instances(user profiles) according to attributes(questions) is actually an unsupervised learning task. &lt;br /&gt;
I experimented with density based clustering and K-means clustering. K-means clustering gave me better outcomes. &lt;br /&gt;
On Weka, the process can be shown as following:&lt;br /&gt;
* Preprocessing the data: removing unwanted attributes. I ran the experiments choosing only the four most popular attributes (q34113, q85419, q416235, q20062). &amp;lt;/br&amp;gt;&lt;br /&gt;
The preprocessing of data is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Preprocessing.png|thumb|center|700px|Preprocessing the data]]&amp;lt;/br&amp;gt;&lt;br /&gt;
*Setting the K-means clustering parameters. I use 80-20% split, i.e 80% of the data is used to train the model and 20% is used to test the model. Playing around with different number of clusters, I decided to choose 4 as each cluster had enough elements to validate its existence. &amp;lt;/br&amp;gt;&lt;br /&gt;
The K-means attribute selection pane in Weka where I choose the attributes is shown as follows:&amp;lt;/br&amp;gt;&lt;br /&gt;
[[File:Kmeans.png|thumb|center|700px|Setting K-means clustering parameters]]&lt;br /&gt;
&lt;br /&gt;
====Cluster Visualization====&lt;br /&gt;
&lt;br /&gt;
Number of iterations: 2&amp;lt;/br&amp;gt;&lt;br /&gt;
Within cluster sum of squared errors: 75.0&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The most popular attributes are found to be: q34113, q85419, q416235 and q20062. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q34113:&#039;&#039;&#039; How do you feel about government-subsidized food programs (free lunch,food stamps etc)?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; No problem, It&#039;s okay if it is not abused, Okay for short amounts of time, Never-get a job &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q85419:&#039;&#039;&#039; Which type of wine would you prefer to drink outside of a meal such as for leisure?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; White (such as Chardonnay Riesling), Red(such as Merlot Cabernet Shiraz), Rosé (such as White Zinfindel), I don&#039;t drink wine. &amp;lt;/br&amp;gt;&lt;br /&gt;
*&#039;&#039;&#039;q416235:&#039;&#039;&#039; Do you like watching foreign movies with subtitles?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Yes, No, Can&#039;t answer without a subtitle.&lt;br /&gt;
*&#039;&#039;&#039;q20062:&#039;&#039;&#039; While in the middle of the best lovemaking of your life, if your lover asked you to squeal like a dolphin, would you?&amp;lt;/br&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Options are:&#039;&#039;&#039; Absolutely, No way, The best? Maybe... &amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cluster centroids:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Attribute&lt;br /&gt;
!Cluster 0&lt;br /&gt;
!Cluster 1&lt;br /&gt;
!Cluster 2&lt;br /&gt;
!Custer 3&lt;br /&gt;
|-&lt;br /&gt;
|q34113&lt;br /&gt;
|Never-get a job&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|No problem&lt;br /&gt;
|It&#039;s okay, if it is not abused&lt;br /&gt;
|-&lt;br /&gt;
|q85419&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|Red(such as Merlot Cabernet Shiraz)&lt;br /&gt;
|Rosé (such as White Zinfindel)&lt;br /&gt;
|-&lt;br /&gt;
|q416325&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Can&#039;t answer without a subtitle&lt;br /&gt;
|Yes&lt;br /&gt;
|-&lt;br /&gt;
|q20062&lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|The best?  Maybe... &lt;br /&gt;
|}&lt;br /&gt;
                                                                                  &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Clustered Instances&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster0:            79%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster1:             11%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster2:              7%&amp;lt;/br&amp;gt;&lt;br /&gt;
Cluster3:              3%&amp;lt;/br&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/br&amp;gt;&lt;br /&gt;
The clusters can be visualized below. &lt;br /&gt;
[[File:Cluster visualization.png|center|700px|thumb|Cluster visualization]]&lt;br /&gt;
We see that the clustering is heavily skewed towards the first cluster, i.e. cluster 0 which means to say that a large segment of the population feels that you should get a job instead of relying on government-subsidized food programs.Another interesting observation that can be made is that 97% of the online-dating population has a sense of humour. I say this because the response to ,&#039;Do you like watching foreign movies with subtitles?&#039; is almost unanimously &#039;I can&#039;t answer without a subtitle&#039;.&lt;br /&gt;
&lt;br /&gt;
===Evaluation and Results===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Discussion and Future Work===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Annotated Bibliography ==&lt;br /&gt;
{{Reflist|refs=&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;main&amp;quot;&amp;gt;[http://www.wired.com/2014/01/how-to-hack-okcupid/ How a math genius hacked OkCupid]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;support&amp;quot;&amp;gt;[https://www.okcupid.com/help/match-percentages Match percentages]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;weka&amp;quot;&amp;gt;[http://www.cs.waikato.ac.nz/ml/weka/ Weka]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;wiki&amp;quot;&amp;gt;[https://en.wikipedia.org/wiki/K-means_clustering k-means clustering Wikipedia]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper1&amp;quot;&amp;gt;[https://osf.io/p9ixw/ The OKCupid dataset: A very large public dataset of dating site users]&amp;lt;/ref&amp;gt;&lt;br /&gt;
*&amp;lt;ref name=&amp;quot;paper2&amp;quot;&amp;gt;V. K. Singh; R. Piryani ; A. Uddin ; P. Waila [http://ieeexplore.ieee.org/xpl/login.jsp?tp=&amp;amp;arnumber=6526500&amp;amp;url=http%3A%2F%2Fieeexplore.ieee.org%2Fiel7%2F6520973%2F6526372%2F06526500.pdf%3Farnumber%3D6526500 Sentiment analysis of movie reviews: A new feature-based heuristic for aspect-level sentiment classification], Automation, Computing, Communication, Control and Compressed Sensing (iMac4s), 2013 International Multi-Conference on Date of Conference: 22-23 March 2013 Page(s): 712 - 717 Print ISBN: 978-1-4673-5089-1 INSPEC Accession Number: 13567093 Conference Location : Kottayam DOI: 10.1109/iMac4s.2013.6526500 Publisher: IEEE&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== To Add ==&lt;/div&gt;</summary>
		<author><name>RitikaJain</name></author>
	</entry>
</feed>