<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>DS lore</title><link>http://nadbordrozd.github.io/</link><description>Recent content on DS lore</description><generator>Hugo</generator><language>en-gb</language><copyright>nadbor</copyright><lastBuildDate>Mon, 07 Sep 2020 10:20:58 +0100</lastBuildDate><atom:link href="http://nadbordrozd.github.io/atom.xml" rel="self" type="application/rss+xml"/><item><title>Embedding Sets of Vectors With EMDE</title><link>http://nadbordrozd.github.io/blog/2020/09/07/embedding-sets-of-vectors-with-emde/</link><pubDate>Mon, 07 Sep 2020 10:20:58 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2020/09/07/embedding-sets-of-vectors-with-emde/</guid><description>&lt;p&gt;This post will be about a cool new feature engineering technique for encoding sets of vectors as a single vector - as described in the recent paper &lt;a href="https://arxiv.org/abs/2006.01894"&gt;An efficient manifold density estimator for all recommendation systems.&lt;/a&gt; The paper focuses on EMDE’s applications to recommender systems but I’m more interested in the technique itself.&lt;/p&gt;

&lt;p&gt;I will provide motivation for the technique, a &lt;a href="https://github.com/nadbordrozd/blog_stuff/blob/master/emde/emde.ipynb"&gt;python implementation&lt;/a&gt; of it and finally some benchmarks.&lt;/p&gt;

&lt;h2 id="aggregating-vectors-as-feature-engineering"&gt;Aggregating vectors as feature engineering&lt;/h2&gt;
&lt;p&gt;From a pragmatic perspective, EMDE is just an algorithm for compressing sets of vectors into a single fixed-width vector.&lt;/p&gt;</description></item><item><title>"Hello World!" in PyTorch BigGraph</title><link>http://nadbordrozd.github.io/blog/2020/08/04/hello-world-in-pytorch-biggraph/</link><pubDate>Tue, 04 Aug 2020 09:58:04 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2020/08/04/hello-world-in-pytorch-biggraph/</guid><description>&lt;p&gt;In this post I explain why graph embedding is cool, why Pytorch BigGraph is a cool way to do it and show how to use PBG on two very simple examples - the “Hello World!” of graph embedding.&lt;/p&gt;

&lt;p&gt;All the code can be found &lt;a href="https://github.com/nadbordrozd/blog_stuff/tree/master/PBG"&gt;here&lt;/a&gt;. With this you can quickly get started embedding your own graphs.&lt;/p&gt;

&lt;h4 id="example-graph-of-movies"&gt;Example: Graph of movies&lt;/h4&gt;
&lt;p&gt;Before we get started, here’s a motivating example: visualisation of the &lt;a href="https://www.kaggle.com/rounakbanik/the-movies-dataset"&gt;Movies Dataset&lt;/a&gt; from Kaggle.&lt;/p&gt;</description></item><item><title>5 Types of Nonsense Data Science</title><link>http://nadbordrozd.github.io/blog/2019/08/11/5-types-of-nonsense-data-science/</link><pubDate>Sun, 11 Aug 2019 12:22:57 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2019/08/11/5-types-of-nonsense-data-science/</guid><description>&lt;p&gt;I recently came across several articles about failing data science projects (according to Gartner 85% big data projects are never fully productionised). The articles blame misaligned objectives, management resistance, unrealistic expectations, poor communication with stakeholders, poor data infrastructure. I think this is basically correct but too diplomatic. Here’s what I think:&lt;/p&gt;

&lt;blockquote&gt;
 &lt;p&gt;The typical data science project doesn’t make any sense whatsoever and should never have been attempted.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;hr /&gt;
