{"id":39509900,"url":"https://github.com/codingforentrepreneurs/the-hello-world-of-machine-learning","last_synced_at":"2026-01-18T06:01:04.785Z","repository":{"id":37218702,"uuid":"281783642","full_name":"codingforentrepreneurs/The-Hello-World-of-Machine-Learning","owner":"codingforentrepreneurs","description":"Learn to build a basic machine learning model from scratch with this repo and tutorial series.","archived":false,"fork":false,"pushed_at":"2022-12-08T11:14:33.000Z","size":303,"stargazers_count":65,"open_issues_count":14,"forks_count":34,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-03-15T19:58:02.179Z","etag":null,"topics":["machine-learning","machine-learning-python","ml","python","scikit-learn","tutorial"],"latest_commit_sha":null,"homepage":"https://www.codingforentrepreneurs.com/projects/hello-world-machine-learning","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codingforentrepreneurs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-22T21:09:12.000Z","updated_at":"2024-02-09T12:42:51.000Z","dependencies_parsed_at":"2023-01-25T12:15:34.879Z","dependency_job_id":null,"html_url":"https://github.com/codingforentrepreneurs/The-Hello-World-of-Machine-Learning","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codingforentrepreneurs/The-Hello-World-of-Machine-Learning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2FThe-Hello-World-of-Machine-Learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2FThe-Hello-World-of-Machine-Learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2FThe-Hello-World-of-Machine-Learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2FThe-Hello-World-of-Machine-Learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codingforentrepreneurs","download_url":"https://codeload.github.com/codingforentrepreneurs/The-Hello-World-of-Machine-Learning/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingforentrepreneurs%2FThe-Hello-World-of-Machine-Learning/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28531991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["machine-learning","machine-learning-python","ml","python","scikit-learn","tutorial"],"created_at":"2026-01-18T06:00:50.762Z","updated_at":"2026-01-18T06:01:04.735Z","avatar_url":"https://github.com/codingforentrepreneurs.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![The Hello World of Machine Learning Logo](https://static.codingforentrepreneurs.com/media/cfe-blog/the-hello-world-of-machine-learning/The_Hello_World_of_Machine_Learning_-_Post.jpg)](https://www.codingforentrepreneurs.com/blog/the-hello-world-of-machine-learning/)\n\n\nMachine learning is simply a computer learning from data instead of following a recipe. It's meant to mimic how people (and perhaps other animals) learn while still being grounded in mathematics.\n\nThis post is meant to get you started with a basic machine learning model. \n\nA chatbot.\n\nNow, we're not re-creating Alexa, Siri, Cortana, or Google Assistant but we are going to create a brand new machine learning program from scratch. \n\nThis tutorial is meant to be easy assuming you know a bit of Python Programming.\n\nWatch the [entire series](/projects/hello-world-machine-learning) that corresponds to this post.\n\n### Step 1: What's our data?\n\nMachine learning needs data to actually, well, learn. Machines don't yet learn like you and I do but they do learn by finding patterns in things that may seem non-obvious to you and I. We'll see a lot of that in this entire post.\n\nBefore we define our data, let's talk about the goal of this ML (machine learning) project:\n\u003e  To answer somewhat \"random\" questions with pre-defined responses.\n\n\nHere's what we'll try and solve:\n\n__Scenario 1__\n\nBill: `Hi there, what time do you open tomorrow for lunch?`\n\nBot: `Our hours are 9am-10pm everyday.`\n\n__Scenario 2__\n\nKaren: `Can I speak to your manager?`\n\nBot: `You can contact our customer support at 555-555-555.5`\n\n\n__Scenario 3__\n\nWade: `What type of products do you have?`\n\nBot: `We carry various food items including tacos, nachos, burritos, and salads.`\n\nLet's put this into a python format:\n\n\n```python\nconversations = [\n    {\n        \"customer\": \"Hi there, what time do you open tomorrow for lunch?\",\n        \"response\": \"Our hours are 9am-10pm everday.\"\n    },\n     {\n        \"customer\": \"Can I speak to your manager?\",\n        \"response\": \"You can contact our customer support at 555-555-5555.\"\n    },\n     {\n        \"customer\": \"What type of products do you have?\",\n        \"response\": \"We carry various food items including tacos, nachos, burritos, and salads.\"\n    }  \n    \n]\n```\n\nWithout machine learning our bot would look like this (uncomment next cell to run):\n\n\n```python\n# while True:\n#     my_input = input(\"What is your question?\\n\")\n#     response = None\n#     for convo in conversations:\n#         if convo['customer'] == my_input:\n#             response = convo['response']\n#     if response != None:\n#         print(response)\n#         break\n#     print(\"I don't know\")\n#     continue\n```\n\nRight away, you should see the huge flaws in this recipe; if a customer doesn't ask a question in a specific pre-defined way, the bot fails and ultimately really sucks. \n\nA few examples:\n    - What if a customer says, _when do you open?_ What do you already know the response to be? \n    - What if a customer says, _Do you sell burgers?_\n    - What if a customer says, _How do I reach you on the phone?_\n   \nI'm sure you could come up with many many more examples of where this really falls apart.\n\nSo let's clean up our conversations data a bit more by adding `tags` that describe the initial question.\n\n\n```python\nconvos_one = [\n    {\n        \"customer\": \"Hi there, what time do you open tomorrow for lunch?\",\n        \"tags\": [\"opening\", \"closing\", \"hours\"],\n    },\n     {\n        \"customer\": \"Can I speak to your manager?\",\n        \"tags\": [\"customer_support\"],\n    },\n    {\n        \"customer\": \"The food was amazing thank you!\",\n        \"tags\": [\"customer_support\", \"feedback\"],\n    },\n     {\n      \"customer\": \"What type of products do you have?\",\n       \"tags\": [\"products\", \"menu\", \"inventory\", \"food\"],\n    }  \n    \n]\n```\n\n\n```python\nconvos_two = [\n    {\n        \"customer\": \"How late is your kitchen open?\",\n        \"tags\": [\"opening\", \"hours\", \"closing\"],\n    },\n     {\n        \"customer\": \"My order was prepared incorrectly, how can I get this fixed?\",\n        \"tags\": [\"customer_support\"],\n    },\n    {\n        \"customer\": \"What kind of meats do you have?\",\n        \"tags\": [\"menu\", \"products\", \"inventory\", \"food\"],\n    }\n]\n```\n\n\n```python\nconvos_three = [\n    {\n        \"customer\": \"When does your dining room open?\",\n        \"tags\": ['opening', 'hours'],\n    },\n     {\n        \"customer\": \"When do you open for dinner?\",\n        \"tags\": ['opening', 'hours', \"closing\"],\n    },\n    {\n        \"customer\": \"How do I contact you?\",\n        \"tags\": [\"contact\", \"customer_support\"]\n    }\n]\n```\n\nDo you see a trend happening here? It's really easy to come up with all kinds of questions for a restaurant bot. It's also easy to see how challenging this would be to try and hard-code conditions to handle all the kinds of queries/questions customers could have.\n\nI'm sure you've heard you need a LOT of data for machine learning. I'll just add one thing to that, you need a lot of data to have *awe-inspiring* machine learning projects. A simple bot for a mom-and-pop store down the street doesn't need *awe-inspiring* just yet. They need simple, approachable, easy to explain. That's exactly what this is. It's not a black box of *millions* of lines of data points. It's like 20 questions with made up on the spot tags.\n\nIn so many ways, machine learning today (in the 2020s) is like the internet of the 1990s. People have heard about it and \"sort of get it\" and feel like it's just this magical gimmick that only super nerds know how to do. Ha. Super nerds.\n\nNow that we have our starting data, let's prepare for machine learning.\n\nFirst, let's combine all conversations:\n\n\n```python\ndataset = convos_one + convos_two + convos_three\ndataset\n```\n\n\n\n\n    [{'customer': 'Hi there, what time do you open tomorrow for lunch?',\n      'tags': ['opening', 'closing', 'hours']},\n     {'customer': 'Can I speak to your manager?', 'tags': ['customer_support']},\n     {'customer': 'The food was amazing thank you!',\n      'tags': ['customer_support', 'feedback']},\n     {'customer': 'What type of products do you have?',\n      'tags': ['products', 'menu', 'inventory', 'food']},\n     {'customer': 'How late is your kitchen open?',\n      'tags': ['opening', 'hours', 'closing']},\n     {'customer': 'My order was prepared incorrectly, how can I get this fixed?',\n      'tags': ['customer_support']},\n     {'customer': 'What kind of meats do you have?',\n      'tags': ['menu', 'products', 'inventory', 'food']},\n     {'customer': 'When does your dining room open?',\n      'tags': ['opening', 'hours']},\n     {'customer': 'When do you open for dinner?',\n      'tags': ['opening', 'hours', 'closing']},\n     {'customer': 'How do I contact you?',\n      'tags': ['contact', 'customer_support']}]\n\n\n\nOur conversations have the keys `customer` and `tags`. These are arbitrary names for this project and you change change them at-will. Just remember that `customer` equals `input` and `tags` equals `output`. This makes sense because in the future, we want a random customer input such as `What's the menu specials today` and a predicted tags output like `menu` or something similar.\n\n\nMachine learning has all kinds of terms and acronyms that often make it a bit confusing. In general, just remember that you have some `inputs` and some target `outputs`. Here's what I mean by that:\n\n- `customer`: These values are really the `input` values for our ML project. Input values are sometimes called `source`, `feature`, `training`, `X`, `X_train`/`X_test`/`X_valid`, and a few others.\n- `tags`: These values are really the `output` values for our ML project. Output values are sometimes called `target`, `labels`, `y`, `y_train`/`y_test`/`y_valid`, `classes`/`class`, and a few others.\n\n\u003e We're using a machine learning technique known as `supervised learning` which means we provide both the `inputs` and `outputs` to the model. Both data points are known data that we came up with. As you know, the `tags` (or `labels`/`outputs`) have been decided by a human (ie you and me) but can, eventually, be decided by a ML model itself and then verified by a human. Doing so would make the model better and better. There are many other techniques but `supervised learning` is by far the most approachable for beginners.\n\n\n### Prepare for ML\n\nNow that we have our data, it's time to put it into a format that works well for computers. As you may know, computers are great at numbers and not so great at text. In this case, we have to convert our text into numbers.\n\n\nThis is made simple by using the [scikit-learn](https://scikit-learn.org/stable/index.html) library. So let's install it below by uncommenting the cell.\n\n\n```python\n# !pip install scikit-learn\n```\n\nFirst up, let's turn our `customer` and `tag` data into 2 separate lists where the index of each item corresponds to the index of the other.\n\n```\nX = [customer_convo_1, customer_convo_2, ...]\ny = [convo_1_tags, convo_2_tags, ...]\n```\n\nThis is very standard practice so that `X[0]` is the `input` that corresponds to the `y[0]` `output`, `X[1]` is the `input` that corresponds to the `y[1]` `output` and so on. \n\n\n```python\ninputs = [x['customer'] for x in dataset]\nprint(inputs)\n```\n\n    ['Hi there, what time do you open tomorrow for lunch?', 'Can I speak to your manager?', 'The food was amazing thank you!', 'What type of products do you have?', 'How late is your kitchen open?', 'My order was prepared incorrectly, how can I get this fixed?', 'What kind of meats do you have?', 'When does your dining room open?', 'When do you open for dinner?', 'How do I contact you?']\n\n\n\n```python\noutputs = [x['tags'] for x in dataset]\nprint(outputs)\n```\n\n    [['opening', 'closing', 'hours'], ['customer_support'], ['customer_support', 'feedback'], ['products', 'menu', 'inventory', 'food'], ['opening', 'hours', 'closing'], ['customer_support'], ['menu', 'products', 'inventory', 'food'], ['opening', 'hours'], ['opening', 'hours', 'closing'], ['contact', 'customer_support']]\n\n\n\n```python\nassert(len(inputs) == len(outputs))\n```\n\n\u003e If you have an `AssertionError` above, that means your `inputs` and `outputs` are not balanced. Check your data source(s) to ensure every `input` has a corresponding `output` value.\n\nLet's verify the positions of this data to show how little we actually changed the data:\n\n\n```python\nidx = 4\nprint(inputs[idx], outputs[idx])\nprint(dataset[idx])\n```\n\n    How late is your kitchen open? ['opening', 'hours', 'closing']\n    {'customer': 'How late is your kitchen open?', 'tags': ['opening', 'hours', 'closing']}\n\n\n#### The Prediction Function\n\nThe goal of machine learning is to produce a function that takes `inputs` and produces `outputs` (predictions). Below is, at a conceptual level, a representation of that:\n\n\n```python\ndef my_pred_function(inputs):\n    # pred\n    outputs = inputs * 0.39013 # this decimal represents what our model will essentially do.\n    return outputs\n```\n\nNow we need to turn each `inputs` list and `outputs` list into matrices so our machine learning can do machine learning. \n\n`scikit-learn` has a simple way to do this. First, let's focus on the `inputs` (aka `customer` conversations) as they are the most simple.\n\n\n```python\nfrom sklearn.feature_extraction.text import CountVectorizer\n\nvectorizer = CountVectorizer()\n\nX = vectorizer.fit_transform(inputs)\n```\n\n\n\u003e Technical note: `scikit-learn` converted our data into a collection of 1 dimension matrices. We need to use matrices so we can do matrix multiplication (that's how machine learning works under the hood). In `numpy` speak, `X` is an `array` of `array`s.  If you want to see the actual vectors created, check out `X.toarray()` and you'll see it.\n\n\n```python\nX.shape\n```\n\n\n\n\n    (10, 43)\n\n\n\n`X.shape` is useful to describe our data. \n\n`X.shape[0]` refers to the number of conversations from our `final_convos` list. So, `X.shape[0] == len(final_convos)` and `X.shape[0] == len(inputs)`\n\n\n`X.shape[1]` refers to the number of `words` our data has. The `CountVectorizer` did this for us. The Machine Learning term is `features` related to what our data has. You can see all of the `features` (`words` minus punctuation) with:\n\n\n```python\nwords = vectorizer.get_feature_names()\nprint(words)\n```\n\n    ['amazing', 'can', 'contact', 'dining', 'dinner', 'do', 'does', 'fixed', 'food', 'for', 'get', 'have', 'hi', 'how', 'incorrectly', 'is', 'kind', 'kitchen', 'late', 'lunch', 'manager', 'meats', 'my', 'of', 'open', 'order', 'prepared', 'products', 'room', 'speak', 'thank', 'the', 'there', 'this', 'time', 'to', 'tomorrow', 'type', 'was', 'what', 'when', 'you', 'your']\n\n\nThe vectorizer has a very limited vocabulary as you can see. Naturally, this means our ML project will *always* misunderstand some key conversations and that's okay. The goal for our project is to get it working first, get customers (or ourselves) using it so we can *improve* it with new data right away (and thus re-improve it).\n\n\n```python\nlen(words)\n```\n\n\n\n\n    43\n\n\n\n#### Prepare Outputs (`labels`)\n\nEvery one of our inputs has a list of tags, not just one tag. Let's look at what I mean:\n\n\n\n```python\nprint(inputs[0], outputs[0], isinstance(outputs[0], list))\n```\n\n    Hi there, what time do you open tomorrow for lunch? ['opening', 'closing', 'hours'] True\n\n\nIn machine learning, this means `multi-label` classification because there are multiple possible `output` values for each `input` value. This is a more challenging problem than a `single` label but definitely necessary for a chatbot project.\n\nA single label dataset would look like the following:\n```\nInput: Hi there, how are you doing today?\nOutput: not_spam\n\nInput: Free CELL phones just text 3ED#2\nOutput: spam\n```\n\nNotice that the output is a single `str` and not a `list` of `str` values. If we continued down this path, our data would *always* fall into 2 categories: `spam` or `not_spam`. This type of classification is called `binary` classification because there are only 2 possible classes for the prediction to be. \n\n\nIn our project, our `input` values *can* fall into multiple `class` items, 1 `class`, or no `class` item at all. (Remember, `class` = `output tag` = `label`)\n\n\n```python\nfrom sklearn.preprocessing import MultiLabelBinarizer\n\nmlb = MultiLabelBinarizer()\n\ny = mlb.fit_transform(outputs)\n```\n\nYou might consider running `fit_transform` on a `CountVectorizer` like we did with our training data (aka `inputs`) but that doesn't work on multi-label classification. For that, we need `MultiLabelBinarizer`.\n\n\n```python\nmlb.classes_\n```\n\n\n\n\n    array(['closing', 'contact', 'customer_support', 'feedback', 'food',\n           'hours', 'inventory', 'menu', 'opening', 'products'], dtype=object)\n\n\n\nCalling `mlb.classes_` gives us the exact order of how our classes are defined in `y`. So `y[0]` corresponds to `outputs[0]` but in numbers instead of words. It's pretty cool. To see this technically, run the following code:\n\n```\nprint(y[0])\n# map to classes with `zip`\ny0_mapped_to_classes = dict(zip(mlb.classes_, y[0]))\nprint(y0_mapped_to_classes)\n```\n\nThen compare:\n```\nsorted(outputs[0]) == sorted([k for k,v in y0_mapped_to_classes.items() if v == 1])\n```\n\n\n\n```python\ny\n```\n\n\n\n\n    array([[1, 0, 0, 0, 0, 1, 0, 0, 1, 0],\n           [0, 0, 1, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 1, 1, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 0, 1, 0, 1, 1, 0, 1],\n           [1, 0, 0, 0, 0, 1, 0, 0, 1, 0],\n           [0, 0, 1, 0, 0, 0, 0, 0, 0, 0],\n           [0, 0, 0, 0, 1, 0, 1, 1, 0, 1],\n           [0, 0, 0, 0, 0, 1, 0, 0, 1, 0],\n           [1, 0, 0, 0, 0, 1, 0, 0, 1, 0],\n           [0, 1, 1, 0, 0, 0, 0, 0, 0, 0]])\n\n\n\nHere we can see the matrix that is generated for us with sklearn's `MultiLabelBinarizer`. It's an array of one-hot arrays. \n\n\u003e **one-hot** is a term that refers to the type of encoding we're using for this particular model. It's a very common practice in machine learning. Essentially turning data into `1`s and `0`s instead of strings or any other data type.\n\n\n```python\ny.shape\n```\n\n\n\n\n    (10, 10)\n\n\n\n`y.shape` is useful to describe our data in a similar way to `X.shape`\n\n`y.shape[0]` refers to the number of conversations from our `final_convos` list. So, `y.shape[0] == len(final_convos)` and `y.shape[0] == len(outputs)` and `y.shape[0] == X.shape[0]`\n\n\n`y.shape[1]` refers to the unique values of all of the possible `tags` each conversation has; it will never repeat using the `MultiLabelBinarizer`.\n\n\n```python\nassert y.shape[0] == X.shape[0]\nassert y.shape[0] == len(inputs)\n```\n\nIf you see an `AssertionError` here, it's the same exact error as `assert len(inputs) == len(outputs)` from above. Your data is not balanced.\n\n### Training with `scikit-lean`\n\n\n```python\nfrom sklearn.multioutput import MultiOutputClassifier\nfrom sklearn.ensemble import RandomForestClassifier\nforest = RandomForestClassifier(random_state=1)\nmodel = MultiOutputClassifier(forest, n_jobs=-1)\n```\n\n\n```python\nmodel.fit(X, y)\n```\n\n\n\n\n    MultiOutputClassifier(estimator=RandomForestClassifier(random_state=1),\n                          n_jobs=-1)\n\n\n\n### Prediction\n\n\n```python\ntxt = \"Hi, when do you close?\"\ninput_vector = vectorizer.transform([txt])\ninput_vector\n```\n\n\n\n\n    \u003c1x43 sparse matrix of type '\u003cclass 'numpy.int64'\u003e'\n    \twith 4 stored elements in Compressed Sparse Row format\u003e\n\n\n\n\n```python\noutput_vector = model.predict(input_vector)\nprint(output_vector)\n```\n\n    [[0 0 0 0 0 0 0 0 0 0]]\n\n\n\n```python\npreds = {}\nclasses = mlb.classes_\nfor i, val in enumerate(output_vector[0]):\n    preds[classes[i]] = val\n```\n\n\n```python\npreds\n```\n\n\n\n\n    {'closing': 0,\n     'contact': 0,\n     'customer_support': 0,\n     'feedback': 0,\n     'food': 0,\n     'hours': 0,\n     'inventory': 0,\n     'menu': 0,\n     'opening': 0,\n     'products': 0}\n\n\n\n\n```python\ndef label_predictor(txt='Hello world'):\n    # pred\n    input_vector = vectorizer.transform([txt])\n    output_vector = model.predict(input_vector)\n    preds = {}\n    classes = mlb.classes_\n    for i, val in enumerate(output_vector[0]):\n        preds[classes[i]] = val\n    return preds\n```\n\n\n```python\nlabel_predictor()\n```\n\n\n\n\n    {'closing': 0,\n     'contact': 0,\n     'customer_support': 0,\n     'feedback': 0,\n     'food': 0,\n     'hours': 0,\n     'inventory': 0,\n     'menu': 0,\n     'opening': 0,\n     'products': 0}\n\n\n\n\n```python\nlabel_predictor(\"When do you open?\")\n```\n\n\n\n\n    {'closing': 0,\n     'contact': 0,\n     'customer_support': 0,\n     'feedback': 0,\n     'food': 0,\n     'hours': 1,\n     'inventory': 0,\n     'menu': 0,\n     'opening': 1,\n     'products': 0}\n\n\n\n\n```python\nlabel_predictor(\"When are you opening tomorrow?\")\n```\n\n\n\n\n    {'closing': 0,\n     'contact': 0,\n     'customer_support': 0,\n     'feedback': 0,\n     'food': 0,\n     'hours': 0,\n     'inventory': 0,\n     'menu': 0,\n     'opening': 0,\n     'products': 0}\n\n\n\n### Export Model for Re-Use\n\n\n```python\nimport pickle\n# classes\n# model\n# vectorizer\n\nmodel_data = {\n    \"classes\": list(mlb.classes_),\n    \"model\": model,\n    \"vectorizer\": vectorizer\n}\n\nwith open(\"model.pkl\", 'wb') as f:\n    pickle.dump(model_data, f)\n```\n\n### Re-use Exported Model\n\n\n```python\nmodel_loaded_data = {}\n\nwith open(\"model.pkl\", 'rb') as f:\n    model_loaded_data = pickle.loads(f.read())\n\ndef label_predictor_from_export(txt='Hello world', \n                                vectorizer=None, \n                                model=None, \n                                classes=[], \n                                *args, \n                                **kwargs):\n    # pred\n    assert(vectorizer!=None)\n    assert(model != None)\n    input_vector = vectorizer.transform([txt])\n    output_vector = model.predict(input_vector)\n    assert(len(output_vector[0]) == len(classes))\n    preds = {}\n    classes = mlb.classes_\n    for i, val in enumerate(output_vector[0]):\n        preds[classes[i]] = val\n    return preds\n\nlabel_predictor_from_export(\"When does your kitchen close?\", **model_loaded_data)\n```\n\n\n\n\n    {'closing': 0,\n     'contact': 0,\n     'customer_support': 0,\n     'feedback': 0,\n     'food': 0,\n     'hours': 1,\n     'inventory': 0,\n     'menu': 0,\n     'opening': 1,\n     'products': 0}\n\n\n\n### Retraining with New Data\n\n\n```python\nfrom sklearn.feature_extraction.text import CountVectorizer\nfrom sklearn.preprocessing import MultiLabelBinarizer\nfrom sklearn.multioutput import MultiOutputClassifier\nfrom sklearn.ensemble import RandomForestClassifier\n\ndef train(dataset, train_col='customer', label_col='tags', export_path='model.pkl'):\n    inputs = [x[train_col] for x in dataset]\n    outputs = [x[label_col] for x in dataset]\n    assert(len(inputs) == len(outputs))\n    vectorizer = CountVectorizer()\n    X = vectorizer.fit_transform(inputs)\n    mlb = MultiLabelBinarizer()\n    y = mlb.fit_transform(outputs)\n    classes = list(mlb.classes_)\n    forest = RandomForestClassifier(random_state=1)\n    model = MultiOutputClassifier(forest, n_jobs=-1)\n    model.fit(X, y)\n    model_data = {\n        \"classes\": list(mlb.classes_),\n        \"model\": model,\n        \"vectorizer\": vectorizer\n    }\n    with open(export_path, 'wb') as f:\n        pickle.dump(model_data, f)\n    return export_path\n```\n\n\n```python\n# dataset\n```\n\n\n```python\ntrain(dataset, export_path='model2.pkl')\n```\n\n\n\n\n    'model2.pkl'\n\n\n\n\n```python\nmodel_loaded_data = {}\n\nwith open(\"model2.pkl\", 'rb') as f:\n    model_loaded_data = pickle.loads(f.read())\n    \nlabel_predictor_from_export(\"What is your favorite menu item?\", **model_loaded_data)\n```\n\n\n\n\n    {'closing': 0,\n     'contact': 0,\n     'customer_support': 0,\n     'feedback': 0,\n     'food': 0,\n     'hours': 0,\n     'inventory': 0,\n     'menu': 0,\n     'opening': 0,\n     'products': 0}\n\n\n\n### Store Dataset with Pandas\n\n\n```python\n!pip install pandas\n```\n\n    Requirement already satisfied: pandas in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (1.0.5)\n    Requirement already satisfied: numpy\u003e=1.13.3 in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from pandas) (1.19.1)\n    Requirement already satisfied: pytz\u003e=2017.2 in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from pandas) (2020.1)\n    Requirement already satisfied: python-dateutil\u003e=2.6.1 in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from pandas) (2.8.1)\n    Requirement already satisfied: six\u003e=1.5 in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from python-dateutil\u003e=2.6.1-\u003epandas) (1.15.0)\n\n\n\n```python\nimport pandas as pd\n```\n\n\n```python\ndf = pd.DataFrame(dataset)\ndf.head(n=100)\n```\n\n\n\n\n\u003cdiv\u003e\n\u003cstyle scoped\u003e\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n\u003c/style\u003e\n\u003ctable border=\"1\" class=\"dataframe\"\u003e\n  \u003cthead\u003e\n    \u003ctr style=\"text-align: right;\"\u003e\n      \u003cth\u003e\u003c/th\u003e\n      \u003cth\u003ecustomer\u003c/th\u003e\n      \u003cth\u003etags\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003cth\u003e0\u003c/th\u003e\n      \u003ctd\u003eHi there, what time do you open tomorrow for l...\u003c/td\u003e\n      \u003ctd\u003e[opening, closing, hours]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e1\u003c/th\u003e\n      \u003ctd\u003eCan I speak to your manager?\u003c/td\u003e\n      \u003ctd\u003e[customer_support]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e2\u003c/th\u003e\n      \u003ctd\u003eThe food was amazing thank you!\u003c/td\u003e\n      \u003ctd\u003e[customer_support, feedback]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e3\u003c/th\u003e\n      \u003ctd\u003eWhat type of products do you have?\u003c/td\u003e\n      \u003ctd\u003e[products, menu, inventory, food]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e4\u003c/th\u003e\n      \u003ctd\u003eHow late is your kitchen open?\u003c/td\u003e\n      \u003ctd\u003e[opening, hours, closing]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e5\u003c/th\u003e\n      \u003ctd\u003eMy order was prepared incorrectly, how can I g...\u003c/td\u003e\n      \u003ctd\u003e[customer_support]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e6\u003c/th\u003e\n      \u003ctd\u003eWhat kind of meats do you have?\u003c/td\u003e\n      \u003ctd\u003e[menu, products, inventory, food]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e7\u003c/th\u003e\n      \u003ctd\u003eWhen does your dining room open?\u003c/td\u003e\n      \u003ctd\u003e[opening, hours]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e8\u003c/th\u003e\n      \u003ctd\u003eWhen do you open for dinner?\u003c/td\u003e\n      \u003ctd\u003e[opening, hours, closing]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e9\u003c/th\u003e\n      \u003ctd\u003eHow do I contact you?\u003c/td\u003e\n      \u003ctd\u003e[contact, customer_support]\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\n\n\n\n```python\ndf.to_pickle(\"dataset.pkl\")\n```\n\n\n```python\n# df = pd.read_pickle(\"dataset.pkl\")\n# og_df.head()\n```\n\n\n```python\n# og_df.iloc[0]['tags'][0]\n```\n\n\n```python\nnew_dataset = df.to_dict(\"records\")\n# print(new_dataset)\n```\n\n### Adding to the Dataset\n\n\n```python\n# df = df.append({\"customer\": \"Who is the manager?\", \"tags\": [\"customer_support\"]}, ignore_index=True)\n```\n\n\n```python\n# df.head(n=100)\n```\n\n\n```python\ndef append_to_df(df):\n    df = df.copy()\n    while True:\n        customer_input = input(\"What is the question?\\n\")\n        tags_input = input(\"Tags? Use commas to separate\\n\")\n        if tags_input != None:\n            tags_input = tags_input.split(\",\")\n            if not isinstance(tags_input, list):\n                tags_input = [tags_input]\n        if customer_input != None and tags_input != None:\n            df = df.append({\"customer\": customer_input, \"tags\": tags_input}, ignore_index=True)\n        tag_another = input(\"Tag another? Type (y) to continue or any other key to exit.\")\n        if tag_another.lower() == \"y\":\n            continue\n        break\n    return df\n```\n\n\n```python\nnew_df = append_to_df(df)\n```\n\n    What is the question?\n    Who is the manager?\n    Tags? Use commas to separate\n    customer_support\n    Tag another? Type (y) to continue or any other key to exit.d\n\n\n\n```python\nnew_df.head(n=100)\n```\n\n\n\n\n\u003cdiv\u003e\n\u003cstyle scoped\u003e\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n\u003c/style\u003e\n\u003ctable border=\"1\" class=\"dataframe\"\u003e\n  \u003cthead\u003e\n    \u003ctr style=\"text-align: right;\"\u003e\n      \u003cth\u003e\u003c/th\u003e\n      \u003cth\u003ecustomer\u003c/th\u003e\n      \u003cth\u003etags\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003cth\u003e0\u003c/th\u003e\n      \u003ctd\u003eHi there, what time do you open tomorrow for l...\u003c/td\u003e\n      \u003ctd\u003e[opening, closing, hours]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e1\u003c/th\u003e\n      \u003ctd\u003eCan I speak to your manager?\u003c/td\u003e\n      \u003ctd\u003e[customer_support]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e2\u003c/th\u003e\n      \u003ctd\u003eThe food was amazing thank you!\u003c/td\u003e\n      \u003ctd\u003e[customer_support, feedback]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e3\u003c/th\u003e\n      \u003ctd\u003eWhat type of products do you have?\u003c/td\u003e\n      \u003ctd\u003e[products, menu, inventory, food]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e4\u003c/th\u003e\n      \u003ctd\u003eHow late is your kitchen open?\u003c/td\u003e\n      \u003ctd\u003e[opening, hours, closing]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e5\u003c/th\u003e\n      \u003ctd\u003eMy order was prepared incorrectly, how can I g...\u003c/td\u003e\n      \u003ctd\u003e[customer_support]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e6\u003c/th\u003e\n      \u003ctd\u003eWhat kind of meats do you have?\u003c/td\u003e\n      \u003ctd\u003e[menu, products, inventory, food]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e7\u003c/th\u003e\n      \u003ctd\u003eWhen does your dining room open?\u003c/td\u003e\n      \u003ctd\u003e[opening, hours]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e8\u003c/th\u003e\n      \u003ctd\u003eWhen do you open for dinner?\u003c/td\u003e\n      \u003ctd\u003e[opening, hours, closing]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e9\u003c/th\u003e\n      \u003ctd\u003eHow do I contact you?\u003c/td\u003e\n      \u003ctd\u003e[contact, customer_support]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e10\u003c/th\u003e\n      \u003ctd\u003eWho is the manager?\u003c/td\u003e\n      \u003ctd\u003e[customer_support]\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\n\n\n\n```python\nnew_df.to_pickle(\"dataset.pkl\")\n```\n\n### Creating a Rest API Model Service\nUsing [fastapi](https://fastapi.tiangolo.com/)\n\n\n```python\n!pip install fastapi uvicorn requests\n```\n\n    Requirement already satisfied: fastapi in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (0.60.0)\n    Requirement already satisfied: uvicorn in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (0.11.6)\n    Requirement already satisfied: requests in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (2.24.0)\n    Requirement already satisfied: pydantic\u003c2.0.0,\u003e=0.32.2 in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from fastapi) (1.6.1)\n    Requirement already satisfied: starlette==0.13.4 in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from fastapi) (0.13.4)\n    Requirement already satisfied: websockets==8.* in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from uvicorn) (8.1)\n    Requirement already satisfied: uvloop\u003e=0.14.0; sys_platform != \"win32\" and sys_platform != \"cygwin\" and platform_python_implementation != \"PyPy\" in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from uvicorn) (0.14.0)\n    Requirement already satisfied: h11\u003c0.10,\u003e=0.8 in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from uvicorn) (0.9.0)\n    Requirement already satisfied: httptools==0.1.*; sys_platform != \"win32\" and sys_platform != \"cygwin\" and platform_python_implementation != \"PyPy\" in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from uvicorn) (0.1.1)\n    Requirement already satisfied: click==7.* in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from uvicorn) (7.1.2)\n    Requirement already satisfied: chardet\u003c4,\u003e=3.0.2 in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from requests) (3.0.4)\n    Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,\u003c1.26,\u003e=1.21.1 in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from requests) (1.25.9)\n    Requirement already satisfied: idna\u003c3,\u003e=2.5 in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from requests) (2.10)\n    Requirement already satisfied: certifi\u003e=2017.4.17 in /Users/cfe/.local/share/virtualenvs/ml-hello-world-rt2goiiz/lib/python3.8/site-packages (from requests) (2020.6.20)\n\n\n\n```python\nAPI_APP_PATH = 'app.py' # pathlib, os.path\n```\n\n\n```python\n# from fastapi import FastAPI\n\n# app = FastAPI()\n\n# @app.get(\"/\")\n# def homepage_view():\n#     return {\"Hello\": \"World\"}\n```\n\n\n```python\n%%writefile $API_APP_PATH\n\nimport pickle\nfrom fastapi import FastAPI\nfrom pydantic import BaseModel\n\napp = FastAPI()\n\nmodel_data = {}\n\nwith open(\"model.pkl\", 'rb') as f:\n    model_data = pickle.loads(f.read())\n\n    \nclass CustomerInput(BaseModel):\n    query:str\n\ndef predict(txt='Hello world', \n                vectorizer=None, \n                model=None, \n                classes=[], \n                *args, \n                **kwargs):\n    # pred\n    assert(vectorizer!=None)\n    assert(model != None)\n    input_vector = vectorizer.transform([txt])\n    output_vector = model.predict(input_vector)\n    assert(len(output_vector[0]) == len(classes))\n    preds = {}\n    for i, val in enumerate(output_vector[0]):\n        preds[classes[i]] = int(val)\n    return preds\n\n@app.post(\"/predict\")\ndef predict_view(customer_input:CustomerInput):\n    # storing this query data -\u003e SQL database\n    my_pred = predict(customer_input.query, **model_data)\n    return {\"query\": customer_input.query, \"predictions\": my_pred}\n\n# @app.post('/train')\n```\n\n    Overwriting app.py\n\n\n\n```python\nimport requests\n\njson = {\n    \"query\": \"When do you open?\"\n}\n\nr = requests.post(\"http://127.0.0.1:8000/predict\", json=json)\nprint(r.json())\n```\n\n    {'query': 'When do you open?', 'predictions': {'closing': 0, 'contact': 0, 'customer_support': 0, 'feedback': 0, 'food': 0, 'hours': 1, 'inventory': 0, 'menu': 0, 'opening': 1, 'products': 0}}\n\n\n\n```python\n# label_predictor_from_export(\"When does your kitchen close?\", **model_loaded_data)\n```\n\n### Responses from Predictions\n\n\n```python\nbot_responses = [\n    {\n        \"responses\": [\n            \"We open at 8am everyday\",\n            \"We are open from 8am to 10pm everyday\",\n            \"8am to 10pm everyday\"\n        ],\n        \"tags\": [\"hours\", 'opening']\n    },\n    {\n        \"responses\": [\n            \"Tacos \u0026 Burgers\",\n            \"Pizza\"\n        ],\n        \"tags\": [\"menu\", 'food']\n    }\n]\n\nbot_df = pd.DataFrame(bot_responses)\nbot_df.head(n=100)\n```\n\n\n\n\n\u003cdiv\u003e\n\u003cstyle scoped\u003e\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n\u003c/style\u003e\n\u003ctable border=\"1\" class=\"dataframe\"\u003e\n  \u003cthead\u003e\n    \u003ctr style=\"text-align: right;\"\u003e\n      \u003cth\u003e\u003c/th\u003e\n      \u003cth\u003eresponses\u003c/th\u003e\n      \u003cth\u003etags\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003cth\u003e0\u003c/th\u003e\n      \u003ctd\u003e[We open at 8am everyday, We are open from 8am...\u003c/td\u003e\n      \u003ctd\u003e[hours, opening]\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e1\u003c/th\u003e\n      \u003ctd\u003e[Tacos \u0026amp; Burgers, Pizza]\u003c/td\u003e\n      \u003ctd\u003e[menu, food]\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\n\n\n\n```python\npred_response = {'query': 'When do you open?', 'predictions': {'closing': 0, 'contact': 0, 'customer_support': 0, 'feedback': 0, 'food': 0, 'hours': 1, 'inventory': 0, 'menu': 0, 'opening': 1, 'products': 0}}\n```\n\n\n```python\npred_tags = [k for k,v in pred_response['predictions'].items() if v != 0]\npred_tags\n```\n\n\n\n\n    ['hours', 'opening']\n\n\n\n\n```python\nmask = bot_df.tags.apply(lambda x: set(pred_tags) == set(x))\nprint(mask)\n```\n\n    0     True\n    1    False\n    Name: tags, dtype: bool\n\n\n\n```python\nresponse_df = bot_df[mask] # bot_df[bot_df.tags.isin(\"abcs\")]\nresponse_df.head()\n```\n\n\n\n\n\u003cdiv\u003e\n\u003cstyle scoped\u003e\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n\u003c/style\u003e\n\u003ctable border=\"1\" class=\"dataframe\"\u003e\n  \u003cthead\u003e\n    \u003ctr style=\"text-align: right;\"\u003e\n      \u003cth\u003e\u003c/th\u003e\n      \u003cth\u003eresponses\u003c/th\u003e\n      \u003cth\u003etags\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003cth\u003e0\u003c/th\u003e\n      \u003ctd\u003e[We open at 8am everyday, We are open from 8am...\u003c/td\u003e\n      \u003ctd\u003e[hours, opening]\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\n\n\n\n\n```python\nall_responses = list(response_df['responses'].values)\nprint(all_responses)\n```\n\n    [['We open at 8am everyday', 'We are open from 8am to 10pm everyday', '8am to 10pm everyday']]\n\n\n\n```python\nresponses = []\nfor row in all_responses:\n    for r in row:\n        responses.append(r)\n\nresponses = list(set(responses))\n\nresponses\n```\n\n\n\n\n    ['We are open from 8am to 10pm everyday',\n     'We open at 8am everyday',\n     '8am to 10pm everyday']\n\n\n\n\n```python\nimport random\n\ndef predict_and_respond(txt=None, bot_df=None):\n    if txt == None and bot_df is None:\n        return \"Sorry, I don't know what that means. Please contact us.\"\n    json = {\n        \"query\": txt\n    }\n    r = requests.post(\"http://127.0.0.1:8000/predict\", json=json)\n    if r.status_code not in range(200, 299):\n        # send a signal, logging\n        return \"Sorry, I am having trouble right now. Please try again later.\"\n    pred_response = r.json()\n    pred_tags = [k for k,v in pred_response['predictions'].items() if v != 0]\n    mask = bot_df.tags.apply(lambda x: set(pred_tags) == set(x))\n    response_df = bot_df[mask]\n    all_responses = list(response_df['responses'].values)\n    responses = []\n    for row in all_responses:\n        for r in row:\n            responses.append(r)\n    responses = list(set(responses))\n    if len(responses) == 0:\n        return \"Sorry, I am still learning. I don't understand what you said.\"\n    return random.choice(responses)\n```\n\n\n```python\npredict_and_respond(\"Are you open at 9:30am tomorrow?\", bot_df=bot_df)\n```\n\n\n\n\n    \"Sorry, I am still learning. I don't understand what you said.\"\n\n\n\n### What's Next?\n\n1. Get more data, a lot more\n- Add more data right now. Keep adding data.\n- Refine the data, move tags, remove tags, upgrade.\n2. Deploy to a production server:\n- Ideally using [this project](https://www.codingforentrepreneurs.com/projects/serverless-container-python-app) for deploying a serverless application using FastAPI (like we did).\n3. Use internally, a lot.\n- If this tool becomes the go-to for finding answers about your business internally, it can become the same tool for external (customer facing) as well. When in doubt, give it to customers,\n\n\n```python\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingforentrepreneurs%2Fthe-hello-world-of-machine-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodingforentrepreneurs%2Fthe-hello-world-of-machine-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingforentrepreneurs%2Fthe-hello-world-of-machine-learning/lists"}