<?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 Richard Cann on Medium]]></title>
        <description><![CDATA[Stories by Richard Cann on Medium]]></description>
        <link>https://medium.com/@rich.cann21?source=rss-9695ea1ee044------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OFMIRB_HKSMohqyxPs0R7A.png</url>
            <title>Stories by Richard Cann on Medium</title>
            <link>https://medium.com/@rich.cann21?source=rss-9695ea1ee044------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 14:09:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rich.cann21/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[Tales From The Feature Store Summit: Evaluation Stores]]></title>
            <link>https://towardsdev.com/tales-from-the-feature-store-summit-evaluation-stores-e69266c817b9?source=rss-9695ea1ee044------2</link>
            <guid isPermaLink="false">https://medium.com/p/e69266c817b9</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[feature-store]]></category>
            <dc:creator><![CDATA[Richard Cann]]></dc:creator>
            <pubDate>Mon, 24 Jan 2022 18:17:30 GMT</pubDate>
            <atom:updated>2022-01-27T06:03:12.512Z</atom:updated>
            <content:encoded><![CDATA[<h4>Seems to be that everything in MLOps is becoming a store and Evaluation Stores featured in the Future of Feature Stores segment of the summit.</h4><p><em>After attending </em><a href="https://www.featurestoresummit.com/"><em>The Feature Store Summit 2021</em></a><em>, I am putting together some of the insights I gathered and providing some analysis on practicality.</em></p><h3>What is a Feature Store again?</h3><p>Before we deep dive into the concept of an Evaluation Store, let us rewind and think about feature stores in general and how they would connect into an evaluation store.</p><p>What a feature store is as a <strong>minimum</strong>:</p><ul><li>Central repository for offline and online feature definitions across teams and organisation</li><li>A way to serve historical features</li><li>A low latency way to serve online features</li></ul><p>What a feature store is/has <strong>not</strong>:</p><ul><li>A data warehouse; should be the source of your feature store not a dump of all data</li><li>A training/serving pipeline; it simply aids these components by allowing an easy and central way to get the features needed</li><li>Model serving and model version tracker</li><li>Model deployment and retraining capabilities</li></ul><p>Although not included in the minimum, by nature of having all features in one place, feature monitoring can also be included as part of this system. Feature monitoring will help with <em>data drift</em> and enable different <em>decisions</em>. This is where the concept of an Evaluation Store comes into play.</p><h3>Ok now what is an Eval Store?</h3><p>The idea of the Evaluation Store, presented by <a href="https://gantry.io/">Gantry</a>, comes from the need to make decisions based on the impact that changing data has on our ML models.</p><p>One of the basic needs in an ML ecosystem is keeping track of metrics. From the experimentation phases all the way to production many metrics are in play to know whether a model should be deployed and once deployed, the performance of that model on live data. This is the first use case of the Evaluation Store, having a central place for the metrics for each of your models and their versions to live.</p><p>This idea is not unique to an Evaluation Store, as it could be solved with tools like <a href="https://mlflow.org/">MLFlow</a> or <a href="https://wandb.ai/site">Weights and Biases</a>, but then as the ML ecosystem evolves there is a need to start putting actions to those metrics. Automation is the name of the game, and the more manual tasks in the ML lifecycle you can replace the more efficient the ecosystem will be.</p><figure><img alt="Evaluation Store in ML Ecosystem" src="https://cdn-images-1.medium.com/max/660/1*hxCsnQACdPBUnK2FX-0Geg.png" /></figure><p>A system like an Evaluation Store will help with deciding when a model should be retrained. Depending on your use case, this could be based on live metrics i.e. F1, precision, or it could be based on data drift monitoring of features. This is where the Evaluation Store ties into a feature store, since the feature store can have the ability to compute data drift it can store those values in the Evaluation Store whose job is then to monitor these values and <strong>decide</strong> when to take actions such as alerting, trigger retraining or deployment.</p><h3>How would it work IRL?</h3><figure><img alt="Evaluation Store Components" src="https://cdn-images-1.medium.com/max/828/1*QmQ1bCJ9qyjBgGJ3WElLtg.png" /></figure><p>In real life, what could be a possible setup for an Evaluation Store. We would need a process that listens to various updates, the Updater. This service would listen or consumer model metrics and training metrics as they come and store them in a DB. This central place can then be used to serve these type of metrics to anyone.</p><p>The second processes would revolve around using those metrics and adding some rules per model to then action them. So if we get new prediction metrics we can take those from our DB, enrich that with stats from features in the Feature Store and decide whether to trigger a new training job.</p><p><strong>Things To Note:</strong></p><ul><li>DB would not need live within this system, can be a combination of model store or logs from the model training and inference jobs</li><li>Need a way to serve metrics easily</li><li>Observability around actions made, especially if they are critical like swapping models in production</li></ul><h3>Final Notes</h3><p>An Evaluation Store is an interesting idea, but one that should be adopted in a mature ML ecosystem. Most of the challenges can be solved with simple batch metrics jobs or aggregating logs from training and inference.</p><p>When only having a couple models, it is not imperative that we need to automate actions such as retraining and redeployment. This can start as scheduled jobs by Airflow for example or even just manually. As the ecosystem grows and there are more models to take care of, the idea of Evaluation Store can then come into play and give advantages.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e69266c817b9" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/tales-from-the-feature-store-summit-evaluation-stores-e69266c817b9">Tales From The Feature Store Summit: Evaluation Stores</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integration testing AWS + Spark jobs using Localstack + Docker]]></title>
            <link>https://towardsdev.com/integration-testing-aws-spark-jobs-using-localstack-docker-7f5ec1389d10?source=rss-9695ea1ee044------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f5ec1389d10</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[localstack]]></category>
            <category><![CDATA[spark]]></category>
            <dc:creator><![CDATA[Richard Cann]]></dc:creator>
            <pubDate>Wed, 05 Jan 2022 19:11:32 GMT</pubDate>
            <atom:updated>2022-01-07T09:00:41.341Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wAAr2s4h7dFY8e9ovhhu1Q.png" /></figure><p>Having the right amount of confidence in your spark jobs running can sometimes be hard when they are running in a cluster set by a cloud provider (<a href="https://cloud.google.com/dataproc">Dataproc</a>, <a href="https://aws.amazon.com/emr/">EMR</a>, <a href="https://azure.microsoft.com/en-gb/services/hdinsight/">Azure HDInsight</a>, etc). One of the more common uses for Spark jobs is to just read some files from a bucket, turn them into dataframes, perform some transformations and then upload the results to an output bucket.</p><blockquote>“Unit tests will only take you so far…” — Any sane developer</blockquote><p>They are absolutely needed to know that the transformations are correct and force you to split up your work into highly cohesive units. Integration tests give you an extra layer of confidence that your whole script will run, but what about when talking to a cloud provider like AWS? That is a more tricky thing to test locally and would have to constantly deploy to your dev environment or set up a remote bucket just for testing. Both could be valid approaches based on your use case, but what I have seen helps to solve this problem whilst still keeping a good developer experience and fast setup is <a href="https://localstack.cloud/">Localstack</a>.</p><p>Localstack will mimic an AWS S3 setup locally. I have setup an example where we can add a mock file into a local S3 bucket, perform some operation and then write an output parquet file. All without having to interact with a remote bucket.</p><p>Oh, one point I missed was around Spark setup locally with Localhost, it is not the most straight forward but once this is set in a docker-compose type of flow, then it is easy to replicate in your EMR cluster setup for example.</p><p>First we need to setup the Localstack docker-compose file</p><pre>version: &quot;3&quot;<br><br>services:<br>  aws-docker:<br>    container_name: my-tests.aws-docker<br>    image: localstack/localstack<br>    ports:<br>      - &#39;4560-4600:4560-4600&#39;<br>      - &#39;8055:8080&#39;<br>    environment:<br>      - SERVICES=cloudwatch,logs,s3<br>      - DEBUG=1<br>      - DOCKER_HOST=unix:///var/run/docker.sock<br>      - HOSTNAME=localhost<br>      - HOSTNAME_EXTERNAL=localhost<br>    volumes:<br>      - &quot;/var/run/docker.sock:/var/run/docker.sock&quot;</pre><p>Thing to note is the <em>container_name</em> and <em>ports</em> attached which will be how this service is discovered in our docker network.</p><p>Then comes the Dockerfile setup for our application. Note the Spark and Hadoop versions as well as the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY that just need to be present for access to work.</p><pre>FROM frolvlad/alpine-java:jdk8-slim<br><br>RUN apk --update add wget tar bash<br><br>RUN wget https://archive.apache.org/dist/spark/spark-2.4.4/spark-2.4.4-bin-without-hadoop.tgz<br>RUN wget https://archive.apache.org/dist/hadoop/common/hadoop-2.8.5/hadoop-2.8.5.tar.gz<br><br>RUN tar -xzf spark-2.4.4-bin-without-hadoop.tgz &amp;&amp; mv spark-2.4.4-bin-without-hadoop /usr/local &amp;&amp; rm spark-2.4.4-bin-without-hadoop.tgz<br>RUN tar -xzf hadoop-2.8.5.tar.gz &amp;&amp; mv hadoop-2.8.5 /usr/local<br><br>RUN cd /usr/local &amp;&amp; ln -s spark-2.4.4-bin-without-hadoop spark &amp;&amp; ln -s hadoop-2.8.5 hadoop<br><br>ENV <em>SPARK_HOME </em>&quot;/usr/local/spark&quot;<br>ENV <em>HADOOP_HOME </em>&quot;/usr/local/hadoop/bin&quot;<br>ENV <em>PYTHONPATH </em>&quot;$<em>SPARK_HOME</em>/python:$<em>SPARK_HOME</em>/python/lib/py4j-0.10.7-src.zip:$<em>SPARK_HOME</em>/python/lib/pyspark.zip&quot;<br>ENV <em>PYSPARK_PYTHON </em>&quot;python3&quot;<br><br>ENV <em>PATH </em>$<em>PATH</em>:$<em>SPARK_HOME</em>/bin<br><br>RUN apk add --update make python3<br>RUN pip3 install awscli<br>COPY spark/conf /usr/local/spark/conf/<br><br>ENV <em>AWS_ACCESS_KEY_ID </em>FAKE<br>ENV <em>AWS_SECRET_ACCESS_KEY </em>FAKE<br><br>RUN mkdir -p /opt/search-ml<br><br>COPY . /opt/search-ml<br>WORKDIR /opt/search-ml</pre><p>Last thing to note here is that I am copying over a spark/conf folder with some default spark configs, which can be found <a href="https://github.com/richardcann/spark-integration-localstack/tree/master/spark/conf">here</a>.</p><p>After this is all setup and running if we try to test the following</p><pre>def read_df(spark_session: SparkSession, path: str) -&gt; Dataframe:<br>    return spark_session.read.json(path)<br><br><br>def transform(df: Dataframe) -&gt; Dataframe:<br>    return df<br><br><br>def upload_df(df: Dataframe, output_path: str)-&gt; None:<br>    df.write.parquet(output_path)<br><br><br>def run(args: List[str], spark: SparkSession) -&gt; None:<br>    input_s3_path = args[0]<br>    output_s3_path = args[1]<br><br>    input_df = read_df(spark, input_s3_path)<br>    transformed_df = transform(input_df)<br>    upload_df(transformed_df, output_s3_path)</pre><p>Where our <strong><em>run</em></strong> function is composed of a <strong><em>download</em></strong>, <strong><em>transform</em></strong> and <strong><em>uploader</em></strong> functions. The test will look something like this</p><pre>S3 = &#39;http://aws-docker:4572&#39;<br><br>class UploaderIntegrationTest(TestCase):<br><br>    def setUp(self) -&gt; None:<br>        self.spark = SparkSession \<br>            .builder \<br>            .master(&#39;local&#39;) \<br>            .getOrCreate()<br><br>        # Setup aws buckets<br>        os.system(&#39;aws --endpoint-url={} s3 mb s3://my-test&#39;.format(S3))<br>        os.system(&#39;aws --endpoint-url={} s3 sync data s3://my-test/data&#39;.format(S3))<br>        os.system(&#39;aws --endpoint-url={} s3 ls s3://my-test/data/&#39;.format(S3))<br><br>    def test_upload_to_s3(self):<br>        run([&quot;s3://my-test/data&quot;, &quot;s3://my-test/result.parquet&quot;], self.spark)<br><br>        output_df = self.spark.read.parquet(&#39;s3://my-test/result.parquet/*&#39;)<br>        self.assertEqual(output_df.count(), 2)</pre><p>…and done! You have an integration test with both Spark and S3 without needing to mock any of the reading or uploading functions or using strategy patterns based on input/output paths.</p><p><em>For the full working solution please visit the </em><a href="https://github.com/richardcann/spark-integration-localstack"><em>github repo</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f5ec1389d10" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/integration-testing-aws-spark-jobs-using-localstack-docker-7f5ec1389d10">Integration testing AWS + Spark jobs using Localstack + Docker</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>