<?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 Eesha Shetty on Medium]]></title>
        <description><![CDATA[Stories by Eesha Shetty on Medium]]></description>
        <link>https://medium.com/@ee.shetty?source=rss-e98e7d8e9ae1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oWKbYvjKC4gVg_saXCeORA.jpeg</url>
            <title>Stories by Eesha Shetty on Medium</title>
            <link>https://medium.com/@ee.shetty?source=rss-e98e7d8e9ae1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 06:26:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ee.shetty/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[MLEM: A One Stop Shop for Productionizing your ML Models]]></title>
            <link>https://medium.com/@ee.shetty/mlem-a-one-stop-shop-for-productionizing-your-ml-models-90855c331405?source=rss-e98e7d8e9ae1------2</link>
            <guid isPermaLink="false">https://medium.com/p/90855c331405</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[mlops-tool]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[mlops-platform]]></category>
            <dc:creator><![CDATA[Eesha Shetty]]></dc:creator>
            <pubDate>Wed, 05 Apr 2023 04:00:10 GMT</pubDate>
            <atom:updated>2023-04-05T04:00:10.359Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UPGx81bCyX1ovd1VfdYyxg.png" /><figcaption>Google Image Search Results for MLEM, not really complaining (:</figcaption></figure><p><em>Despite from what this image might lead you to believe, MLEM isn’t about cats :/</em></p><p>MLEM is an open source tool by <a href="https://iterative.ai/blog/MLEM-release/">Iterative.ai</a>, to help you easily package, deploy and serve your Machine Learning models all in one place. What makes MLEM special to me is its “<a href="https://mlem.ai/doc/user-guide/basic-concepts/#model-codification">codification</a>” principle —while pickle/joblib simply serializes/deserializes model objects, MLEM also saves additional <strong><em>model metadata, </em></strong>which saves additional data about the model that could be useful to reload or utilize it. This model metadata is inferred automatically by MLEM, no matter how complex you architecture is. This metadata is saved as a human-readable YAML to make things more convenient for ML Teams.</p><p>Now let’s delve into more detail with a quick example!</p><h3>Getting Started with MLEM</h3><p>For this example, you need a trained ML model (could be any popular framework — TensorFlow, PyTorch, scikit-learn). I trained a simple Random Forest Regressor from scikit learn to predict movie ratings on the IMDb Dataset (<a href="https://github.com/eeshashetty/mlem-demo">code on GitHub</a>).</p><h4>Prerequisites</h4><p>For this tutorial, you would want to install the MLEM API.</p><pre>pip install mlem</pre><p>For deploying on FastAPI</p><pre>pip install fastapi uvicorn</pre><p>For Docker, you can follow setup instructions <a href="https://www.docker.com/get-started/">here</a>.</p><h4>Saving Models</h4><p>Once you have your model trained and ready, normally you would save the model to a pkl file using joblib.dump() or pickle.dump(). However, in this scenario we will be using MLEM API’s save function.</p><pre>from mlem.api import save<br><br>PATH = &quot;models/ratings_model&quot;<br>save(model, PATH, sample_data = df)</pre><p>model — the model you would want to save</p><p>PATH — filename to save the model as</p><p>sample_data — If the object is a model or function, you can provide input data sample, so MLEM will include it’s schema in the model’s metadata</p><p>Once you call the save function, your directory would look like this</p><pre>&gt; ls model/<br>ratings_model      ratings_model.mlem</pre><p>ratings_model is the binary file with the actual model</p><p>ratings_model.mlem is the metadata file with model details</p><h4>Looking into the metadata file</h4><pre>artifacts:<br>  data:<br>    hash: 30ab43b8da9cb06a931a1e10923adfa3<br>    size: 63822733<br>    uri: ratings_model<br>call_orders:<br>  predict:<br>  - - model<br>    - predict<br>object_type: model<br>processors:<br>  model:<br>    methods:<br>      predict:<br>        args:<br>        - name: X<br>          type_:<br>            columns:<br>            - isAdult<br>            - startYear<br>            - runtimeMinutes<br>            dtypes:<br>            - object<br>            - float64<br>            - float64<br>            index_cols: []<br>            type: dataframe<br>        name: predict<br>        returns:<br>          dtype: float64<br>          shape:<br>          - null<br>          type: ndarray<br>    type: sklearn<br>requirements:<br>- module: sklearn<br>  package_name: scikit-learn<br>  version: 1.1.2<br>- module: numpy<br>  version: 1.24.2<br>- module: pandas<br>  version: 1.5.3</pre><p>ratings_model.mlem is a YAML file containing metadata about the model. It contains useful information about the model, like -</p><ol><li>Functions calls for the model object</li><li>What arguments the functions take</li><li>If you provided sample_data, the columns/datatypes</li><li>All package requirements for this model</li></ol><p>This data is extremely useful while coordinating with other developers/within ML teams since it provides enough information about using the model without you having to go through the stress manually documenting instructions.</p><p>Note: You can also save pickle files as MLEM Models by simply loading them back in and saving it again</p><pre>m = joblib.load(&quot;model/rfm.pkl&quot;)<br>save(m, &quot;model/rfm2&quot;, sample_data = df)</pre><h3>Serving Models Locally</h3><p>This is my personal favorite part of MLEM, how easy it is to serve models! For this tutorial, I’ll be sticking to FastAPI, while you could also use Streamlit or RabbitMQ.</p><p>You just need to run the following command</p><pre>&gt; mlem serve fastapi --model ratings_model<br>⏳️ Loading model from ratings_model.mlem<br>Starting fastapi server...<br>🖇️  Adding route for /predict<br>Checkout openapi docs at &lt;http://0.0.0.0:8080/docs&gt;<br>INFO:     Started server process [54845]<br>INFO:     Waiting for application startup.<br>INFO:     Application startup complete.<br>INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)</pre><p>This sets up the server, which is now serving your model and listening on <a href="http://0.0.0.0:8080,">http://0.0.0.0:8080</a> , you can navigate to <a href="http://0.0.0.0:8080/docs">http://0.0.0.0:8080/docs</a> to navigate through the Swagger UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pn5-Xl2yHRj6TJyIMWol0A.png" /><figcaption><a href="http://0.0.0.0:8080/docs">http://0.0.0.0:8080/docs</a> — Providing information about routes to use</figcaption></figure><p>You can test calls on the Swagger UI for model prediction, in the image below I filled in the sample request body with a few dummy values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v1ihoCOH-LuhN50SZXc6uw.png" /><figcaption>You can test a call by typing in values in the request body</figcaption></figure><p>It not only generates curl calls for you to use, but also provides response code and details. As you can see, the model does successfully return a predicted rating given movie details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wl_7vrK0adPtYycr9-uVYg.png" /><figcaption>Response Values for an Example Call</figcaption></figure><p>As you can see, it’s pretty easy to serve models locally, providing you with the perfect API to be integrated into any web app which requires ML model predictions. This serves as the perfect solution for all of my course projects where it gets really difficult to deploy models and serve them without any extra effort or money.</p><h3>Deploying and Other Use Cases</h3><p>Similar to what we saw in the previous section, its pretty easy to deploy Models in production as well. MLEM works with Docker, Heroku and GitHub Actions for fast and reliable deployment, all with a simple single command!</p><p>It’s easy to version models with MLEM as well, one of it’s main features is a Git-Native Model registry, that works with other Iterative tools like DVC. This helps you to track deployment parameters and use it in CI/CD pipelines more easily.</p><p>MLEM also supports Kubernetes and SageMaker now!</p><h3>Final Thoughts</h3><p>Based off my limited experience with MLEM, I’ve really liked it so far! It makes the whole process of saving, serving and deploying models so much easier and convenient, without the hassle of using multiple tools. I would definitely be using this tool in my future projects, and I hope this article inspires you to do the same!</p><p>As for one of the downsides I faced personally, while MLEM Model Objects do support almost all major frameworks, I did face issues with smaller frameworks (in my case it was with scikit-surprise) — while they are slowly rolling out support for most frameworks I would recommend checking compatibility before deciding to use MLEM.</p><p>I hope that you enjoyed reading this article and learnt something new today! This article is part of an assignment for my <strong>ML in Production</strong> course at <strong>Carnegie Mellon University, </strong>under Profs Christian Kästner and Eunsuk Kang. This was definitely a great way to learn about the MLOps industry and the crazy amount of companies out there that do some amazing work!</p><h3>References</h3><ol><li>MLEM Docs — <a href="https://mlem.ai/doc/get-started/">https://mlem.ai/doc/get-started/</a></li><li><a href="https://iterative.ai/blog/MLEM-release/">https://iterative.ai/blog/MLEM-release/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90855c331405" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making Your Models Come To Life]]></title>
            <link>https://medium.com/acmvit/making-your-models-come-to-life-9b21ccb0e9b6?source=rss-e98e7d8e9ae1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b21ccb0e9b6</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Eesha Shetty]]></dc:creator>
            <pubDate>Sat, 28 Mar 2020 18:26:21 GMT</pubDate>
            <atom:updated>2020-03-28T18:26:21.534Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/746/0*n4995jIQeKCArmcV.jpg" /></figure><p>Building and training models is something every Machine Learning dev or data scientist is familiar with — be it the MNIST Handwritten Digits classifier we all have built, or even more complex networks. I’m sure you must have many pickle files (or .pt if you’re team PyTorch) all across GitHub or your own file storage, but have you ever tried to test them out on something more user-friendly, like a web app? If you haven’t, follow me for the next few paragraphs as I pull you out of your Jupyter notebooks and into the real world.</p><h3>Using a Python Backend</h3><p>If you have minimal experience with web development, the best option to deploy your models is in a language you’re most familiar with — Python!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*BraOGcDsjt5Lf-S5.jpg" /></figure><p>Using a Python-based framework for backend has a lot of benefits, especially when it comes to personalizing functions for input preprocessing and prediction. You can choose any of these two frameworks — <strong>Django</strong>, or <strong>Flask</strong>. Each provide different features, so select your framework on the basis of what you expect from your website.</p><h4>Flask</h4><blockquote>Flask is a lightweight <a href="https://wsgi.readthedocs.io/">WSGI</a> web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex applications.</blockquote><p>If your goal is to build a basic web interface for your model, Flask is your go-to. It does not enforce any dependencies or expect a certain layout, which makes it the easiest framework to create an API on. Learning how to use Flask is extremely easy, you can actually get creative and figure out how to build your own functions for prediction — <a href="https://towardsdatascience.com/productionize-a-machine-learning-model-with-flask-and-heroku-8201260503d2">or follow a tutorial.</a></p><h4>Django</h4><blockquote>Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.</blockquote><p>Like I mentioned before, Flask is perfect if you just want a basic API. But if you’re ready to get your hands dirty and develop a proper backend, I’d suggest you go for Django. It is a beautiful framework with amazing functionalities, which will help you make a fully functional website for your model.</p><p>Since Django also uses Python, learning it won’t be difficult. However, it is not as simple or customisable as Flask. I’d suggest you first learn how to <a href="https://docs.djangoproject.com/en/3.0/intro/tutorial01/">make a basic Django app</a>, then once you’re comfortable try making your own prediction function — <a href="https://towardsdatascience.com/productionize-a-machine-learning-model-with-a-django-api-c774cb47698c">or follow a tutorial.</a></p><h3>Machine Learning for Web Developers</h3><p>A major problem many face in their projects is “Incorporating AI”. If your team composes of an ML dev and a web dev, I bet they’ve spent 10% of their time on actually building a model and the rest 90% figuring out how to integrate it.(reminds me of how many hacks I messed up just because I didn’t know how to integrate my code!). Based on my personal experience, here are some ways you can learn how to finally get the best of both worlds.*</p><h4>The beautiful world of TensorFlow.js</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/0*BVzxzM8eWQhbxTXr.png" /></figure><p>TF.js is a common ground for experienced ML devs or a JavaScript dev with no ML knowledge.</p><p>TensorFlow.js lets you</p><ol><li><strong>Run existing models — </strong>For when you want to incorporate an official TJ.js model, or your Python dev makes you use the model they built themselves</li><li><strong>Retrain existing models — </strong>To avoid the hassle of building an entire architecture from scratch but also get the benefits of using your own data</li><li><strong>Develop ML with JavaScript — </strong>If you as a JS dev want to build and train your own model!</li></ol><p>The <a href="https://www.tensorflow.org/js">official TensorFlow website</a> is the best place to learn, they provide a bunch of helpful tutorials along with some fun demos to try out.</p><h4>A few other major companies that provide amazing APIs</h4><ol><li><a href="https://azure.microsoft.com/en-in/services/cognitive-services/">Microsoft Azure Cognitive Services</a></li><li><a href="https://aws.amazon.com/sagemaker/">AWS Sagemaker</a></li><li><a href="https://www.ibm.com/cloud/machine-learning">IBM Watson Machine Learning</a></li></ol><p>check out <strong>References</strong> for more!</p><p>*<em>come on, I can make ONE Hannah Montana reference!</em></p><h3>Bonus Tip!</h3><h4>Building Real-Time Programs via a Web Socket Server</h4><p>Getting back to Python. I’ve already talked about using Flask/Django as a backend framework and building custom prediction functions. However, basic functions will render useless in cases of real-time applications — like online games. Here, we enter the world of WebSockets.</p><blockquote>The WebSocket protocol, described in the specification <a href="http://tools.ietf.org/html/rfc6455">RFC 6455</a> provides a way to exchange data between browser and server via a persistent connection.</blockquote><blockquote>WebSocket is especially great for services that require continuous data exchange, e.g. online games, real-time trading systems and so on.</blockquote><p>By establishing a socket connection between the Python script and the frontend, we can effectively run a script to collect data and throw it to the frontend. A very popular example is a game called Skyfall, where the paddle is controlled by the hand. The hand detection is done on a Python script using the TensorFlow Object Detection API, and the (x,y) coordinates of the hand are sent to the frontend, where the paddle is moved accordingly. You can learn how to build this<a href="https://towardsdatascience.com/how-to-build-a-gesture-controlled-web-based-game-using-tensorflow-object-detection-api-587fb7e0f907"> here.</a></p><p>If you feel that the tutorial is too complicated, and want to learn the basic functionality — you can check out my GitHub repo where I created a <a href="https://github.com/eeshashetty/virtual-mouse">Virtual Mouse</a> using the same concept.</p><p>This article is meant to be an overview of the best ways to integrate ML with web. If you want to know more, or want me to write a tutorial, reach out to me through my <a href="http://linkedin.com/in/eeshashetty">LinkedIn</a>, and do check out my projects on GitHub!</p><p><a href="https://github.com/eeshashetty">eeshashetty - Overview</a></p><p>I hope you can translate these tips to make some amazing projects!</p><h3>Resources</h3><ol><li><a href="https://palletsprojects.com/p/flask/">https://palletsprojects.com/p/flask/</a></li><li><a href="https://www.djangoproject.com/">https://www.djangoproject.com/</a></li><li><a href="https://www.tensorflow.org/js">https://www.tensorflow.org/js</a></li><li><a href="https://towardsdatascience.com/productionize-a-machine-learning-model-with-flask-and-heroku-8201260503d2">https://towardsdatascience.com/productionize-a-machine-learning-model-with-flask-and-heroku-8201260503d2</a></li><li><a href="https://towardsdatascience.com/how-to-build-a-gesture-controlled-web-based-game-using-tensorflow-object-detection-api-587fb7e0f907">https://towardsdatascience.com/how-to-build-a-gesture-controlled-web-based-game-using-tensorflow-object-detection-api-587fb7e0f907</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b21ccb0e9b6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/acmvit/making-your-models-come-to-life-9b21ccb0e9b6">Making Your Models Come To Life</a> was originally published in <a href="https://medium.com/acmvit">ACM VIT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gotta train ’em all !]]></title>
            <link>https://medium.com/acmvit/gotta-train-em-all-b2cf67ebd753?source=rss-e98e7d8e9ae1------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2cf67ebd753</guid>
            <category><![CDATA[gridsearchcv]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[pokemon]]></category>
            <category><![CDATA[scikit-learn]]></category>
            <dc:creator><![CDATA[Eesha Shetty]]></dc:creator>
            <pubDate>Sun, 23 Jun 2019 13:42:46 GMT</pubDate>
            <atom:updated>2019-06-23T13:42:46.137Z</atom:updated>
            <content:encoded><![CDATA[<h3>Gotta train ’em all!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/0*44T8HLMARseI_B3x.png" /></figure><p>We’ve all been obsessed with Pokémon at some point in our childhood, and I know how difficult it is to remember every single Pokémon (around 800!). In the show, Ash didn’t have this problem because of the pokedex Professor Oak gave him. So why not build our very own, cool Pokedex?!</p><p>In this post, I will teach you how to build a program which identifies different types of Pokémon using a very simple Machine Learning algorithm from scikit learn.</p><h3>The Dataset</h3><p>The most essential part of any ML program is acquiring and preprocessing a dataset. For our pokedex, I am going to start off with building a dataset for 5 types of Pokémon :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/170/1*hnpVwAkQ7eIVL9GWwNOkeQ.png" /><figcaption>Pikachu — The very best!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*UDgR8bLScyJjDBfK.jpg" /><figcaption>Squirtle</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/216/0*4uVkuIoR8hwZmcbB.jpg" /><figcaption>Jigglypuff</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/0*67Xzsvh4zgL39-NM.png" /><figcaption>Gengar</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/218/0*j0ja_CLVLlhdj5NH.jpg" /><figcaption>Eevee</figcaption></figure><p>I successfully built a dataset of 20 images for each type. Now the next step is preprocessing the data. To avoid any complications, resize all the dataset pictures to the same dimensions (I changed them to 300x300). And then convert it to grayscale to make the process easier.</p><p>You can easily do this step using the <strong>PIL</strong> library, or even<strong> OpenCV.</strong></p><p>Finally, create the matrix of features ‘X’ — this would contain all the images in our dataset. Our dependent variable ‘y’ — would be the corresponding label.</p><h4>Don’t forget to encode your string variables!</h4><p>Our classification model might not accept string values, so we need to convert them to a significant label.</p><p>Here 0=Eevee, 1=Gengar, 2= Jigglypuff, 3=Pikachu, 4=Squirtle</p><pre><strong>from </strong>sklearn.preprocessing<strong> import </strong>LabelEncoder<br>labelencoder_y = LabelEncoder()<br>y = labelencoder_y.fit_transform(y)</pre><h3>Let’s finally build our model!</h3><p>We have a total of 100 pictures in our dataset, let us fit our model on 80 pictures, which would be our <strong>train set, </strong>and test our model on the rest, which would be our <strong>test set.</strong></p><pre><strong>from</strong> sklearn.model_selection <strong>import</strong> train_test_split<br>X_train, X_test, y_train, y_test = <br>train_test_split(X, y, test_size = 0.2, random_state = 0, shuffle = True)</pre><h4>Fitting the model</h4><p>Since our challenge is to identify the type of Pokémon, it is a classification problem, and we need to fit a classifier. You can try and fit any classifier you want, however, after some trial and error, I have come to the conclusion that <strong>SVC</strong> would yield the highest accuracy.</p><p>Support Vector Machines (SVMs) generally provide higher accuracy compared to other classifiers, like Logistic Regression. A Support Vector Classifier (SVC) tries to fit as many instances without violating margin conditions.</p><p>Hence we fit the SVC classifier with the help of<strong> GridSearchCV</strong> for hyperparameter tuning — it will help us determine optimal values for SVC.</p><pre><strong>from</strong> sklearn.model_selection <strong>import</strong> GridSearchCV<br><strong>from</strong> sklearn.svm <strong>import</strong> SVC<br>param_grid = {&#39;kernel&#39;: [&#39;rbf&#39;,&#39;linear&#39;],  <br>            &#39;C&#39;: [1000,5000,10000,50000,100000], <br>            &#39;gamma&#39;: [0.0001, 0.0005, 0.001, 0.005, 0.01, 0.1],}</pre><pre>classifier = GridSearchCV(SVC(class_weight=&#39;balanced&#39;), param_grid)</pre><pre>grid_result = classifier.fit(X_train, y_train)<br>grid_result.best_params_</pre><p>Running <strong>grid_result.best_params_ </strong>would return the optimal parameters for the best result. For example,</p><pre>{&#39;C&#39;: 1000, &#39;gamma&#39;: 0.005, &#39;kernel&#39;: &#39;rbf&#39;}</pre><p>You can update your <strong><em>param_grid</em> </strong>variable with these values and run it again.</p><h4>Applying Principal Component Analysis</h4><p>Now that you’ve fit your classifier to your train set, you must’ve realized that it takes a hell lot of time to do so. That is because our Pokémon dataset has about 90,000 features! To reduce the time taken and make a simpler model, we could use PCA.</p><blockquote>Principal Component Analysis, or PCA, is a dimensionality-reduction method that is often used to reduce the dimensionality of large data sets, by transforming a large set of variables into a smaller one that still contains most of the information in the large set.</blockquote><p>So let’s use PCA!</p><pre><strong>from</strong> sklearn.decomposition <strong>import</strong> PCA<br>pca = PCA(n_components = <strong>20</strong>, whiten=<strong>True</strong>).fit(X_train)<br>X_train = pca.transform(X_train)<br>X_test = pca.transform(X_test)</pre><p>This reduces our features from 90,000 to 20 — which makes our lives much easier. Apply PCA to your<strong> X_train</strong> and <strong>X_test</strong> before fitting your classifier.</p><p>And now we’re almost done! All there is left to do is to test our model</p><pre>y_pred = classifier.predict(X_test)</pre><p>From the confusion matrix, you can find out how many predictions were true and how many were false. A <strong>confusion matrix </strong>is a table used to describe the performance of a classifier.</p><pre><strong>from</strong> sklearn.metrics <strong>import</strong> confusion_matrix<br>cm = confusion_matrix(y_test,y_pred)</pre><h3>Your Pokedex is now ready!</h3><p>If you want you can complete the Pokedex with all types of Pokémon and improve it — You could take an input image from the user, use <strong>classifier.predict </strong>to identify the type and display it to the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*hJOCoolPxVoCJdYPbf8W2Q.png" /><figcaption>I used matplotlib to display the final output</figcaption></figure><p>You can check out my <a href="https://github.com/eeshashetty/Pokedex">GitHub</a> for the complete code and dataset.</p><h3>References</h3><ul><li><a href="https://towardsdatascience.com/a-step-by-step-explanation-of-principal-component-analysis-b836fb9c97e2">A step by step explanation of Principal Component Analysis</a></li><li><a href="https://medium.com/datadriveninvestor/an-introduction-to-grid-search-ff57adcc0998">An introduction to Grid search</a></li><li><a href="https://www.datacamp.com/community/tutorials/svm-classification-scikit-learn-python">Support Vector Machines in Scikit-learn</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2cf67ebd753" width="1" height="1" alt=""><hr><p><a href="https://medium.com/acmvit/gotta-train-em-all-b2cf67ebd753">Gotta train ’em all !</a> was originally published in <a href="https://medium.com/acmvit">ACM VIT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>