<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alex KC on Medium]]></title>
        <description><![CDATA[Stories by Alex KC on Medium]]></description>
        <link>https://medium.com/@alexkiechlecornish?source=rss-85ea28b8ae8e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*44QHudgedTe_C-TuFs5X5A.jpeg</url>
            <title>Stories by Alex KC on Medium</title>
            <link>https://medium.com/@alexkiechlecornish?source=rss-85ea28b8ae8e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 11:04:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alexkiechlecornish/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[4th Place Solution — $100k Causal Discovery Challenge — ADIA Lab x CrunchDAO]]></title>
            <link>https://medium.com/@alexkiechlecornish/4th-place-solution-100k-causal-discovery-challenge-adia-lab-x-crunchdao-e0f88c9eda8e?source=rss-85ea28b8ae8e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0f88c9eda8e</guid>
            <category><![CDATA[causality]]></category>
            <category><![CDATA[causal-discovery]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Alex KC]]></dc:creator>
            <pubDate>Fri, 22 Nov 2024 01:38:47 GMT</pubDate>
            <atom:updated>2024-11-22T01:38:47.632Z</atom:updated>
            <content:encoded><![CDATA[<h3>4th Place Solution — $100k Causal Discovery Challenge — ADIA Lab x CrunchDAO</h3><p>Below I detail my solution that earned a 4th place position in the Causal Discovery Challenge with a multiclass balanced accuracy across the eight causal labels of 72.88% on the out-of-sample.</p><h4>Acknowledgments</h4><p>I would like to thank the competition organisers from ADIA Lab (Prof. Marcos Lopez de Prado, Prof. Guido Imbens, Emanuele Olivetti &amp; Dr Horst Simon) as well as the whole team at Crunch DAO for making such an <a href="https://www.crunchdao.com/live/adia-lab-causal-discovery-challenge">interesting competition </a>available to everyone.</p><p>Causality is a new field for me, so I am also very grateful to Aleksander Molask’s <a href="https://github.com/PacktPublishing/Causal-Inference-and-Discovery-in-Python">excellent book</a> which gave me enough confidence to give the quick-starter notebook a crack.</p><h4><strong>Competition Overview</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*htf3ft_l6NS5_6M5QbPbRQ.jpeg" /></figure><p>The competition tasked researchers to predict the Directed Acyclic Graph (DAG) structure of a dataset, based solely on 1000 observations per variable. Each dataset contained between 3 and 10 variables, and the goal was to correctly classify the relationship of all variables (excluding X and Y) with respect to X and Y. There are eight possibilities:</p><ol><li>Independent</li><li>Confounder</li><li>Collider</li><li>Mediator</li><li>Cause of X</li><li>Cause of Y</li><li>Consequence of X</li><li>Consequence of Y</li></ol><p>There are 47,000 datasets in total, of which 14,000 were used for the final out-of-sample phase and 7,400 for the local test set.</p><h4><strong>Solution Overview</strong></h4><p>My solution primarily focused on good ol’ fashioned feature engineering on both the raw datasets, as well as predictions from a number of unsupervised causal discovery algorithms. A final LGBM Classifier was then trained on all features (N=923) to predict one of the 8 labels above. At a high-level, this is how my final solution ended up looking:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L-MR80d-IAkkngZZknI0sA.png" /></figure><h4><strong>Validation Strategy</strong></h4><p>The datasets exhibited significant class imbalance, so I employed StratifiedGroupKFold with 5 folds for local training. For my Multi-Layer Perceptron (MLP), I used a standard 5-fold cross-validation (CV) split to train the model and generate predicted DAGs.</p><p>During the month I participated in the competition, I conducted five genuine tests on the leaderboard test set. Each time, my local CV score was within approximately 0.2 points of the test set score. This consistency gave me the confidence to focus almost entirely on local tests, knowing that improvements from feature engineering would reliably translate to leaderboard performance.</p><h4><strong>Feature Engineering</strong></h4><p>For each dataset we have Z which is the set of all variables in the dataset and define V to be the set such that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/339/1*zDE2Iz1i55SbXMRqW0p1OQ.png" /></figure><p>We then have a single row for each variable <em>v</em> in V. Most of our features are then formulated with respect to <em>v, </em>V, X, or Y. I calculate simple intra-dataset stats (max, min, median, mean, std, range) from most of my features.</p><p>I group the features into the following <em>loose</em> categories:</p><ol><li>Simple correlation stats (Pearson, Spearman, etc…).</li><li>Partial correlation and Distance correlation.</li><li>Multi-collinearity features / tests.</li><li>Distance metrics.</li><li>Quantities derived from various regression residuals.</li><li>Causal discovery unsupervised algorithms such as Greedy Equivalence Search (GES), BIC Exact Search (BES), DirectLiNGAM.</li><li>Features extracted from a MLP trained with scaled dot-product attention. The model outputs probability weighted adjacency matrices which features are extracted from.</li><li>Conditional Entropy and Mutual Information features which primarily used the nearest-neighbor (k=3, 5, 10) approach to estimate quantities. I am very grateful to the excellent repo which can be found <a href="https://github.com/gregversteeg/NPEET">here</a> and which I used extensively.</li></ol><p>Among the causal discovery algorithms I tested, many were either too computationally expensive or failed to significantly enhance my feature set. Although GES, BES, and DirectLiNGAM could not achieve scores above 45% despite extensive tuning, they contributed some orthogonal signal that my classifier was able to leverage. Each algorithm added approximately 1.0 to 1.5 points to my classifier’s score. However, as I am not a causality expert, it is possible that these methods were not implemented or tuned optimally.</p><p>The MLP released by the competition organisers in the final two weeks proved to be highly valuable. While the baseline model achieved a multiclass balanced accuracy of 37%, I was able to improve this to 46% with some simple adjustments (num_epochs, learning rate, normalisation layers). However, further improvements were elusive despite extensive experimentation. Extracting features from the probability-weighted predicted DAGs yielded highly influential features, and any enhancements in the MLP’s performance consistently translated to improvements in my classifier. Some of the most influential features were:</p><ul><li>The raw probabilities &amp; summary stats of these.</li><li>Ratio of the probability of an incoming/outgoing edge from v to X/Y, over the max probability of an incoming/outgoing edge for all other variables to X/Y.</li><li>Calculating the probabilities that v is a mediator, collider, or confounder based on the predicted adjacency matrix.</li></ul><p>Conditional mutual information (CMI) features estimated using the nearest-neighbor approach were by far the most valuable features in my pipeline. I used number of neighbours k = {3, 5, 10}. Careful selection of conditioning sets and differencing various quantities resulted in the most impactful features. In particular, calculating features specifically tailored to highlight potential Colliders, Mediators, and Confounders proved especially helpful, as these classes were the most challenging for the classifier to distinguish. As an example these <em>identifiers</em> were quantities like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*t0mZPpdASrOKBzUkyVMU7Q.png" /></figure><p>I also used the predicted parent / child relationships from the unsupervised methods to guide conditioning sets for the CMI calculations with respect to X and Y. This greatly reduced the number of combinations I needed to test. I also tried using probability-weighted linear combinations of variables from the MLP’ predicted adjacency matrix to create new conditioning variables for CMI calculations. This added some value.</p><p>Towards the end of the competition I briefly explored feature normalisation, both intra-dataset and normalising with respect to all values. I don’t think I got this quite right though and expect a better solution to feature normalisation would yield meaningful results.</p><h4><strong>Online Training</strong></h4><p>Despite having the option to upload pre-computed feature sets and pre-trained models, I opted to perform everything online which meant I was bound by the 30-hour compute limit to perform all training and inference components. The advantage was that I was able to train my 5-fold MLPs and Classifier on a larger training set, and there was less of a chance something went wrong! After viewing the final submissions, I believe this choice cost me, and it would have been better to upload feature calculations (bulk of compute) to allow for more training in the 30-hour window.</p><p>In the final hours before the submission deadline I tested training 5-folds for my classifier and using voting to generate the final predicted label. This led to a 0.8 point improvement locally, but I had run out of compute quota to submit this change.</p><h4><strong>Things I tried that didn’t work (for me)</strong></h4><ul><li>Using a transformer architecture instead of the single scaled dot-product attention. Various hyperparam tuning for the MLP.</li><li>Various causal discovery algorithms: (PC, NoTEARS, GOLEM, GRaSP).</li><li>Various pre-processing steps to handle trouble variables in datasets for downstream unsupervised algorithms.</li><li>Tweaking the algorithm to go from a Cyclic graph to a DAG.</li><li>Other permutation / non-parametric statistical tests like HSIC that were too computationally expensive for their value add.</li></ul><h4><strong>Further Improvements</strong></h4><ul><li>I did not explore feature selection (probably should have…). I’m fairly confident this would have improved performance.</li><li>Explore feature normalisation methods further.</li><li>I did not explore using other classifier models/architectures such as CatBoost, XGBoost, NN.</li><li>I’m confident that if the MLP’s performance can be improved this will likely translate to additional overall improvements.</li><li>Use multiple folds / ensemble for final prediction.</li></ul><p>What was apparent from the excellent clustering map produced by ADIA and <a href="https://www.youtube.com/watch?v=wAOhtCAyDlg">presented live</a> (timestamp 04:57:00) at the ADIA Lab Symposium was just how different top solutions were. This leaves open the possibility to ensemble the different approaches and establish a new baseline for causal discovery, which I hypothesise could generate accuracy scores north of 80%.</p><p>The competition was a very engaging challenge that introduced me to the field of Causal Analysis. I am very grateful to the competition organisers and community at CrunchDAO which facilitated interesting discussions about the competition. Feel free to reach out <a href="https://www.linkedin.com/in/alexanderkiechlecornish/">here</a> if you have any questions about my solution or would like to discuss approaches!</p><p><strong>Appendix:</strong></p><p>Below I include the hyperparams of my models for those interested. I was performing training on a M2 Laptop whilst travelling, so couldn’t really do an extensive hyperparam search. I expect there to be more optimal values.</p><pre># Classifier<br>lgb.LGBMClassifier(n_estimators=3000, <br>                  learning_rate=0.005, <br>                  max_depth=8, <br>                  colsample_bytree=0.3, <br>                  reg_alpha=0.4,<br>                  reg_lambda=0.4,<br>                  num_leaves=32, <br>                  n_jobs=-1, <br>                  class_weight=&quot;balanced&quot;, <br>                  objective=&quot;multiclass&quot;)<br><br><br># MLP<br>optimizer = torch.optim.Adam(self.parameters(), lr=1e-2)<br>scheduler = torch.optim.lr_scheduler.StepLR(optimizer, 40, gamma=0.5, last_epoch=-1)</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0f88c9eda8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>