<?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 Aashay Sachdeva on Medium]]></title>
        <description><![CDATA[Stories by Aashay Sachdeva on Medium]]></description>
        <link>https://medium.com/@aashay96?source=rss-31b32f46b65c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bYePz-Hfbxupwx4RWxhVZA.jpeg</url>
            <title>Stories by Aashay Sachdeva on Medium</title>
            <link>https://medium.com/@aashay96?source=rss-31b32f46b65c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 07:08:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aashay96/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[There is still opportunity for Indic Large Models]]></title>
            <link>https://aashay96.medium.com/there-is-still-opportunity-for-indic-large-models-5fbe993618a6?source=rss-31b32f46b65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5fbe993618a6</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[india]]></category>
            <category><![CDATA[vc]]></category>
            <category><![CDATA[investment]]></category>
            <dc:creator><![CDATA[Aashay Sachdeva]]></dc:creator>
            <pubDate>Mon, 14 Aug 2023 11:29:19 GMT</pubDate>
            <atom:updated>2023-08-14T11:29:19.080Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*1K0Bd4K5fd1pdp8uZ60OKA.jpeg" /></figure><p>I have been spending quite some time reading papers on multilingual and multimodal language-vision model. But <a href="https://arxiv.org/abs/2308.04948">this</a> paper seems like an inflection point on my following thesis -</p><h3><strong>There is still opportunity in Indic Models</strong></h3><p>Don’t get me wrong — building a foundational, generic model is by no means an easy task. There is a reason why no open-source model is even close to gpt-3.5, let alone gpt-4 (which is an engineering feat in itself). And most people will disagree, with extremely good counter points (TAM probably is too small). <em>I am wrong till proven right.</em></p><p>But there are following indicators that it can be done using current open-source models as base, and get to gpt3.5 kind of performance on indic language benchmarks. From there we can start thinking about Mixture of experts to reach the mighty GPT-4 in performance on Indic benchmarks.</p><ol><li><strong>GPT-4 is still behind on indic languages as compared to the top languages.</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vTHC24aw2oh6_WIMCzvDDg.png" /></figure><p>2. At India’s “DAU Farm” scale, openai’s api would be extremely expensive. Indian Language tokens already <strong>consume 2–3x more tokens</strong>, and if every products needs to have intelligence embedded, we need better alternatives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*8uZJBa953_2eQ6APkpCh4A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*nNCUGPxaY0GDbcaseKM24A.png" /><figcaption>English vs hindi token consumption</figcaption></figure><p>3. <strong>LLMs are evolving into platforms</strong> — LLMs are amazing parsers. We have seen this with Agent frameworks (ability to call functions), Chatgpt Plugin platform. Mark in the <a href="https://www.youtube.com/watch?v=Ff4fRgnuFgQ">podcast with lex</a> talks about how AI agents will be present in every Meta app, built on top of Llama. Scale, Palantir have shown a demo of LLMs in defence — they act as command centers. For something evolving into something so critical, why would we not want to build something of our own? And India’s biggest strength has been building country level platforms (UPI, Aadhar etc). May be we can show the way how to build platforms around LLM.</p><p>4. We can build much smaller models and they can be coherent in language, this isn’t likely a property just related to large models. Recent work has shown targeted distillation on specific tasks can create smaller and much better models.</p><ul><li><a href="https://arxiv.org/abs/2305.07759">TinyStories: How Small Can Language Models Be and Still Speak Coherent English?</a></li><li><a href="https://arxiv.org/abs/2308.03279">UniversalNER: Targeted Distillation from Large Language Models for Open Named Entity Recognition</a></li></ul><p>5. llama has shown small models can become good enough — the loss for 7B doesn’t saturates. Smaller models will have much lesser inference cost and can be easily finetuned to fit the usecases from the base model. Scale is not the only metric to optimise for(check out the image from PALM paper). One of openai’s biggest achievement has been able to serve reliably gpt3.5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O7lx1DWQI3fCf1xdLtWZMw.png" /><figcaption>llama 7b lose not saturating</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V4lvZGzYhc35XDWu1sOEDQ.png" /></figure><p>We haven’t even moved in multi-modality. Most of India prefers audio as means of conversation, a platform like chatgpt only serves a very small population.</p><h3>Michael Dempsey on Twitter: &quot;Great chart from:A Survey on Multimodal Large Language Models - https://t.co/TXzavo5pvq pic.twitter.com/YQJQA8rqFq / Twitter&quot;</h3><p>Great chart from:A Survey on Multimodal Large Language Models - https://t.co/TXzavo5pvq pic.twitter.com/YQJQA8rqFq</p><p>Vision models carry inherent biases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t0wiI2lZA4YLsXlpj58Tnw.png" /></figure><p>I had created a sample model finetuned via LoRA, but it already feels three generations old. The current roadmap would be — finetune a code based LLM which supports multilingual (salesforce xgen is a good example) + use AI4Bharat indic corpora + instruction fine tuning combining open source datasets + evol instruct technique (added caveat being we will need to translate which will bump up the error).</p><p><a href="https://huggingface.co/aashay96/indic-BloomLM">aashay96/indic-BloomLM · Hugging Face</a></p><p>If you are building in this space, happy to have a chat. Connect with me on <a href="https://twitter.com/AashaySachdeva">Twitter</a> or <a href="https://www.linkedin.com/in/aashay-sachdeva-020806b7/">linkedin</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5fbe993618a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multi-armed Bandits with Constraint]]></title>
            <link>https://aashay96.medium.com/multi-armed-bandits-with-constraint-9ba8000184df?source=rss-31b32f46b65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ba8000184df</guid>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[multi-armed-bandit]]></category>
            <dc:creator><![CDATA[Aashay Sachdeva]]></dc:creator>
            <pubDate>Sun, 03 Apr 2022 17:50:10 GMT</pubDate>
            <atom:updated>2022-04-03T17:53:04.782Z</atom:updated>
            <content:encoded><![CDATA[<p>I love using bandits in online systems. They are easy to understand conceptually, easy to implement, and allow you to explore a bigger policy space than you would be able to using a simple A/B test. They work great when the interpretability required is low, and window of opportunity for optimization is short-lived and there’s not enough time for gathering statistically significant results. For ex- optimizing pricing for a limited period offer.</p><p>Of course, they are not perfect. Convergence is hard if the policy space is large and too many policies together might spoil UX. But a well-designed bandit experiment can optimize over a large decision space.</p><p><em>Check out how Amazon optimizes over web page layout using bandits — </em><a href="https://arxiv.org/pdf/1810.09558.pdf">https://arxiv.org/pdf/1810.09558.pdf</a></p><p>One of the issues with vanilla bandits is that it doesn’t take constraints into account. When you are running them in the real world, you will have multiple constraints on things like budget, time for optimization, number of users, etc.</p><p>So how do we use bandits in a constrained setting?</p><p><strong>Budgeted Thompson Sampling</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*8jvffL5QTJoQQk44n-zobQ.png" /><figcaption>R∗ is the expected reward of the optimal policy (the policy that can obtain the maximum expected reward given the reward and cost distributions of each arm),</figcaption></figure><p>This <a href="https://arxiv.org/pdf/1505.00146.pdf">paper</a> proposes a method to estimate the approximate policy for a MAB under constraints. While getting the optimal policy for budgeted MAB could be very complex, the paper proves that, when the reward and cost per pulling are supported in [0, 1] and the budget is large, the method can achieve the almost optimal reward by always pulling the optimal arm (associated with the maximum expected-reward-to-expected-cost ratio).</p><p>The algorithm itself is pretty simple -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*bKKSOjuvWHGzyQxfQSp5_A.png" /></figure><p>Let’s dive into it!</p><p>First, we need to define both our rewards and costs in [0,1]. This is easy; just normalize the reward and cost by the highest value. The total budget B is used to define the total number of iterations that happens; for every iteration, the cost is deducted from the budget. The algorithm stops optimizing once budget is exhausted.</p><p>Initialize for all arms two beta distributions <strong>Beta(α,β)</strong> as given in step 4-</p><ol><li>For reward- <strong>Beta(1,1)</strong></li><li>For cost- <strong>Beta(1,1)</strong></li></ol><p>Now for the first iteration, show the arm for which -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*vTYRQ0IhhXy5pjr0RObklw.png" /></figure><p>The numerator denotes the sample from the reward’s beta distribution, while the denominator denotes the sample from the cost’s beta distribution. In the starting, all arms will get picked randomly, since both the numerator and denominator are being sampled from almost the same distribution.</p><p>Once the arm is picked, the reward and cost distribution are updated -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6cAfFfyTmsgKKoFLslwMjg.png" /></figure><p>for the reward’s beta distribution, the <strong>α</strong> parameter is updated by adding the reward value to it. For the <strong>β </strong>parameter, the update added is 1-r.</p><p>For cost distribution-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qmOMJkMH8Tt9a9PsYAVz4A.png" /></figure><p><strong>α</strong> parameter is updated by adding the cost value to it. For the <strong>β </strong>parameter, the update added is 1-cost.</p><p>From the budget, the cost is then deducted. The iterative process stops once the budget is over.</p><p>That’s it! Pretty simple to understand and straightforward to implement. But does the algorithm converge? Well, for that you will need to deep dive into the paper, where they provide proof that the algorithm converges to the optimal arm given enough iterations.</p><p>I did some simulations and given enough iterations, the model started to converge -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cGdQ6YbGpBLSTWYGvHYnUg.png" /><figcaption>arms with cost -10,8,5,3, iteration 200</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z9kHBHEP6e-Sw_CweE33-w.png" /><figcaption>iteration 3000</figcaption></figure><p>Rough Code for generating the simulation -</p><pre>import numpy as np<br>import random<br>from scipy.stats import beta<br>import matplotlib.pyplot as plt<br>from numpy.random import choice<br>plt.rcParams[&#39;figure.figsize&#39;] = [10, 7]<br>import pandas as pd</pre><pre>def plot_list(reward,penalties,iteration,plot_name):<br>  x = np.linspace(0, 1, 10000)<br>  y1 = beta.pdf(x, reward[0], penalties[0])<br>  y2 = beta.pdf(x, reward[1], penalties[1])<br>  y3 = beta.pdf(x, reward[2], penalties[2])<br>  y4 = beta.pdf(x, reward[3], penalties[3])</pre><pre>plt.title(f&quot;PDF of Beta (Bell-shape) iteration({iteration} // {plot_name})&quot;, fontsize=20)<br>  plt.xlabel(&quot;X&quot;, fontsize=16)<br>  plt.ylabel(&quot;Probability Density&quot;, fontsize=16)<br>  plt.plot(x, y1, linewidth=3, color=&#39;firebrick&#39;)<br>  plt.annotate(f&quot;Beta( {reward[0]},{penalties[0]}) { 10}&quot;, xy=(1.75, 19), size = 14, ha=&#39;center&#39;, va=&#39;center&#39;, color=&#39;firebrick&#39;)<br>  plt.plot(x, y2, linewidth=3, color=&#39;burlywood&#39;)<br>  plt.annotate(f&quot;Beta( {reward[1]},{penalties[1]}) { 8}&quot;, xy=(1.75, 16.25), size = 14, ha=&#39;center&#39;, va=&#39;center&#39;, color=&#39;burlywood&#39;)<br>  plt.plot(x, y3, linewidth=3, color=&#39;dodgerblue&#39;)<br>  plt.annotate(f&quot;Beta( {reward[2]},{penalties[2]}) { 5}&quot;, xy=(1.75, 15), size = 14, ha=&#39;center&#39;, va=&#39;center&#39;, color=&#39;dodgerblue&#39;)<br>  plt.plot(x, y4, linewidth=3, color=&#39;green&#39;)<br>  plt.annotate(f&quot;Beta( {reward[3]},{penalties[3]}) { 3}&quot;, xy=(1.75, 17.5), size = 14, ha=&#39;center&#39;, va=&#39;center&#39;, color=&#39;green&#39;)<br>  plt.ylim([0, 20])<br>  plt.xlim([0, 2])<br>  plt.show()</pre><pre>def plot_count(num,iteration):<br>  plt.bar([&#39;A10&#39;,&#39;A08&#39;,&#39;A05&#39;,&#39;A03&#39;],num)<br>  plt.title(f&quot;Arms selected the most  {iteration}&quot;)<br>  plt.xlabel(&#39;Arms&#39;)<br>  plt.ylabel(&#39;Number Of Times Each Arm Was Selected To Play&#39;)<br>  plt.show()</pre><pre>rl10 = [choice([0,0,1]) for i in range(4000)]<br>rl8 =  [choice([0,0,1]) for i in range(4000)]<br>rl5 =  [choice([0,1]) for i in range(4000)]<br>rl3 =  [choice([0,0,1]) for i in range(4000)]<br>data=pd.DataFrame({<br>    &#39;val10&#39;:rl10,<br>    &#39;val8&#39;:rl8,<br>    &#39;val5&#39;:rl5,<br>    &#39;val3&#39;:rl3,<br>})</pre><pre>rl10 = [choice([j/10 for j in range(10)]) for i in range(4000)]<br>rl8 =  [choice([j/10 for j in range(10)]) for i in range(4000)]<br>rl5 =  [choice([j/10 for j in range(10)]) for i in range(4000)]<br>rl3 =  [choice([j/10 for j in range(10)]) for i in range(4000)]<br>data_cost=pd.DataFrame({<br>    &#39;val10&#39;:rl10,<br>    &#39;val8&#39;:rl8,<br>    &#39;val5&#39;:rl5,<br>    &#39;val3&#39;:rl3,<br>})</pre><pre>def paper_approach_plot(observations,arms,data,data_cost):<br>  #other initializations<br>  Sr=[0]*arms<br>  Fr=[0]*arms<br>  Sc=[0]*arms<br>  Fc=[0]*arms<br>  <br>  arms_selected = []<br>  numbers_of_selections_of_each_arm=[0]*arms<br>  <br>  for n in range(observations):<br>    arm = 0<br>    max_val = 0<br>    for i in range(arms):<br>      theta_r=random.betavariate(Sr[i]+1,Fr[i]+1)<br>      theta_c=random.betavariate(Sc[i]+1,Fc[i]+1)<br>      I=theta_r/theta_c<br>      if I&gt;max_val:<br>            max_val=I<br>            arm=i<br>      <br>    r = data.values[n, arm]<br>    c = data_2.values[n, arm]<br>#     if r==0:<br>#       c=0<br>    Sr[arm]+=r<br>    Fr[arm]+=(1-r)<br>    Sc[arm]+=c<br>    Fc[arm]+=(1-c)<br>    <br>    arms_selected.append(arm) <br>    numbers_of_selections_of_each_arm[arm]+=1</pre><pre>if n%200==0 or n==observations-1:<br>      plot_list(Sr,Fr,n,&quot;reward&quot;)<br>      plot_list(Sc,Fc,n,&quot;cost&quot;)<br>      plot_count(numbers_of_selections_of_each_arm,n)</pre><p>I hope you found it useful and are able to use bandits in a constraint setting. If you face any issues or just want to have a discussion, feel free to DM me on Twitter — <a href="https://twitter.com/AashaySachdeva">https://twitter.com/AashaySachdeva</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ba8000184df" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You can’t always A/B test, that is why you need to learn about Quasi Experiments]]></title>
            <link>https://aashay96.medium.com/you-cant-always-a-b-test-that-is-why-you-need-to-learn-about-quasi-experiments-8cb254c9892e?source=rss-31b32f46b65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8cb254c9892e</guid>
            <category><![CDATA[experiment]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[causal-inference]]></category>
            <dc:creator><![CDATA[Aashay Sachdeva]]></dc:creator>
            <pubDate>Thu, 02 Sep 2021 06:00:08 GMT</pubDate>
            <atom:updated>2021-09-02T06:00:08.192Z</atom:updated>
            <content:encoded><![CDATA[<p>Experimentations are the bread and butter of most great product companies (albeit <a href="https://iterativepath.wordpress.com/2012/10/29/testing-40-shades-of-blue-ab-testing/">google</a> takes it up a notch-where you could call it insanity). Experiments need to be designed with rigor so that there is confidence that the changes are right for the customers and the business as well.While Randomized controlled experiments are the gold standard for establishing causality, but sometimes running such an experiment is not possible. Such situations can arise:</p><ol><li>When the causal impact to be tested is not in companies control.</li><li>When establishing a Control may incur too large an opportunity cost since they do not receive the Treatment. For example, A/B experiments can be costly for rare events, such as establishing the impact of running ads during the IPL.</li><li>There is legal or ethical issues-holding information from a user about the side effects of medicine being currently tested.</li><li>When proper randomization is tough to perform.</li><li>It is not technically feasible to perform an A/B test.</li></ol><p>For example, at MPL, we currently want to test the impact of changing our Matchmaking algorithm. All users get added to a queue and get matched on certain criteria. Doing an A/B test by randomly assigning users to test and control in this case would lead to a drop in concurrency, which in turn will increase the matchmaking time, which will effect the user experience.</p><p>In the above situations, often the best approach is to estimate the effects using multiple methods that are lower in the hierarchy of evidence -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*PG7Lf40ce_jCrDRVwRaYrQ.jpeg" /><figcaption><a href="https://shopify.engineering/using-quasi-experiments-counterfactuals">https://shopify.engineering/using-quasi-experiments-counterfactuals</a></figcaption></figure><p><strong>What is a Quasi Experiment?</strong></p><p>A quasi-experiment is an experiment where your treatment and control group are divided by a natural process that isn’t <em>truly</em> random but is considered close enough to compute estimates. We will use different methods to compute how close control and test are (with a lot of assumptions!).</p><p><strong>Pitfalls</strong></p><p>Before we dive into different methods, we must understand the pitfalls these experiments suffer from. The main pitfall, regardless of method, is <strong>unanticipated confounds</strong> that can impact both the measured effect, as well as the attribution of causality to the change of interest. Because of these confounds, quasi-experiments require a great deal of care to yield trustworthy results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oSmMG1UKVXj3eTGg-zBJJQ.png" /><figcaption>One common type of confound is an unrecognized common cause. For example, in humans, palm size has a strong correlation with life expectancy: on average the smaller your palm, the longer you will live. However, the common cause of smaller palms and longer life expectancy is gender: women have smaller palms and live longer on average (about six years in the US). Ron Kohavi; Diane Tang; Ya Xu. Trustworthy Online Controlled Experiments (Kindle Locations 3396–3398). Cambridge University Press. Kindle Edition.</figcaption></figure><p><strong>Key approaches in Quasi Experiment method</strong></p><ol><li><strong>Interrupted Time Series</strong></li></ol><p>Interrupted Time Series (ITS) is a quasi-experimental design, where you can control the change within your system, but you cannot randomize the Treatment to have a proper Control and Treatment. Instead, you use the same population for Control and Treatment, and you vary what the population experiences over time. A good read on how <a href="https://netflixtechblog.com/quasi-experimentation-at-netflix-566b57d2e362">netflix uses ITS</a>.</p><p>One of the easiest ways to conduct ITS is to do an on and off experiments-run the intervention for a particular period, then switch off and run without the intervention.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*yDCGXFT6Lk_IXX7tl4vHBQ.png" /><figcaption><a href="https://netflixtechblog.com/quasi-experimentation-at-netflix-566b57d2e362">https://netflixtechblog.com/quasi-experimentation-at-netflix-566b57d2e362</a></figcaption></figure><p><strong>2. Bayesian Structural Time Series</strong></p><p>(one of the best article explaining BSTs- <a href="https://towardsdatascience.com/implementing-causal-impact-on-top-of-tensorflow-probability-c837ea18b126">Tfcausalimpact</a>)</p><p>I will shamelessly use what the author of the above post has used, because it is quite literally one of the easiest explanation I have read -</p><blockquote><em>The main goal of the algorithm is to infer the expected effect a given intervention (or any action) had on some response variable by analyzing differences between expected and observed time series data.</em></blockquote><blockquote><em>Data is divided in two parts: the first one is what is known as the “pre-intervention” period and the concept of </em><a href="https://en.wikipedia.org/wiki/Bayesian_structural_time_series"><em>Bayesian Structural Time Series</em></a><em> is used to fit a model that best explains what has been observed. The fitted model is used in the second part of data (“post-intervention” period) to forecast what the response would look like had the intervention not taken place. The inferences are based on the differences between observed response to the predicted one which yields the absolute and relative expected effect the intervention caused on data.</em></blockquote><p>At MPL we extensively use this library.We used it to prove the positive effect of our new matchmaking algorithm -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NcCj_uft2dKaJ02dtoHjQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rSapSRLW_mcZg4KUW80Ujg.png" /><figcaption>Output of the library</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*08uh1E-5bsjux3VxYzN65Q.png" /></figure><p><strong>3. Difference in Difference</strong></p><p>For this method to be applicable, you have to find a control group that shows a trend that’s parallel to your treatment group for the metric of interest, prior to any treatment being applied. Then, after treatment happens, you assume the break in the parallel trend is only due to the treatment itself. This is summed up in the above diagram. At MPL, we use a mix of correlation and cointegration between different games PDAU(playing Daily active users), CPDAU, total gameplays and retention (and ofcourse do a sanity check with the operations team) to find these similar groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*eiq9-yDcChxeLUZXqQRk2w.jpeg" /><figcaption><a href="https://shopify.engineering/using-quasi-experiments-counterfactuals">https://shopify.engineering/using-quasi-experiments-counterfactuals</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*s10awz5f7mqRGzlzQoW1qw.png" /><figcaption>Correlation matrix between fruitchop and other games</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*dQo-6Cua8kREQ7nN6ANsRA.png" /><figcaption>cointegration P-values</figcaption></figure><p>This method worked for us, as for fruitchop we got fruitcutter as one of the games, both of them belong to the same category as well are very similar games with very similar user distribution.</p><p><strong>Conclusion</strong></p><p>While A/B test are still the gold standard for proving causation, not being able to perform randomized test shouldn’t block us from experimenting. Quasi experimentation are powerful tool for causal inference when used right!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8cb254c9892e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[In a world of Metrics]]></title>
            <link>https://aashay96.medium.com/in-a-world-of-metrics-5e075955952e?source=rss-31b32f46b65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e075955952e</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[product-management]]></category>
            <dc:creator><![CDATA[Aashay Sachdeva]]></dc:creator>
            <pubDate>Thu, 15 Apr 2021 19:15:37 GMT</pubDate>
            <atom:updated>2021-04-15T19:27:48.706Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*snOUApaJoLbUtGB69Z6KUA.png" /></figure><p>Coming up with a great set of metrics is an art in itself — they can lead to better Product Decision, makes it easier to align all stakeholder, and <strong>discovery </strong>around how your product is being used.</p><p>Each Product will have 3–5 Key Metrics, that can provide a holistic view of the product’s value to the end user. (Read more <a href="https://mixpanel.com/blog/shreyas-doshi-product-metrics/">here</a>). The key metrics should act as proxies to the business value the product is generating, and also be responsive to product changes. A good product company prioritizes features that optimize its key metrics. A great product company combines metrics data and intuition (developed over years after being in the market) to come up with their strategy.</p><p>Thanks to more understanding on how to lead Data Science Projects, most data science teams have now moved from research divisions to delivery orgs — that is, they are expected to add value to the company swiftly and not be stuck in research mode forever. Data Scientists now form a valuable part of most product teams and need to be able to convey their impact through well-defined metrics for their impact.</p><h3>Can product value always be measured and analyzed?</h3><p>Yes. No matter how “fuzzy” or intangible the value may appear, you can apply quantitative measurements to any product, aka, use a proxy. For example, it is impossible to know how much value Medium adds to its readers, but a good proxy is how much time a user is spending weekly on the website reading.</p><h3>Mental Model for thinking about Experiment Metrics</h3><p>Suppose you are working with the Personalisation team at YouTube, and you have to come up with a baseline model for recommending the following section -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8_wtcLCmHViI2z2j.png" /></figure><p>Now, you need to design your A/B experiment. What metrics are you going to track to understand the impact of the model and the behavior of different sets of users?</p><p>We will be able to define this if we understand the User Journey in the current product, and where he derives values from ML.</p><h3>The Interaction Point</h3><p>Where does the user interact with your model in the UI? Is it a new section? Or does the section already exist, and is going to now get powered using ML? Let’s assume the section already exists, and in the first A/B experiment, 5% of users get recommendations through the ML model.</p><p>How to quantify users in the test group are finding the content to be more relevant at this stage? A simple metric here would be the <strong>Click-through rate</strong>, i.e, of the top 3 recommended, users in the test group are clicking more on it vs the control group.</p><h3>The Value Moment</h3><p>Your product’s value moment is an event, an action, or a series of events and actions that represent the moment that a user found value in your product. Are the users finding actual value in the content they clicked on — this can be defined in terms of minutes spent watching, shares, likes, download, etc. A relevant metric here could be the average time spent by users watching recommended videos.</p><h3>Moving the needle</h3><p>All good on tracking online metrics for the model, but are these translating to the key product metrics that the stakeholders care about? Are the users in the test group on average <strong>more engaged</strong> — Are they spending more time on the platform? How is the ads revenue getting impacted?</p><h3>Segmenting Users</h3><p>Depending on the population chosen for the experiment, cohorts need to be created based on percentiles of activity (to identify power users), region-based cohorts/breakdowns by countries (there’s a lot of cultural difference in how people use the app as well as their data usage). Try to break it down as much as you can and try to understand the impact of the ML model on these different cohorts. Even in an experiment with flat results, a cohort with substantial users may have had a positive reaction. If we can correctly identify these users, we may be able to drive value for the business by rolling out the new variant selectively to the subpopulations that had a positive reaction. This can substantially increase the value of flat experimental results.</p><p>I have definitely made a lot of assumptions for this post, but here I just wanted to introduce how we can think of metrics from a more product standpoint.</p><p><em>Subscribe to my weekly newsletter here- </em><a href="http://aashaysachdeva.substack.com"><em>aashaysachdeva.substack.com</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e075955952e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ML on Browser : Machine Learning at Cutouts]]></title>
            <link>https://aashay96.medium.com/ml-on-browser-machine-learning-at-cutouts-6326e9d6e7cf?source=rss-31b32f46b65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6326e9d6e7cf</guid>
            <category><![CDATA[browsers]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[product]]></category>
            <category><![CDATA[tensorflow]]></category>
            <dc:creator><![CDATA[Aashay Sachdeva]]></dc:creator>
            <pubDate>Wed, 04 Nov 2020 11:23:39 GMT</pubDate>
            <atom:updated>2020-11-04T11:23:39.028Z</atom:updated>
            <content:encoded><![CDATA[<h3>ML on Browser : Machine Learning at Cutouts</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xcumCoyWsAL4qd4iwOX4Iw.png" /><figcaption>checkout <a href="https://cutouts.app/">https://cutouts.app/</a></figcaption></figure><p>Two weeks earlier, we launched Cutouts on <a href="https://www.producthunt.com/">producthunt</a> ( We were in product hunt’s top 5 product of the day! Check us out <a href="https://www.producthunt.com/posts/cutouts">here</a>.) We got a lot of requests from people to write about building a ML model for browser- so here we are!</p><p>We wanted designed cutouts to be privacy-first, but also give users an amazing user experience. Tagging and Searching had to be taken care using Machine Learning, and the given all the constraint, it was clear to us we had to run the ML models on the browser. In comes,<a href="https://www.tensorflow.org/js"> Tensorflow.js</a>, which let’s you use ML directly in the browser. But Tensorflow js is still very new, so it limit what we can do using it.</p><h3>The Wrong Way</h3><p>Due to my limited knowledge of the TF-js environment, my initial hypothesis was we could write any model in normal python and convert to tf-js using <a href="https://www.tensorflow.org/js/guide/conversion">tensorflow js converter</a>, and the only constraint was that the model size has to be small to be able to run in the browser. I used Keras hub to load a tiny 20 dimension Language Embedding model, and attached a dense layer to it. This was the code for creating this model-</p><pre>model = &quot;https://tfhub.dev/google/tf2-preview/gnews-swivel-20dim/1&quot;<br>embedding_layer = hub.KerasLayer(model, output_shape=[20], input_shape=[], dtype=tf.string, trainable=False)<br><br>def create_model():<br>  model = tf.keras.Sequential([<br>    #tf.keras.layers.Input(shape=[], dtype=tf.string),<br>    embedding_layer,<br>    tf.keras.layers.Dense(64, activation=&quot;relu&quot;),<br>    tf.keras.layers.Dense(16, activation=&quot;relu&quot;),<br>    tf.keras.layers.Dense(4,activation=&#39;softmax&#39;),<br>  ])<br>  model.compile(loss=tf.losses.CategoricalCrossentropy(from_logits=Tru<br>e),<br>      optimizer=&quot;adam&quot;, metrics=[&#39;accuracy&#39;])<br>  return model<br><br>model = create_model()</pre><p>And then I tried to convert this to a JS based model using the tensorflow converter.</p><p>After hours beating my head around the bush, I finally gave up. Tensorflow js doesn’t have support for keras hub as of now (and also a lot of custom layers that people have implemented on the internet).</p><p>Now what?</p><h3>How we got it working</h3><p>We realised that we need a LM model that was available on both TFjs repository and as python implementation. We found a lite implementation for Universal Sentence Encoder was available for <a href="https://github.com/tensorflow/tfjs-models/tree/master/universal-sentence-encoder">Tfjs</a> as well as <a href="https://tfhub.dev/google/universal-sentence-encoder-lite/2">python.</a></p><p>The next step was to create embeddings vectors for the text data using the USE lite implementation in python. I used the implementation as provided by tensorflow USE docs (I ran them in batches for quicker results)</p><pre>all_embeddings = []<br><br>for i in range(0,len(text_data),256):<br>    print(i)<br>    messages = text_data[i:i+256]<br>    <br>    values, indices, dense_shape = process_to_IDs_in_sparse_format(sp, messages)<br><br>    with tf.Session() as session:<br>      session.run([tf.global_variables_initializer(),           tf.tables_initializer()])<br>      message_embeddings = session.run(<br>          encodings,<br>          feed_dict={input_placeholder.values: values,<br>                    input_placeholder.indices: indices,<br>                    input_placeholder.dense_shape: dense_shape})<br><br>    all_embeddings.append(np.array(message_embeddings))</pre><p>Quick Note- The python USE lite implementation is in tf version 1.15 and not the latest one. Make sure to use -</p><pre>import tensorflow.compat.v1 as tf<br>tf.disable_v2_behavior()</pre><p>. The embedding vector is of the shape (1,512) . We then trained a small CNN on the text embeddings itself.</p><pre>model = tf.keras.Sequential()<br>model.add(tf.keras.layers.Conv1D(32,<br>                 kernel_size=3,<br>                 activation=&#39;tanh&#39;,<br>                 strides=1,input_shape=(512,1)))<br><br>model.add(tf.keras.layers.Flatten())<br><br># We add a vanilla hidden layer:<br>model.add(tf.keras.layers.Dense(16,activation=&#39;relu&#39;))<br>model.add(tf.keras.layers.Dense(5, activation=&#39;softmax&#39;))<br>model.compile(loss=tf.losses.SparseCategoricalCrossentropy(from_logits=True),<br>      optimizer=&quot;adam&quot;, metrics=[&#39;accuracy&#39;]</pre><p>And then, you can just use the tensorflow converter to actually save just this CNN model using -</p><pre>tf.keras.models.save_model(<br>    model, &#39;saved_models/text_classifier_cnn/&#39;, overwrite=True, include_optimizer=True, save_format=&#39;tf&#39;,<br>    signatures=None, options=None<br>)</pre><p>And that’s it. Your JS model is ready.</p><h3>Browser Side Implementation</h3><p>The Browser side required the two models to be downloaded, the LM model converting text to embeddings and the second model predicting the class, stitched together. The first time a cutout is saved. After that, the model is cached.</p><p>I hope this will inspire more people to build ML models for browser and be privacy first.</p><p>Next up- Building on browser models for search, Learning to rank and Image/Video Tagging. Stay Tuned!</p><p><em>Try out our app and help us with feedbacks! Cutouts is free and secure — </em><a href="https://cutouts.app/">https://cutouts.app/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6326e9d6e7cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Slack might be the greatest example of Product led growth]]></title>
            <link>https://aashay96.medium.com/slack-might-be-the-greatest-example-of-product-led-growth-679aaf6f6334?source=rss-31b32f46b65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/679aaf6f6334</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[growth]]></category>
            <dc:creator><![CDATA[Aashay Sachdeva]]></dc:creator>
            <pubDate>Wed, 02 Sep 2020 10:19:56 GMT</pubDate>
            <atom:updated>2020-09-03T18:59:43.184Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BCbaWb8A1DU5RqMH" /><figcaption>Photo by <a href="https://unsplash.com/@scottwebb?utm_source=medium&amp;utm_medium=referral">Scott Webb</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>My friend works at a company where they were still using email for their day to day communication, and where suffering from huge communication gaps. (Emails getting missed, important messages getting lost in the thread, no transparency). I suggested them to try out the free version of Slack, and they are instantly hooked. They will soon be moving to a paid version as now all their communcation channels — the off topic groups on whatsapp, customer service messages from intercom, clients, are now connected to Slack. If companies are still using emails for internal communication, they are stuck in the stone age.</p><p>In my current company, we are using an Indian copycat of Slack. (I am not going to share the name, because no matter how bad it is, it is made in India, and I have immense respect for the people who built it).I have been using slack since my college days, where I built a bot for my project, and then in the next two companies I worked for. I can’t even tell you how much I hate the current product, and we have a dedicated channel for abusing the current platform with 100+ people who have used Slack before.</p><h4>What Makes Slack so great?</h4><p>Slack’s attention to detail and understanding of its users. The user flows are so extremely well defined. Let me give some examples</p><p>I want to share a spotify song with my fellow workers, here is what happens -</p><p><strong>Slack</strong></p><p>I can play the song inside slack itself. No need to open the link, go to spotify and play it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5K8OSVia3FE-ge-2nX1Grg.png" /></figure><p><strong>Current Platform</strong></p><p>I need to leave the platform and play the song. Annoying.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SJF4gia4oOMj5VStqhYywQ.png" /></figure><p><strong>Code Sharing</strong></p><p><strong>Slack</strong></p><p>All you need to do is press ``` and it gets converted to a code block.</p><p><strong>Current Platform</strong></p><p>It is a three step process. Choose chat tools -&gt; code snippet -&gt; paste -&gt; confirm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kP_2M5mpMQul1nV6JmtkHA.png" /></figure><p>These are two flows I use on an everyday basis. Tell me why I wouldn’t miss slack?</p><h3>Search Capability</h3><p>Let’s see the search capability difference -</p><p><strong>Slack -</strong></p><p>Slack creates a User’s work graph- someone you interact with more, you have a higher affinity, and that’s how they define a message’s priority score in a search.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wv1NSYLw3vvMqGoEjSevGQ.png" /></figure><p>And this is how it looks in my current platform -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*wxxqEJyeVJNsDnk8bjT0Jg.png" /></figure><p>It doesn’t even searches for files! And you cannot even search for messages from multiple people. Extremely limited.</p><p><em>Read about Search at Slack </em><a href="https://slack.engineering/search-at-slack/"><em>here</em></a><em>.</em></p><h4>Slack is Hip</h4><p>My current platform feels really really enterprise with the fonts and the UI/UX. Slack, on the other hand, give a unique feeling of being in a startup kind of environment, even when you are working at a big company. I am not sure about how many people actually feel this way though :)</p><p>All in all, my current platform get the job done, but I miss using Slack everyday.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=679aaf6f6334" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Computer Vision for Everyone]]></title>
            <link>https://aashay96.medium.com/computer-vision-for-everyone-283fc5884782?source=rss-31b32f46b65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/283fc5884782</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Aashay Sachdeva]]></dc:creator>
            <pubDate>Sat, 23 May 2020 15:50:43 GMT</pubDate>
            <atom:updated>2020-05-23T15:50:43.798Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g-8O1Hb-LUhc61npaVwGiw.jpeg" /></figure><h3>1) The innovation</h3><p>Empower Data Analyst/Software Engineer/Data Scientists to build state of the art computer vision solutions</p><h3>2) Why do it? (The real pain)</h3><p>Current deep learning methods require a huge amount of data and compute. Most Companies can benefit from having some kind of in-house CV related algorithms. Yet the expertise and money required to build a production-grade solution is too high for most companies. Even for an experienced Data Scientist, a quick prototype (considering data is available) can take 3–4 days. Most people also do not care about the algorithm used, they only care about the end results. APIs available are also too generic and/or are not optimized for the use-case.</p><h3>3) Who will use it? How do they benefit after using your product?</h3><p>Anyone with a computer will be able to build a computer vision solution. Only at Data collection process, they will be required to interact with the software. All the technical parts of Data Augmentation, Training, API building will be taken care of. It will help create a new breed of Data Analysts/software engineers which can also build cv solutions.</p><h3>4) How to do it?</h3><p>An Electron app/ Web-based tool. The software will benefit from being able to utilise more resources from the computer.</p><p>The kind of CV applications is broadly divided into these categories — Classification, segmentation, Saliency, Object Detection.</p><p>if data is present -</p><p>Use gsutil multithreaded uploading to our data server after converting into tfrecord( A serialized file for the dataset)- most people who will do it for the first time will likely make the mistake of using rsync or ftp without correct serialisation- too slow.</p><p>if data is already in the cloud — sync with it</p><p>Choose one of the categories.</p><p>choose the best algorithm(handled by the backend — mostly pretrained to reduce training time, preprocessing of images, data augmentation will be hidden from the user)</p><p>Use Kubeflow to reduce training time — distributed training using Kubernetes.</p><p>Present an API endpoint</p><p>if No data present -</p><p>Provide an interface to search for data regarding specific problems</p><p>integration with data labeling APIs like <a href="http://scale.ai">scale.ai</a> etc to get data labeled</p><p>proceed in the normal flow</p><h3>5) Who will kick your ass?</h3><p>Tensorflow API</p><p>Google cloud platform autoML framework + Vision API</p><p>Clarifai</p><p>AWS ML</p><p><a href="https://labelbox.com/">https://labelbox.com/</a></p><h3>6) What is so great about this?</h3><p>Tensorflow API, Google cloud platform autoML framework + Vision API, AWS all have a huge learning curve. This works for experienced software engineers/Data Scientists. But not for everyone. They are amazing if you want to create something totally new — a new algorithm, massive datasets(50 TB +). Most companies don’t need this.</p><p>Labelbox looks really close to what I am thinking. Though it only focuses on the data part.</p><p>The platform I am thinking is an intuitive, easy to use, get to production in record time with almost zero knowledge or experience in computer vision.</p><p>If aren’t aware of how hard it is at a large scale, watch this talk by <a href="https://medium.com/@karpathy">Andrej Karpathy</a> on building Computer Vision algorithms at Tesla —</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FIHH47nZ7FZU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DIHH47nZ7FZU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FIHH47nZ7FZU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8716c64b0556cd880b9b615c236dce5e/href">https://medium.com/media/8716c64b0556cd880b9b615c236dce5e/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=283fc5884782" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 10x designer — Smart Automation with Kubric]]></title>
            <link>https://medium.datadriveninvestor.com/the-10x-designer-smart-automation-with-kubric-295b7de20314?source=rss-31b32f46b65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/295b7de20314</guid>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Aashay Sachdeva]]></dc:creator>
            <pubDate>Mon, 18 May 2020 05:39:26 GMT</pubDate>
            <atom:updated>2020-05-22T15:43:47.442Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<h3>The 10x designer — Smart Automation with Kubric</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qE-oE5YUnZ-05ls_.jpg" /></figure><p>The top metric at Kubric for the Data Science team is — “How do we reduce the amount of time spent by a designer on doing grunt work?”. We want to eliminate the grunt work that goes into micro-editing and quality checks so that designers can work on the stuff that truly matters to them — designing good content. Around this, we have created a set of micro-tools to help designers really get rid of that grunt work.And this is today powering thousands of creatives across different customer verticals from food to fashion and more. In this blog, I will talk about one such feature — Auto Position.</p><p><strong>Outlining the Problem</strong></p><p>At Kubric, we help content teams scale up their output. Last year when we were analysing our content production workflow, we found some of the content being produced through Kubric being initialised like this (note the headless model) -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_lLp5cntACMgKE99.png" /></figure><p>The user had to spend considerable time in center aligning on the focus object, and then finding the correct scale for the image. Around that time, twitter introduced their <a href="https://blog.twitter.com/engineering/en_us/topics/infrastructure/2018/Smart-Auto-Cropping-of-Images.html">Smart Crop</a>, and the problem they solved was very similar to ours. Taking inspiration from the blog, we were able to quickly implement a similar solution to this. The images started looking something like this now -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*hoOWO7JKbq33DZPx.png" /></figure><p>After releasing an initial version, we received feedback that while it did provide them with a better initialisation for the creative, it only focused on a very small, most salient part of the image and provided us with a very coarse salient region. They wanted more control over the automation. They wanted to control -</p><ul><li>the border,</li><li>the ability to control which object to focus on and not the whole salient area</li><li>Specify the alignment of the object of interest</li></ul><p>The feedback helped us get a better understanding of the user needs and we came with an enhanced implementation.</p><p><strong>Salient Object Detection</strong> -</p><p>For the initial version, we used the<a href="https://github.com/imatge-upc/salgan"> SalGAN model</a>, but it only provided us with a very coarse saliency map, and we required a much more fine-grained saliency map. Thus, we decided to train our own model on open source saliency datasets ( <a href="https://mmcheng.net/msra10k/">msra</a>,<a href="http://saliencydetection.net/dut-omron/"> DUT-OMRON</a>). We used a<a href="https://arxiv.org/abs/1505.04597"> Unet</a> based encoder-decoder<a href="https://arxiv.org/abs/1801.04381"> mobilenetV2</a> structure, using the amazing<a href="https://github.com/qubvel/segmentation_models"> segmentation-model</a> library. We used focal loss for training as class imbalance is relevant in the context of saliency prediction, for which the ground truth saliency map mainly consists of null or close to zero, creating a similar phenomenon. The approach is similar to weighted binary cross-entropy, except that the weight is locally adjusted and based on a tunable gamma power of the predicted saliency. We tracked pixel error as the metric, which is a standard metric for saliency models. This is how the results differ between SalGAN and our model -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*pViPrnKQ1FbdGdfh.png" /></figure><p>The new model was also way faster<strong> — we brought down the prediction time from an average 1.5 seconds to 0.3 seconds on a single cpu instance.</strong></p><p>For object detection, most of the classes that we currently wanted to work on were present in this<a href="https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md#open-images-trained-models"> open source tensorflow model</a>. Hence, we decided to use this model.</p><p><a href="https://www.datadriveninvestor.com/2020/02/27/how-to-use-automation-to-get-more-out-of-your-data/">How to Use Automation to Get More Out of Your Data? | Data Driven Investor</a></p><h3>The Right Bounding Box</h3><p>Another issue we faced was having multiple salient areas/objects in the image, and we needed to make a decision on whether to combine, reject the multiple boxes. For this, we implemented the following algorithm -</p><ol><li>See how big the box is relative to the image. If it is less than a threshold, reject the box.</li><li>Take the biggest box, and create a distance matrix between this box and the other boxes.</li><li>reject boxes which are farther than a threshold and combine the remaining.</li></ol><p>This is how the results looked after doing this -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jAAPvQYaaAS_VYvR" /></figure><p><strong>Computing the scale and the position -</strong></p><p>After we have the coordinates of the largest bounding box,values from the auto-suggest request are used to -</p><ol><li>Resize the image maintaining the aspect ratio</li><li>Threshold the saliency map and get the cooordinates for the bounding box</li><li>Calculate the scale since we know the bounds where the object has to be and also the coordinates of the bounding box.</li><li>Calculate the shift required to move the current bounding box of the object to the center of the image. After calculation, the difference needs to be scaled.</li></ol><p><strong>Deployment</strong></p><p>The topic of ML deployments will get its own blog (subscribe to our blog to get notified when it’s out!) but for the sake of completeness, we’ll briefly cover how it works here.</p><p>Our ML models are deployed as independent microservices. The models are wrapped in a Flask API with gunicorn running as the pre-fork executor. We support both sync (the caller waits for inference synchronously and keeps the HTTP connection open) and async deployments (the caller sends a message requesting inference and the model API raises an event notifying the caller once inference is done). Synchronous/blocking APIs are essential for user-facing parts of the app such as the auto-position feature we are talking about here. On the other hand for things like asset enrichment, a pubsub kind of asynchronous deployment makes a lot more sense.</p><p>We dockerize this API and the docker image is deployed via our CI system as a microservice to our Kubernetes cluster. This Kubernetes cluster gets us a bunch of things for free such as CPU utilization based autoscaling, rolling deployments, A/B deployments etc. In our opinion, a container orchestration tool such as Kubernetes is a <em>very</em> essential part of any production machine learning workloads. This of-course requires that you have a DevOps team maintaining your infrastructure.</p><p><strong>Auto position in action</strong></p><p>The request to enable this feature for a storyboard is pretty straightforward, and is directly embedded into our editor.</p><p>This is how a request looks like -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y-XkWLylihP3pjKT.png" /></figure><p>Where -</p><p><strong>Canvas — </strong>Coordinates of the Area in which the the hero-img is <strong>contained </strong>in shot using <strong>contain:True</strong> parameter. X,Y are the coordinates of the top-left point of the box and w is the width of the box and h being height.</p><p><strong>Bounds — </strong>Coordinates of the area in which you want the main object to be.X,Y are the coordinates of the top-left point of the box and w is the width of the box and h being height.</p><p>To focus on a specific object, all you need to do is add the classes parameter to the above request. You can add multiple classes to focus on!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*54bVZ-Y5YzVvOjk2.png" /></figure><p>You can try out how autoposition will behave while creating the storyboard -</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7C5dYQIN1cc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7C5dYQIN1cc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7C5dYQIN1cc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f2dd8ca5e50ef89aa4eab50c4522b087/href">https://medium.com/media/f2dd8ca5e50ef89aa4eab50c4522b087/href</a></iframe><p><strong>Result</strong> -</p><p>Here is a video of what autoposition can do -</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJtVn9vCJlXo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJtVn9vCJlXo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJtVn9vCJlXo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c7bc88e64b42ace29d6964165867127/href">https://medium.com/media/0c7bc88e64b42ace29d6964165867127/href</a></iframe><p>While auto-positioning is still in its infancy being iterated upon, we are excited by the possibilities and how it can save hours of grunt editors. 😁</p><p>Head over to our <a href="https://docs.kubric.io/docs">docs</a> to learn about more such features.</p><p>For more of our interesting blogs, head to <a href="https://reads.kubric.io/">Synapse</a>.</p><p><em>We are hiring! Do write in to </em><a href="mailto:careers@kubric.io"><em>careers@kubric.io</em></a><em> if you are kicked about building the next generation of creative tech.</em></p><p><em>Originally published at </em><a href="https://reads.kubric.io/p/80339590-cadd-41af-81f9-f5d553b64529/"><em>https://reads.kubric.io</em></a><em> on May 18, 2020.</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2Fb2a0d6%3Fas_embed%3Dtrue&amp;dntp=1&amp;display_name=Upscribe&amp;url=https%3A%2F%2Fupscri.be%2Fb2a0d6%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href">https://medium.com/media/0707f5c806284d01a4a13c7b13a91ce3/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=295b7de20314" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/the-10x-designer-smart-automation-with-kubric-295b7de20314">The 10x designer — Smart Automation with Kubric</a> was originally published in <a href="https://medium.datadriveninvestor.com">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tensorflow Object Detection API Tutorial Part 1: Sharding the data]]></title>
            <link>https://aashay96.medium.com/tensorflow-object-detection-api-tutorial-part-1-sharding-the-data-783f2b15b3fd?source=rss-31b32f46b65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/783f2b15b3fd</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Aashay Sachdeva]]></dc:creator>
            <pubDate>Tue, 17 Sep 2019 19:34:06 GMT</pubDate>
            <atom:updated>2019-09-17T19:34:06.217Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oLqTXV32r1nXzsTgfQZsxw.png" /></figure><p><a href="https://github.com/tensorflow/models/tree/master/research/object_detection">Tensorflow object detection API</a> is a powerful tool for creating custom object detection/Segmentation mask model and deploying it, without getting too much into the model-building part. TF has an extensive list of models (check out <a href="https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md">model zoo</a>) which can be used for transfer learning. One of the best parts about using TF API is that the pipeline is extremely optimized, i.e, your resource is not underutilized. If you have ever used Keras generator and trained a model, you will find how underutilized your CPU and GPU some times are, as data reading might become a bottleneck to training.TF API abstracts the part of building the pipeline away.</p><p>To follow the tutorial, install TF API by following the instruction provided on this <a href="https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md">link</a>.</p><h3>TFRecords</h3><p>TFRecords is a serialized format used by TensorFlow for storing the data. While working with large datasets, using a binary file format for storing data has a significant impact on the performance of the import pipeline and as a consequence on the training time of the model. Binary data takes up less space on disk, takes less time to copy and can be read much more efficiently from disk.</p><p>To create TFRecords, create a dataframe with the following structure -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*F5ODgvLf_fdhRzckHHTu4g.png" /></figure><p>where path denotes the path for the image file, classes denote the class to which the image belongs to, and bb denotes the bounding box coordinates (x1,y1,x2,y2).</p><p>Once you have the dataframe ready, use the following code to create the tfrecords.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfa4b4fd0b38e4040e1b817554c641fd/href">https://medium.com/media/dfa4b4fd0b38e4040e1b817554c641fd/href</a></iframe><p>The bounding box needs to be normalized between 0 and 1. For doing that, divide x by image_shape[1] and y by image_shape[0] (Reason — Numpy image array shape).</p><p>We use tf.Gfile Module for creating the binary string for the image. I have found it to be the most optimized way of doing this.</p><p>If you look at the code for creating the tf.train.example, each value is passed as a list, since an image can have multiple bounding boxes. In such cases, just pass list of all values for the bounding box. Similarly, you can pass multiple labels, seg maps in one single example.</p><pre>&#39;image/object/bbox/xmin&#39;: tf.train.Feature(float_list = tf.train.FloatList(value = [xmins1,xmin2]))<br>&#39;image/label&#39;: tf.train.Feature(int64_list = tf.train.Int64List(value = [label1,label2]))</pre><p>Then, just initiate the class and pass the label map dictionary.</p><pre>labels = {&#39;upper&#39;: 1, &#39;lower&#39;: 2,&#39;full&#39;:3}<br>t = GenerateTFRecord(labels)<br>t.convert_image_folder(train, &#39;images_train.tfrecord&#39;)<br>t.convert_image_folder(validation, &#39;images_valid.tfrecord&#39;)<br>t.convert_image_folder(test, &#39;images_test.tfrecord&#39;)</pre><p>where train,validation and test are dataframes created for your trai,validation and test data respectively. Class label should always start from 1, since class 0 denotes ‘none of the above’.</p><p>Next, we will jump to training and exporting the model. Later, we will work on deploying the exported model using tensorflow serving.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=783f2b15b3fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Experimentation with Variational Dropout -Do Subnetworks exist inside a Neural Network?]]></title>
            <link>https://aashay96.medium.com/experimentation-with-variational-dropout-do-subnetworks-exist-inside-a-neural-network-e482cbbea7dd?source=rss-31b32f46b65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e482cbbea7dd</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Aashay Sachdeva]]></dc:creator>
            <pubDate>Tue, 28 May 2019 18:04:44 GMT</pubDate>
            <atom:updated>2019-05-28T18:04:44.747Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_8fQOrl8qYyHkr5vOQxxNA.png" /></figure><p>Variational Dropout was introduced by Yarin Gal as a mean to estimate uncertainties in prediction by neural networks. While this blog isn’t about variational dropout(Follow Yarin Gal’s Blog <a href="http://mlg.eng.cam.ac.uk/yarin/blog_3d801aa532c1ce.html">post</a> for that), it is about the results that I saw while playing around with Variational dropout.</p><p>If you are aware of how Variational Dropout works, it requires the dropout to be on during the testing phase also. There are two ways to do this in keras.</p><pre>def PermaDropout(rate):<br> return Lambda(lambda x: K.dropout(x, level=rate))</pre><p>or</p><pre>Dropout(0.5)(x, training=True)</pre><p>Using this, I quickly trained a 3-layer CNN network on MNIST.</p><pre>inp = Input(shape=input_shape)<br>x = Conv2D(filters=20, kernel_size=5, strides=1)(inp)<br>x = PermaDropout(0.5)(x)<br>x = MaxPool2D(pool_size=2, strides=2)(x)<br>x = Conv2D(filters=50, kernel_size=5, strides=1)(x)<br>x = PermaDropout(0.5)(x)<br>x = MaxPool2D(pool_size=2, strides=2)(x)<br>x = Flatten()(x)<br>x = Dense(500, activation=’relu’)(x)<br>x = Dropout(0.5)(x, training=True)<br>x = Dense(num_classes, activation=’softmax’)(x)<br>model = Model(inp, x)</pre><p>In 5 epochs I reached an accuracy of 98.5%. But here is the interesting part. What should be the expected behavior at test time since I am randomly dropping 50% of the weights at test time?</p><pre>Results : Test loss: 0.040498659613306516<br>Test accuracy: 0.9869</pre><p>Fascinating! Let’s see how the results actually change for a specific image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gLiZIznyhCkQfYPrVaTqsA.png" /></figure><p>As you can see, the probabilities for classes other than 7, changed a lot, but the result came out to always correct, even though during every iteration 50% of the weights got dropped out.</p><p>Let’s do some more experiments to see what happens. Now, the dropout for the last layer is set to 0.9. I chose this experiment since the deeper layers learn complex features as opposed to the initial layers which learn basic features like edges and lines. Dropping a lot of weights in the deeper layers at test time should surely affect the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uhDGDPr0vpWY4XRgEpjElA.png" /></figure><p>Nope! Still the same results.</p><p>Hmm. May be the number of neurons in the dense layer are too many. Let’s reduce them to 128 and keep the dropout 0.9.</p><p>And Yes! The network started failing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nhDyoIv8yGXAnvS_-gBprw.png" /></figure><p>Keep in mind this happened after we dropped 115 of 128 neurons randomly from the last layer. But even after doing this, the overall test results look like this -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*OsUzrg3gM2ovVtxD7Ej5tA.png" /></figure><p>This leads me to the questions -Do Subnetworks equally as good exist inside a neural network. Are the current neural network too big and can be trimmed down? Or is it just that the dataset is too simple for this experiment?</p><p>While the experiments were only conducted on MNIST, and nothing can be concluded from this, it might be directed into building more efficient neural networks by finding only the weights/layers that matter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e482cbbea7dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>