<?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 Jannik Klauke on Medium]]></title>
        <description><![CDATA[Stories by Jannik Klauke on Medium]]></description>
        <link>https://medium.com/@jannikklauke?source=rss-b030c84e8615------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QOwjDxRXnVqlRdoLg_ZauQ.png</url>
            <title>Stories by Jannik Klauke on Medium</title>
            <link>https://medium.com/@jannikklauke?source=rss-b030c84e8615------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 06:41:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jannikklauke/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[A maturity model for AI]]></title>
            <link>https://jannikklauke.medium.com/a-maturity-model-for-ai-4dd3b49f16de?source=rss-b030c84e8615------2</link>
            <guid isPermaLink="false">https://medium.com/p/4dd3b49f16de</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[maturity]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[strategy]]></category>
            <dc:creator><![CDATA[Jannik Klauke]]></dc:creator>
            <pubDate>Fri, 10 Sep 2021 10:22:55 GMT</pubDate>
            <atom:updated>2021-09-10T10:24:58.049Z</atom:updated>
            <content:encoded><![CDATA[<h4>Determining the position of your company in its AI journey</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0xPykOiikfph2JRS5skLVA.jpeg" /><figcaption>📸 — Statworx</figcaption></figure><p>As digitization is becoming the norm in most organizations, the next era of transformation, namely the integration of AI into the day-to-day business has arrived.</p><p>In a survey of more than 1800 executives in 2019, 30% have already implemented an AI strategy that aligns with their corporate goals. 63% of respondents reported revenue increases yielding from AI adoption.[1]</p><p>To achieve a successful AI adaptation, a first thing to do is to determine the current level of AI maturity in the company. Only if you know where you currently stand, and what is possible, you can derive what actions you have to take to go there, and which steps and phases to pass along the way. Thereby, questions are answered such as:</p><blockquote>· What is the position of the company in the application of intelligent technologies and AI capabilities?</blockquote><blockquote>· How will the application of AI be useful in the future? (short, medium and long term)</blockquote><blockquote>· Which products, services and internal processes are affected by AI?</blockquote><blockquote>· And most importantly, how do we need to start to determine the degree of maturity?</blockquote><p>To answer the last question, we have developed the following model to help determine the level of AI maturity in a company. It can also be applied on a more granular basis within the company such as on a departmental or divisional level. AI maturity is classified into five distinct maturity levels: aware, ad-hoc, opportunistic, integrated, or transformative. To achieve that, we have identified six dimensions that will help managers derive concrete measures to determine their AI maturity level before increasing it and successfully lead the AI front of tomorrow.</p><h3>Six maturity dimensions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*3JFKQC6dfDxMR2MkxOCvFQ.jpeg" /><figcaption>six dimensions of AI maturity — image by author</figcaption></figure><p><strong>Dimension 1: Data</strong></p><p>Data is the foundation for the successful application and scaling of AI technology in a company. Due to many common issues, such as overwhelming data accumulation, data quality and frequency of data input, data is the most significant operational challenge for many organizations instead of being considered as an important strategic asset. Access and quality of organizational data is required to realize the full potential of AI solutions. During AI maturity identification, a holistic view on the organizational data is essential.</p><p><strong>Dimension 2: Use Cases</strong></p><p>The ability to identify and develop potential value-adding use cases for artificial intelligence is crucial. In order to do that, it is important to be aware of the limitations and possibilities of AI and transfer that knowledge to practical business problems. Processes for identifying and prioritizing AI use cases based on feasibility and success criteria are important in the scaling phases when various departments are utilizing AI for their business problems.</p><p><strong>Dimension 3: Team and Skills</strong></p><p>A successful build-up of AI capabilities in a company is highly dependent on internal AI know-how and related skills. It is thus important to have the appropriate AI talents available before implementing AI. Building maturity in this dimension is vast and can range from meaningful job advertisements to suitable training concepts for upskilling internal employees.</p><p><strong>Dimension 4: Infrastructure</strong></p><p>IT infrastructure forms the technical foundation for the development of AI applications. AI experts need to have the right tools to develop their applications and the ability to make them accessible throughout the organization. Cloud technology adaptation is also becoming an important indicator in determining the level of AI maturity. AI projects can not only be deployed in the cloud, many large cloud providers also offer AI services that can be leveraged.</p><p><strong>Dimension 5: Governance</strong></p><p>Various factors play a role in the process of undergoing comprehensive governance in AI projects.</p><p>Risks involving AI must be identified and compliance to regulations as well as internal policies must be monitored in the solutions. After KPIs and metrics have been agreed upon, frequent reports should be made to ensure successful steering of AI initiatives. Other factors that are important in this context are AI ethics and explainability of AI.</p><p><strong>Dimension 6: Organization</strong></p><p>The benefits that AI teams generate depend often on how well they are integrated at the organizational level and if the organizational conditions are adapted to it. The adaptation of internal processes to an agile, AI-oriented approach and the change in the mindset of the culture also contributes to the initiative’s success.</p><h3><strong>Solution: AI Maturity</strong></h3><p>We at STATWORX GmbH have developed a model to capture the current status of AI maturity in a company or department. Based on practice experience and current research we defined five levels of AI maturity:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F0x7_saBkKmKIvYrYRnvZA.png" /><figcaption>five levels of AI maturity in a company — image by author</figcaption></figure><p><strong>Level 0: Awareness</strong></p><p>Companies in the state of awareness, have not implemented AI yet. The company is aware of the existence of AI and potentials might are known. Nonetheless, the touching points with AI go no further than that. Analysis is done manually without any intelligent tools and data storing methods at all.</p><p><strong>Level 1: Ad-hoc</strong></p><p>In this stage, AI adoption is inactive and not considered in the corporate strategy. Knowledge and AI awareness of AI technology are scarce, and data is mainly stored in fragmented systems. Planning and decision making are rarely data-based along with simple training initiatives. Many organizations are at this level or transitioning to the next level of AI maturity.</p><p><strong>Level 2: Opportunistic</strong></p><p>In the second state of the AI maturity model, companies have identified that AI is an important future topic and have taken the first steps to explore the potential of AI. A central platform for AI in the organization does not exist at this stage. Tools and know-how are only available at an operational level to a certain extent. A few stakeholders push for AI initiatives and in some cases, AI models have made it to near production stages at a departmental level.</p><p><strong>Level 3: Integration</strong></p><p>In this level, AI is applied in most areas of the company and has been integrated into existing products, services or processes. AI has become a standard technology within the organization and rules for governance of AI models are defined and followed. AI also serves as a basis for decision-making and is centrally managed.</p><p><strong>Level 4: Transformative</strong></p><p>In the last stage of AI maturity, AI is part of the business model and is firmly embedded into the organization and corporate strategy. At this stage, own products based on AI may be marketed and AI initiatives have been successfully implemented and interconnected within most divisions. AI competencies and training are widespread and have been systematically built up and cultivated. Data is given a high priority and is seen as both raw material and product. AI is also fully exploited in compliance to regulatory and ethical standards. Teams have central access to data and AI solutions are managed in the organization’s own AI platform.</p><h3><strong>Increasing AI Maturity</strong></h3><p>Once the organization’s AI maturity level has been identified, the next important question arises: How to increase the AI maturity? Take the following three steps and implement the outcome to boost your AI maturity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*2L-J3ThBf9agQFUVn90Dng.png" /><figcaption>increasing AI maturity — image by author</figcaption></figure><p><strong>Conclusion</strong></p><p>An AI strategy sets the stage for a systematic implementation of AI within the organization. All measures to increase the level of AI maturity are pointed towards the dimensions of the organization’s holistic AI strategy and have to be aligned with the general strategic direction of the organization to avoid conflict of interest. By formulating an AI strategy, the increase of the maturity level can be accelerated significantly.</p><p>You should use this model t determine your level of AI maturity both for the entire organization or individual departments. When increasing AI maturity level, steps should be taken to reduce AI weaknesses and concrete defined action steps should serve as an action plan.</p><h3>Next Steps</h3><p>I hope that this brief introduction to the fundamental dimensions of an AI strategy was helpful to you. Let me know your thoughts and ideas!</p><p><strong><em>If you want to learn more about the five levels of maturity and how to advance in your AI journey, you can find our whitepaper on the topic </em></strong><a href="https://www.statworx.com/en/data-science/whitepaper/a-maturity-model-for-ai/"><strong><em>here</em></strong></a><strong><em>.</em></strong></p><p>References:</p><p>[1]: <a href="https://www.mckinsey.com/featured-insights/artificial-intelligence/global-ai-survey-ai-proves-its-worth-but-few-scale-impact#">https://www.mckinsey.com/featured-insights/artificial-intelligence/global-ai-survey-ai-proves-its-worth-but-few-scale-impact#</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4dd3b49f16de" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Machine Learning API with Python and Flask]]></title>
            <link>https://jannikklauke.medium.com/how-to-build-a-machine-learning-api-with-python-and-flask-eb7488fab0f1?source=rss-b030c84e8615------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb7488fab0f1</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[mlops]]></category>
            <dc:creator><![CDATA[Jannik Klauke]]></dc:creator>
            <pubDate>Wed, 29 Jul 2020 13:17:06 GMT</pubDate>
            <atom:updated>2021-06-29T12:21:08.698Z</atom:updated>
            <content:encoded><![CDATA[<h3>Did you ever want to make your machine learning model available to other people, but didn’t know how? Or maybe you just heard about the term API, and want to know what’s behind it? Then this post is for you!</h3><p>Here at <a href="https://www.statworx.com/de/">STATWORX</a>, we use and write APIs daily. For this article, I wrote down how you can build your own API for a machine learning model that you create and the meaning of some of the most important concepts like REST. After reading this short article, you will know how to make requests to your API within a Python program. So have fun reading and learning!</p><h3>What is an API?</h3><p>API is short for Application Programming Interface. It allows users to interact with the underlying functionality of some written code by accessing the interface. There is a multitude of APIs, and chances are good that you already heard about the type of API, we are going to talk about in this blog post: The web API.</p><p>This specific type of API allows users to interact with functionality over the internet. In this example, we are building an API that will provide predictions through our trained machine learning model. In a real-world setting, this kind of API could be embedded in some type of application, where a user enters new data and receives a prediction in return. APIs are very flexible and easy to maintain, making them a handy tool in the daily work of a Data Scientist or Data Engineer.</p><p>An example of a publicly available machine learning API is <a href="https://timedoor.io/">Time Door</a>. It provides Time Series tools that you can integrate into your applications. APIs can also be used to <a href="https://www.statworx.com/ch/blog/making-of-a-free-api-for-covid-19-data/">make data available</a>, not only machine learning models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mjLeNQAzfVtqu05t.png" /></figure><h3>And what is REST?</h3><p>Representational State Transfer (or REST) is an approach that entails a specific style of communication through web services. When using some of the REST best practices to implement an API, we call that API a „REST API”. There are other approaches to web communication, too (such as the Simple Object Access Protocol: SOAP), but REST generally runs on less bandwidth, making it preferable to serve your machine learning models.</p><p>In a REST API, the four most important types of requests are:</p><p>For our little machine learning application, we will mostly focus on the POST method, since it is very versatile, and lots of clients can’t send GET methods.</p><p>It’s important to mention that APIs are stateless. This means that they don’t save the inputs you give during an API call, so they don’t preserve the state. That’s significant because it allows multiple users and applications to use the API at the same time, without one user request interfering with another.</p><h3>The Model</h3><p>For this How-To-article, I decided to serve a machine learning model trained on the famous iris dataset. If you don’t know the dataset, you can check it out <a href="https://www.kaggle.com/uciml/iris">here</a>. When making predictions, we will have four input parameters: sepal length, sepal width, petal length, and finally, petal width. Those will help to decide which type of iris flower the input is.</p><p>For this example I used the scikit-learn implementation of a simple KNN (K-nearest neighbor) algorithm to predict the type of iris:</p><pre># model.py<br>from sklearn import datasets<br>from sklearn.model_selection import train_test_split<br>from sklearn.neighbors import KNeighborsClassifier<br>from sklearn.metrics import accuracy_score<br>from sklearn.externals import joblib<br>import numpy as np</pre><pre>def train(X,y):</pre><pre># train test split<br>    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)</pre><pre>knn = KNeighborsClassifier(n_neighbors=1)</pre><pre># fit the model<br>    knn.fit(X_train, y_train)<br>    preds = knn.predict(X_test)<br>    acc = accuracy_score(y_test, preds)<br>    print(f&#39;Successfully trained model with an accuracy of {acc:.2f}&#39;)</pre><pre>return knn</pre><pre>if __name__ == &#39;__main__&#39;:</pre><pre>iris_data = datasets.load_iris()<br>    X = iris_data[&#39;data&#39;]<br>    y = iris_data[&#39;target&#39;]</pre><pre>labels = {0 : &#39;iris-setosa&#39;,<br>              1 : &#39;iris-versicolor&#39;,<br>              2 : &#39;iris-virginica&#39;}</pre><pre># rename integer labels to actual flower names<br>    y = np.vectorize(labels.__getitem__)(y)</pre><pre>mdl = train(X,y)</pre><pre># serialize model<br>    joblib.dump(mdl, &#39;iris.mdl&#39;)</pre><p>As you can see, I trained the model with 70% of the data and then validated with 30% out of sample test data. After the model training has taken place, I serialize the model with the <em>joblib</em> library. Joblib is basically an alternative to pickle, which preserves the persistence of <em>scikit</em> estimators, which include a large number of <em>numpy</em> arrays (such as the KNN model, which contains all the training data). After the file is saved as a <em>joblib</em> file (the file ending thereby is not important by the way, so don’t be confused that some people call it .model or .joblib), it can be loaded again later in our application.</p><h3>The API with Python and Flask</h3><p>To build an API from our trained model, we will be using the popular web development package <em>Flask</em> and <em>Flask-RESTful</em>. Further, we import joblib to load our model and numpy to handle the input and output data.</p><p>In a new script, namely app.py, we can now set up an instance of a <em>Flask</em> app and an API and load the trained model (this requires saving the model in the same directory as the script):</p><pre>from flask import Flask<br>from flask_restful import Api, Resource, reqparse<br>from sklearn.externals import joblib<br>import numpy as np</pre><pre>APP = Flask(__name__)<br>API = Api(APP)</pre><pre>IRIS_MODEL = joblib.load(&#39;iris.mdl&#39;)</pre><p>The second step now is to create a class, which is responsible for our prediction. This class will be a child class of the <em>Flask-RESTful</em> class Resource. This lets our class inherit the respective class methods and allows <em>Flask</em> to do the work behind your API without needing to implement everything.</p><p>In this class, we can also define the methods (REST requests) that we talked about before. So now we implement a Predict class with a .post() method we talked about earlier.</p><p>The post method allows the user to send a body along with the default API parameters. Usually, we want the body to be in JSON format. Since this body is not delivered directly in the URL, but as a text, we have to parse this text and fetch the arguments. The flask _restful package offers the RequestParser class for that. We simply add all the arguments we expect to find in the JSON input with the .add_argument() method and parse them into a dictionary. We then convert it into an array and return the prediction of our model as JSON.</p><pre>class Predict(Resource):</pre><pre><a href="http://twitter.com/staticmethod">@staticmethod</a><br>    def post():<br>        parser = reqparse.RequestParser()<br>        parser.add_argument(&#39;petal_length&#39;)<br>        parser.add_argument(&#39;petal_width&#39;)<br>        parser.add_argument(&#39;sepal_length&#39;)<br>        parser.add_argument(&#39;sepal_width&#39;)</pre><pre>args = parser.parse_args()  # creates dict</pre><pre>X_new = np.fromiter(args.values(), dtype=float)  # convert input to array</pre><pre>out = {&#39;Prediction&#39;: IRIS_MODEL.predict([X_new])[0]}</pre><pre>return out, 200</pre><p>You might be wondering what the 200 is that we are returning at the end: For APIs, some HTTP status codes are displayed when sending requests. You all might be familiar with the famous 404 - page not found code. 200 just means that the request has been received successfully. You basically let the user know that everything went according to plan.</p><p>In the end, you just have to add the Predict class as a resource to the API, and write the main function:</p><pre>API.add_resource(Predict, &#39;/predict&#39;)</pre><pre>if __name__ == &#39;__main__&#39;:<br>    APP.run(debug=True, port=&#39;1080&#39;)</pre><p>The &#39;/predict&#39; you see in the .add_resource() call, is the so-called API endpoint. Through this endpoint, users of your API will be able to access and send (in this case) POST requests. If you don&#39;t define a port, port 5000 will be the default.</p><p>You can see the whole code for the app again here:</p><pre># app.py<br>from flask import Flask<br>from flask_restful import Api, Resource, reqparse<br>from sklearn.externals import joblib<br>import numpy as np</pre><pre>APP = Flask(__name__)<br>API = Api(APP)</pre><pre>IRIS_MODEL = joblib.load(&#39;iris.mdl&#39;)</pre><pre>class Predict(Resource):</pre><pre><a href="http://twitter.com/staticmethod">@staticmethod</a><br>    def post():<br>        parser = reqparse.RequestParser()<br>        parser.add_argument(&#39;petal_length&#39;)<br>        parser.add_argument(&#39;petal_width&#39;)<br>        parser.add_argument(&#39;sepal_length&#39;)<br>        parser.add_argument(&#39;sepal_width&#39;)</pre><pre>args = parser.parse_args()  # creates dict</pre><pre>X_new = np.fromiter(args.values(), dtype=float)  # convert input to array</pre><pre>out = {&#39;Prediction&#39;: IRIS_MODEL.predict([X_new])[0]}</pre><pre>return out, 200</pre><pre>API.add_resource(Predict, &#39;/predict&#39;)</pre><pre>if __name__ == &#39;__main__&#39;:<br>    APP.run(debug=True, port=&#39;1080&#39;)</pre><h3>Run the API</h3><p>Now it’s time to run and test our API!</p><p>To run the app, simply open a terminal in the same directory as your app.py script and run this command.</p><pre>python run app.py</pre><p>You should now get a notification, that the API runs on your localhost in the port you defined. There are several ways of accessing the API once it is deployed. For debugging and testing purposes, I usually use tools like . We can also access the API from within a Python application, just like another user might want to do to use your model in their code.</p><p>We use the module, by first defining the URL to access and the body to send along with our HTTP request:</p><pre>import requests</pre><pre>url = &#39;<a href="http://127.0.0.1:1080/predict&#39;">http://127.0.0.1:1080/predict&#39;</a>  # localhost and the defined port + endpoint<br>body = {<br>    &quot;petal_length&quot;: 2,<br>    &quot;sepal_length&quot;: 2,<br>    &quot;petal_width&quot;: 0.5,<br>    &quot;sepal_width&quot;: 3<br>}<br>response = requests.post(url, data=body)<br>response.json()</pre><p>The output should look something like this:</p><pre>Out[1]: {&#39;Prediction&#39;: &#39;iris-versicolor&#39;}</pre><p>That’s how easy it is to include an API call in your Python code! Please note that this API is just running on your localhost. You would have to deploy the API to a live server (e.g., on AWS) for others to access it.</p><h3><strong>Final Remarks</strong></h3><p>In this blog article, you got a brief overview of how to build a REST API to serve your machine learning model with a web interface. Further, you now understand how to integrate simple API requests into your Python code. For the next step, maybe try <a href="https://www.statworx.com/de/blog/two-patterns-to-secure-rest-apis/">securing your APIs</a>? If you are interested in learning how to build an API with R, you should check out <a href="https://www.statworx.com/ch/blog/how-to-create-rest-apis-with-r-plumber/">this post</a>. I hope that this gave you a solid introduction to the concept and that you will be building your own APIs immediately. Happy coding!</p><p><em>Originally published at </em><a href="https://www.statworx.com/de/blog/how-to-build-a-machine-learning-api-with-python-and-flask/"><em>https://www.statworx.com</em></a><em> on July 29, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb7488fab0f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>