&lt;p&gt;Data science has a huge solution-looking-for-a-problem situation going on. Enterprise managers trying to appear data-driven, startup founders wanting to impress investors with cool buzzwords and proprietary IP, young data scientists themselves itching to try the newest technique from a paper - there are a lot of people looking for an excuse to do ML/AI/DL. When they finally find it, they (or rather - &lt;em&gt;we&lt;/em&gt;) don’t try too hard to see if it makes business sense. As a result, the majority of data science projects never move beyond the stage of slides and jupyter notebooks.&lt;/p&gt;</description></item><item><title>What they don't tell you about data science 2: data analyst roles are poison</title><link>http://nadbordrozd.github.io/blog/2017/12/10/what-they-dont-tell-you-about-data-science-2-data-analyst-roles-are-poison/</link><pubDate>Sun, 10 Dec 2017 11:46:40 +0000</pubDate><guid>http://nadbordrozd.github.io/blog/2017/12/10/what-they-dont-tell-you-about-data-science-2-data-analyst-roles-are-poison/</guid><description>&lt;p&gt;&lt;em&gt;This is the second of a series of posts about things I wish someone had told me when I was first considering a career in data science. &lt;a href="http://nadbordrozd.github.io/blog/2017/12/05/what-they-dont-tell-you-about-data-science-1/"&gt;Part 1&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;For the purposes of this post I define a data analyst as someone who uses tools like Excel and SQL to interrogate data to produce reports, plots, recommendations but crucially doesn’t &lt;em&gt;deliver code&lt;/em&gt;. If you work in online retail and create an algorithm recommending tiaras for pets - I call you a data scientist. If you query a database and discover that chihuahua owners prefer pink tiaras and share this finding with the advertising team - you are a data analyst.&lt;/p&gt;</description></item><item><title>What they don't tell you about data science 1: You are a software engineer first</title><link>http://nadbordrozd.github.io/blog/2017/12/05/what-they-dont-tell-you-about-data-science-1/</link><pubDate>Tue, 05 Dec 2017 21:18:31 +0000</pubDate><guid>http://nadbordrozd.github.io/blog/2017/12/05/what-they-dont-tell-you-about-data-science-1/</guid><description>&lt;p&gt;&lt;em&gt;This is the first of a series of posts about things I wish someone had told me when I was first considering a career in data science. &lt;a href="http://nadbordrozd.github.io/blog/2017/12/10/what-they-dont-tell-you-about-data-science-2-data-analyst-roles-are-poison/"&gt;Part 2&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;A popular meme places data science at the intersection of hacking, statistics and domain knowledge. It isn’t exactly untrue but it may give an aspiring data scientist the mistaken impression that those three areas are equally important. They’re not.&lt;/p&gt;
&lt;p&gt;I’m leaving domain knowledge out of this discussion because, while it’s absolutely necessary to have it to get anything done at all, it usually doesn’t have to be very deep and you’re almost always expected to pick it up on the job.&lt;/p&gt;</description></item><item><title>Looking for the text top model</title><link>http://nadbordrozd.github.io/blog/2017/08/12/looking-for-the-text-top-model/</link><pubDate>Sat, 12 Aug 2017 16:49:56 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2017/08/12/looking-for-the-text-top-model/</guid><description>&lt;p&gt;&lt;em&gt;TL;DR: I tested a bunch of neural network architectures plus SVM + NB on several text classification datasets. Results at the bottom of the post.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Last year I wrote a &lt;a href="http://nadbordrozd.github.io/blog/2016/05/20/text-classification-with-word2vec/"&gt;post&lt;/a&gt; about using word embeddings like word2vec or GloVe for text classification. The embeddings in my benchmarks were used in a very crude way - by averaging word vectors for all words in a document and then plugging the result into a Random Forest. Unfortunately, the resulting classifier turned out to be strictly inferior to a good old SVM except in some special circumstances (very few training examples but lots of unlabeled data).&lt;/p&gt;</description></item><item><title>So you think you can stats</title><link>http://nadbordrozd.github.io/blog/2017/07/18/so-you-think-you-can-stats/</link><pubDate>Tue, 18 Jul 2017 20:15:51 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2017/07/18/so-you-think-you-can-stats/</guid><description>&lt;p&gt;TL;DR: I prepared 5 puzzles about statistics that should be accessible to anyone without being trivial. Scroll down for the puzzles.&lt;/p&gt;
&lt;h3 id="data-science-and-statistics"&gt;Data Science and Statistics&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://twitter.com/bigdataborat/status/372350993255518208?lang=en"&gt;&lt;em&gt;&amp;ldquo;Data science is statistics on a Mac&amp;rdquo;&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://twitter.com/josh_wills/status/198093512149958656?lang=en-gb"&gt;&lt;em&gt;&amp;ldquo;Data Scientist (n.): Person who is better at statistics than any software engineer and better at software engineering than any statistician.&amp;rdquo;&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then there is &lt;a href="http://drewconway.com/zia/2013/3/26/the-data-science-venn-diagram"&gt;the famous Venn diagram&lt;/a&gt; with data science on the intersection of statstics, hacking and substantive expertise.&lt;/p&gt;</description></item><item><title>Loafing around with XGBoots</title><link>http://nadbordrozd.github.io/blog/2017/07/07/loafing-around-with-xgboots/</link><pubDate>Fri, 07 Jul 2017 21:00:31 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2017/07/07/loafing-around-with-xgboots/</guid><description>&lt;p&gt;&lt;em&gt;This is a guest post by &lt;a href="https://www.linkedin.com/in/javier-rodriguez-zaurin-06277454/?ppe=1"&gt;Javier Rodriguez Zaurin&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;My good friend Nadbor told me that he found on Reddit someone asking if data scientists end up doing boring tasks such as classifying shoes. As someone that has faced this problem in the past, I was committed to show that classifying shoes it is a challenging, entertaining task. Maybe the person who wrote that would find it more interesting if the objects to classify were space rockets, but whether rockets or shoes, the problem is of the same nature.&lt;/p&gt;</description></item><item><title>You won't believe how this Islington single dad is making £500/day while working from home</title><link>http://nadbordrozd.github.io/blog/2017/06/20/you-wont-believe-how-this-islington-single-dad-is-making-ps500-slash-day-working-from-home/</link><pubDate>Tue, 20 Jun 2017 22:32:10 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2017/06/20/you-wont-believe-how-this-islington-single-dad-is-making-ps500-slash-day-working-from-home/</guid><description>&lt;p&gt;&lt;sup&gt;Trigger warnings: programming humor, algorithms and data structures, Java&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m interviewing data engineering contractors recently. All of the candidates are very senior people with 10+ years of experience. My go to question:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Me:&lt;/strong&gt; &lt;em&gt;What data structure would you use (in your favorite programming language) to store a large number (let&amp;rsquo;s say 100k) of strings - so they can be looked up efficiently? And by &amp;rsquo;looked up&amp;rsquo; I mean - user will come up with a new string (&amp;lsquo;banana&amp;rsquo;) and you have to quickly tell if this string is an element of your collection of 100k?&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Candidate:&lt;/strong&gt; I would load them in an RDD and then&amp;hellip;&lt;br&gt;
&lt;strong&gt;Me:&lt;/strong&gt; &lt;em&gt;No, no, I&amp;rsquo;m not asking about Spark. This is a regular single-threaded, in-memory, computer science 101 problem. What is the simplest thing that you could do?&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Candidate:&lt;/strong&gt; Grep. I would use grep to look for the string.&lt;br&gt;
&lt;strong&gt;Me:&lt;/strong&gt; &lt;em&gt;Terrific. Sorry, maybe I wasn&amp;rsquo;t clear, I&amp;rsquo;m NOT talking about finding a substring in a larger text&amp;hellip; You know what, forget about the strings. There are no strings. You have 100k integers. What data structure would you put them in so you can quickly look up if a new integer (1743) belongs to the collection?&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Candidate:&lt;/strong&gt; For integers I would use an array.&lt;br&gt;
&lt;strong&gt;Me:&lt;/strong&gt; &lt;em&gt;And how do you find out if the new integer belongs to this array?&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Candidate:&lt;/strong&gt; There is a method &amp;lsquo;contains&amp;rsquo;.&lt;br&gt;
&lt;strong&gt;Me:&lt;/strong&gt; &lt;em&gt;Ok. And for an array of n integers, what is the expected running time of this method in terms of n?&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Candidate:&lt;/strong&gt; &amp;hellip;&lt;br&gt;
&lt;strong&gt;Me:&lt;/strong&gt; &amp;hellip;&lt;br&gt;
&lt;strong&gt;Candidate:&lt;/strong&gt; I think it would be under one minute.&lt;br&gt;
&lt;strong&gt;Me:&lt;/strong&gt; &lt;em&gt;Indeed.&lt;/em&gt;&lt;/p&gt;</description></item><item><title>Python or Scala - let the neural network decide.</title><link>http://nadbordrozd.github.io/blog/2017/06/03/python-or-scala/</link><pubDate>Sat, 03 Jun 2017 14:20:38 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2017/06/03/python-or-scala/</guid><description>&lt;p&gt;&lt;sup&gt;This is the second post about my experiments with LSTMs. &lt;a href="http://nadbordrozd.github.io/blog/2016/09/17/text-generation-with-keras-char-rnns/"&gt;Here&amp;rsquo;s&lt;/a&gt; the first one. &lt;a href="http://karpathy.github.io/2015/05/21/rnn-effectiveness/"&gt;This&lt;/a&gt; is a great introduction by Karpathy. And &lt;a href="https://r2rt.com/written-memories-understanding-deriving-and-extending-the-lstm.html"&gt;this&lt;/a&gt; is an in depth explanation of the math behind.&lt;/sup&gt;&lt;/p&gt;
&lt;h3 id="python-or-scala"&gt;Python or Scala?&lt;/h3&gt;
&lt;p&gt;Which should you use and when? Which should you learn first? Is type safety more important than flexibility? Is Python fast enough for performance-heavy applications? Is Scala&amp;rsquo;s machine learning ecosystem mature enough for serious data science? Are indents better than braces?&lt;/p&gt;</description></item><item><title>Missing data imputation with pymc: part 2</title><link>http://nadbordrozd.github.io/blog/2017/03/23/missing-data-imputation-with-pymc-part-2/</link><pubDate>Thu, 23 Mar 2017 21:52:41 +0000</pubDate><guid>http://nadbordrozd.github.io/blog/2017/03/23/missing-data-imputation-with-pymc-part-2/</guid><description>&lt;p&gt;In the &lt;a href="http://nadbordrozd.github.io/blog/2017/03/05/missing-data-imputation-with-bayesian-networks/"&gt;last post&lt;/a&gt; I presented a way to do Bayesian networks with pymc and use them to impute missing data. This time I benchmark the accuracy of this method on some artificial datasets.&lt;/p&gt;
&lt;h3 id="datasets"&gt;Datasets&lt;/h3&gt;
&lt;p&gt;In the previous posts I showed the imputation of boolean missing data, but the same method works for categorical features of any cardinality as well as continuous ones (except in the continues case additional prior knowledge is required to specify the likelihood). Nevertheless, I decided to test the imputers on purely boolean datasets because it makes the scores easy to interpret and the models quick to train.&lt;/p&gt;</description></item><item><title>Missing data imputation with bayesian networks in pymc</title><link>http://nadbordrozd.github.io/blog/2017/03/05/missing-data-imputation-with-bayesian-networks/</link><pubDate>Sun, 05 Mar 2017 15:15:17 +0000</pubDate><guid>http://nadbordrozd.github.io/blog/2017/03/05/missing-data-imputation-with-bayesian-networks/</guid><description>&lt;p&gt;This is the first of two posts about Bayesian networks, pymc and missing data. In the first post I will show how to do Bayesian networks in pymc* and how to use them to impute missing data. This part is boring and slightly horrible. In the second post I investigate how well it actually works in practice (not very well) and how it compares to a more traditional machine learning approach (poorly). &lt;strong&gt;Feel free to go straight to the &lt;a href="http://nadbordrozd.github.io/blog/2017/03/23/missing-data-imputation-with-pymc-part-2/"&gt;second post&lt;/a&gt;, it has plots in it&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Text generation with Keras char-RNNs</title><link>http://nadbordrozd.github.io/blog/2016/09/17/text-generation-with-keras-char-rnns/</link><pubDate>Sat, 17 Sep 2016 22:17:50 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2016/09/17/text-generation-with-keras-char-rnns/</guid><description>&lt;p&gt;I recently bought a deep learning rig to start doing all the cool stuff people do with neural networks these days. First on the list - because it seemed easiest to implement - text generation with character-based recurrent neural networks.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://nadbordrozd.github.io/images/deep_learning_pc.png" alt=""&gt;
&lt;em&gt;watercooling, pretty lights and 2 x GTX 1080 (on the right)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This topic has been widely written about by better people so if you don&amp;rsquo;t already know about char-RNNs go read them instead. &lt;a href="http://karpathy.github.io/2015/05/21/rnn-effectiveness/"&gt;Here&lt;/a&gt; is Andrej Karpathy&amp;rsquo;s blog post that started it all. It has an introduction to RNNs plus some &lt;em&gt;extremely&lt;/em&gt; fun examples of texts generated with them. For an in depth explanation of LSTM (the specific type of RNN that everyone uses) I highly recommend &lt;a href="http://r2rt.com/written-memories-understanding-deriving-and-extending-the-lstm.html"&gt;this&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>datamatching part 3: match scoring</title><link>http://nadbordrozd.github.io/blog/2016/07/29/datamatching-part-3-match-scoring/</link><pubDate>Fri, 29 Jul 2016 20:39:30 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2016/07/29/datamatching-part-3-match-scoring/</guid><description>&lt;p&gt;In this post I will share some tips on the final aspect of datamatching that was glossed over in parts &lt;a href="http://nadbordrozd.github.io/blog/2016/07/22/datamatching-part-2-spark-pipeline/"&gt;1&lt;/a&gt; and &lt;a href="http://nadbordrozd.github.io/blog/2016/07/20/datamatching-part-1/"&gt;2&lt;/a&gt; - scoring matches. This is maybe the hardest part of the process, but it also requires the most domain knowledge so it&amp;rsquo;s hard to give general advice.&lt;/p&gt;
&lt;h3 id="recap"&gt;Recap&lt;/h3&gt;
&lt;p&gt;In the previous posts we started with two datasets &amp;ldquo;left&amp;rdquo; and &amp;ldquo;right&amp;rdquo;. Using tokenization and the magic of spark we generated for every left record a small bunch of right records that maybe correspond to it. For example this record:&lt;/p&gt;</description></item><item><title>datamatching part 2: spark pipeline</title><link>http://nadbordrozd.github.io/blog/2016/07/22/datamatching-part-2-spark-pipeline/</link><pubDate>Fri, 22 Jul 2016 22:57:45 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2016/07/22/datamatching-part-2-spark-pipeline/</guid><description>&lt;p&gt;In the &lt;a href="http://nadbordrozd.github.io/blog/2016/07/12/datamatching-part-1/"&gt;last post&lt;/a&gt; I talked about the principles of datamatching, now it&amp;rsquo;s time to put them into practice. I will present a generic, customisable Spark pipeline for datamatching as well as a specific instance of it that for matching the toy datasets from the last post. TL;DR of the last post:&lt;/p&gt;
&lt;p&gt;To match two datasets:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Tokenize corresponding fields in both datasets&lt;/li&gt;
&lt;li&gt;Group records having a token in common (think SQL join)&lt;/li&gt;
&lt;li&gt;Compare records withing a group and choose the closest match&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;###Why spark
This datamatching algorithm could easily be implemented in the traditional single-machine, single-threaded way using a collection of hashmaps. In fact this is what I have done on more than one occasion and it worked. The advantage of spark here is built-in scalability. If your datasets get ten times bigger, just invoke spark requesting ten times as many cores. If matching is taking too long - throw some more resources at it again. In the single-threaded model all you can do is up the RAM as your data grows but the computation is taking longer and longer and there is nothing you can do about it.&lt;/p&gt;</description></item><item><title>datamatching part 1: algorithm</title><link>http://nadbordrozd.github.io/blog/2016/07/20/datamatching-part-1/</link><pubDate>Wed, 20 Jul 2016 21:59:14 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2016/07/20/datamatching-part-1/</guid><description>&lt;p&gt;In this and the next post I will explain the basics of datamatching and give an implementation of a bare-bones datamatching pipeline in pyspark.&lt;/p&gt;
&lt;p&gt;###Datamatching
You have a dataset of - let&amp;rsquo;s say - names and addresses of some group of people. You want to enrich it with information scraped from e.g. linkedin or wikipedia. How do you figure out which scraped profiles match wich records in your database?&lt;/p&gt;
&lt;p&gt;Or you have two datasets of sales leads maintained by different teams and you need to merge them. You know that there is some overlap between the records but there is no unique identifier that you can join the datasets on. You have to look at the the records themselves to decide if they match.&lt;/p&gt;</description></item><item><title>Dear Recruiter</title><link>http://nadbordrozd.github.io/blog/2016/06/15/dear-recruiter/</link><pubDate>Wed, 15 Jun 2016 11:22:10 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2016/06/15/dear-recruiter/</guid><description>&lt;p&gt;I&amp;rsquo;ve had a lot of experience with tech interviews and recruiters in the past and I&amp;rsquo;m likely to have a lot more in the future. A non-negligible fraction of that experience ranged from &amp;ldquo;mildly annoying&amp;rdquo; to &amp;ldquo;exasperating&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s a list of real examples of irritating recruiter behaviors together with guidlines on how I expect a reasonable person to act instead.&lt;/p&gt;
&lt;p&gt;Before we start you must understand where I&amp;rsquo;m coming from. I&amp;rsquo;m not constantly looking for new jobs. But when I do, I apply en masse and then I have to deal with many recruiters at once. Each one constantly calling me in the office or at home (what is it with your obsession with phone calls? Why not email?). This in itself can get annoying but on top of that there are other more serious offenses. I am usually extremely agreeable both in person and over the phone. A blog post is my way of expressing complaints that I wouldn&amp;rsquo;t dare make in a conversation with you. It&amp;rsquo;s also a form of catharsis so forgive me if I get somewhat snarky and don&amp;rsquo;t take offense if you personally are not guilty of the sins mentioned here.&lt;/p&gt;</description></item><item><title>Deepwalking with companies</title><link>http://nadbordrozd.github.io/blog/2016/06/13/deepwalking-with-companies/</link><pubDate>Mon, 13 Jun 2016 22:19:12 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2016/06/13/deepwalking-with-companies/</guid><description>&lt;p&gt;I have blogged about the wide usefulness of &lt;a href="http://nadbordrozd.github.io/blog/2015/11/29/ds-toolbox-topic-models/"&gt;topic models&lt;/a&gt; and I have &lt;a href="http://nadbordrozd.github.io/blog/2016/05/20/text-classification-with-word2vec/"&gt;benchmarked&lt;/a&gt; word-embedding-assisted classification on Reuter&amp;rsquo;s benchmark. This time I experiment with these ideas using a real world and decent sized dataset - the graph of UK/Irish companies. I have done this during my &amp;ldquo;10% time&amp;rdquo; at &lt;a href="http://www.duedil.com"&gt;DueDil&lt;/a&gt; (it&amp;rsquo;s like google&amp;rsquo;s &amp;ldquo;20% time&amp;rdquo;, except it &lt;a href="http://uk.businessinsider.com/google-20-percent-time-policy-2015-4?r=US&amp;amp;amp;IR=T"&gt;exists&lt;/a&gt;).&lt;/p&gt;
&lt;h3 id="graph-of-companies"&gt;Graph of companies&lt;/h3&gt;
&lt;p&gt;There are 4 million active companies in the UK and Ireland. DueDil collects all kinds of information about them - financials, legal structures, contact info, company websites, blogs, news appearences etc. All of it is presented to our users and some of it also serves as input to machine learning tasks - like classifying companies into industries.&lt;/p&gt;</description></item><item><title>Data engineers will hate you - one weird trick to fix your pyspark schemas</title><link>http://nadbordrozd.github.io/blog/2016/05/22/one-weird-trick-that-will-fix-your-pyspark-schemas/</link><pubDate>Sun, 22 May 2016 21:39:15 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2016/05/22/one-weird-trick-that-will-fix-your-pyspark-schemas/</guid><description>&lt;p&gt;I will share with you a snippet that took out a lot of misery from my dealing with pyspark dataframes. This is pysparks-specific. Nothing to see here if you&amp;rsquo;re not a pyspark user. The first two sections consist of me complaining about schemas and the remaining two offer what I think is a neat way of creating a schema from a dict (or a dataframe from an rdd of dicts).&lt;/p&gt;</description></item><item><title>Text classification with Word2Vec</title><link>http://nadbordrozd.github.io/blog/2016/05/20/text-classification-with-word2vec/</link><pubDate>Fri, 20 May 2016 17:18:58 +0000</pubDate><guid>http://nadbordrozd.github.io/blog/2016/05/20/text-classification-with-word2vec/</guid><description>&lt;p&gt;In the &lt;a href="http://nadbordrozd.github.io/blog/2015/11/29/ds-toolbox-topic-models/"&gt;previous post&lt;/a&gt; I talked about usefulness of topic models for non-NLP tasks, it&amp;rsquo;s back to NLP-land this time. I decided to investigate if word embeddings can help in a classic NLP problem - text categorization. Full code used to generate numbers and plots in this post can be found here: &lt;a href="https://github.com/nadbordrozd/blog_stuff/blob/master/classification_w2v/benchmarking.ipynb"&gt;python 2 version&lt;/a&gt; and &lt;a href="https://github.com/nadbordrozd/blog_stuff/blob/master/classification_w2v/benchmarking_python3.ipynb"&gt;python 3 version&lt;/a&gt; by Marcelo Beckmann (thank you!).&lt;/p&gt;
&lt;p&gt;####Motivation
The basic idea is that semantic vectors (such as the ones provided by Word2Vec) should preserve most of the relevant information about a text while having relatively low dimensionality which allows better machine learning treatment than straight one-hot encoding of words. Another advantage of topic models is that they are unsupervised so they can help when labaled data is scarce. Say you only have one thousand manually classified blog posts but a million unlabeled ones. A high quality topic model can be trained on the full set of one million. If you can use topic modeling-derived features in your classification, you will be benefitting from your entire collection of texts, not just the labeled ones.&lt;/p&gt;</description></item><item><title>DS toolbox - topic models</title><link>http://nadbordrozd.github.io/blog/2015/11/29/ds-toolbox-topic-models/</link><pubDate>Sun, 29 Nov 2015 14:59:33 +0000</pubDate><guid>http://nadbordrozd.github.io/blog/2015/11/29/ds-toolbox-topic-models/</guid><description>&lt;p&gt;If you&amp;rsquo;re not primarily working with NLP you may not have been paying attention to topic modeling and word embeddings. In this post I intend to convince you that you should.&lt;/p&gt;
&lt;p&gt;###Topic models
Topic models are a set of models in NLP that discover common themes in a collection of documents. You give it a list of texts and it comes up with a bunch of topics and maps every document to a topic or a mixture of topics. &lt;a href="http://www.princeton.edu/~achaney/tmve/wiki100k/browse/topic-presence.html"&gt;Here&lt;/a&gt; you can see a visualization of a topic model applied to wikipedia articles. As you can see, it picks up similar kinds of themes in the texts that a human being would notice. Take topic 5 for instance. Its top relevant words are &amp;ldquo;war&amp;rdquo;, &amp;ldquo;force&amp;rdquo;, &amp;ldquo;army&amp;rdquo;, &amp;ldquo;attack&amp;rdquo;, &amp;ldquo;military&amp;rdquo; and top articles: &amp;ldquo;Second Boer War&amp;rdquo;, &amp;ldquo;Erwin Rommel&amp;rdquo;, &amp;ldquo;Axis powers&amp;rdquo;, &amp;ldquo;Vietnam war&amp;rdquo;. Pretty neat. Most topic models (like the most popular &lt;a href="https://en.wikipedia.org/wiki/Latent_Dirichlet_allocation"&gt;LDA&lt;/a&gt; produce a vector of numbers for every text - the distribution of topics and a similar vector for every word - the affinity of the word to every topic.&lt;/p&gt;</description></item><item><title>Interviews</title><link>http://nadbordrozd.github.io/interviews/</link><pubDate>Sat, 07 Nov 2015 22:38:00 +0000</pubDate><guid>http://nadbordrozd.github.io/interviews/</guid><description>&lt;p&gt;I like to think of myself as a supervised learning algorithm. Give me 500 questions and 500 correct answers and I&amp;rsquo;ll take it from there. Unfortunately training examples for data science interviews are relatively scarce especially compared to software developer equivalents. There is the book &amp;ldquo;Data Science Interviews Exposed&amp;rdquo; which has a bunch but not nearly enough and there is &amp;ldquo;120 Data Science Interview Questions&amp;rdquo; which doesn&amp;rsquo;t have any answers. Having suffered through a lot of those interviews lately, I can now make a contribution to this pool. These are the questions I was asked in data scientist/machine learning engineer/data science consultant interviews (the ones that I remember and am allowed to disclose). The interviews took place mostly in London and mostly during 2014-2015. I list all the questions I got ordered by type from least to most interesting. I included my answers for the good ones at the bottom. I also editorialize a bit here and there and give advice on how to prepare but take with a grain of salt - my experience isn&amp;rsquo;t extensive enough that I can say anything with high confidence. But who can, really - it&amp;rsquo;s all so new, no one knows what they&amp;rsquo;re doing, everyone is just winging it (&amp;lt;- see, editorializing right here).&lt;/p&gt;</description></item><item><title>Lead scoring without negative examples</title><link>http://nadbordrozd.github.io/blog/2015/08/01/forgetting-salesman-problem-or-classification-without-negative-examples/</link><pubDate>Sat, 01 Aug 2015 20:49:26 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2015/08/01/forgetting-salesman-problem-or-classification-without-negative-examples/</guid><description>&lt;p&gt;How do you train a binary classifier when you have only positive-labeled training examples?
Impossible? Maybe. But sometimes you can do something just as good. Let&amp;rsquo;s start from the beginning&amp;hellip;&lt;/p&gt;
&lt;h3 id="lead-generation"&gt;Lead generation&lt;/h3&gt;
&lt;p&gt;Everyone and their mum in the b2b sector is trying to use machine learning
for lead generation. For our purposes lead-gen means selecting from the millions of active companies in your country the ones that are most likely to buy your product once contacted by your sales team. Needless to say lead generation is extremely &lt;em&gt;serious business&lt;/em&gt; and constitutes a market sector in its own right - a type of b2b2b if you will.&lt;/p&gt;</description></item><item><title>test post</title><link>http://nadbordrozd.github.io/blog/2015/07/26/test-post/</link><pubDate>Sun, 26 Jul 2015 22:20:42 +0100</pubDate><guid>http://nadbordrozd.github.io/blog/2015/07/26/test-post/</guid><description>&lt;p&gt;This is my first post. pls work pls
This is code span (hopefully)
&lt;code&gt;def fibo(n): if n &amp;lt; 2: return 1 else: return fibo(n - 1) + fibo(n - 2) &lt;/code&gt;&lt;/p&gt;</description></item><item><title>Blog archive</title><link>http://nadbordrozd.github.io/blog/archives/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://nadbordrozd.github.io/blog/archives/</guid><description/></item><item><title>Projects</title><link>http://nadbordrozd.github.io/projects/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://nadbordrozd.github.io/projects/</guid><description>&lt;p&gt;Games, experiments, and other things I have built.&lt;/p&gt;</description></item></channel></rss>