Mindblown: a blog about philosophy.

  • I Wrote a Wordscapes Bot in Python, And Became a Screenshot Hoarder

    Hey, bots should be allowed to have leisure time too!

    Photo by Daniel Klein on Unsplash

    I wrote an article explaining how I built a simple anagram solver for Wordscapes. But then I got stupidly obsessed with how I could take my cheating to the next level. I didn’t want to swipe anymore! But what could I use to swipe the screen for my lazy behind?

    Enter pyautogui

    It’s a Python library that lets you, among other things, screenshot and click around a screen on different platforms. There are faster platform specific options but for my needs this was more than sufficient.

    If a pictures worth a thousand words, then a gif is worth 1000s of words yeah?

    Yes I have a tab open for how to screen record. OBS ftw!

    How does it work? Let me break it down for you. (All the code is here.)

    A Dumb Solver

    The very first version of this used a set of points that were fixed on the screen and permuted through them. The code is:

    from itertools import permutations
    import pyautogui as pg
    from typing import List, Tuple
    from pyscreeze import Point
    LEFT_CHAR_POS = Point(360, 820)
    TOP_CHAR_POS = Point(480, 695)
    RIGHT_CHAR_POS = Point(605, 814)
    BOTTOM_CHAR_POS = Point(483, 945)
    def _gen_permutation(n: int):
    return _gen_permutation_for_list(
    def _gen_permutation_for_list(positions: List[Point[int]], n: int):
    return permutations(positions, n)
    def _move_through_permutation(permutation: List[Tuple[str]]):
    for i, pos in enumerate(permutation):
    duration = 0.001
    pg.moveTo(x=pos[0], y=pos[1], duration=duration)
    if i == 0:
    def position_based_permute_solver(positions: List[Point[int]]):
    for i in range(3, len(positions)+1):
    for permutation in _gen_permutation_for_list(positions, i):
    def four_char_permute_solver():
    for permutation in _gen_permutation(3):
    for permutation in _gen_permutation(4):

    This would just swipe all the permutations for 3 and 4 positions, hard coded to the exact pixel placement I got by running pyautogui.mouseInfo() and seeing what the number was for my cursor. While fun and pretty stupid, this approach fell apart as soon as a fifth and sixth character were introduced. Instead of just adding more pixel positions and permutations, I decided to try and be smarter.

    The Pitfalls of Trying to Be Smarter

    If you want to pick letters on the screen, you find that the first thing you need to do is have a screenshot of those letters to “find” them. This is a chicken and egg problem that is solved by me:

    1. Pausing the solver
    2. Screenshotting a picture of each letter
    3. Adding them to a folder and labelling each with the corresponding letter (e.g. a.png )
    4. Restarting the solver and seeing if it’s smart enough to find the letter
    The price of being smart is knowing what the letter “C” looks like

    Pyautogui wraps a handful of other image libraries like opencv and Pillow , but basically I just played around with how I could set the confidence when matching, and found that for certain letters like O and Q I needed to up the similarity. I then needed to deduplicate all the matches found right around the letter, since lowering the confidence meant that you got a lot of clustered duplicates. Also I kept finding I’s inside H’s, so annoying.

    Being smart is annoying!

    Anyway having played around with that a ton, I also realized I had to highlight the letters to start (that’s the initial sweep in the gif above). I just hard coded some relative pixel positions to the back arrow at the top (more screenshots!)

    Putting it all together

    Eventually my solver got pretty fancy, with multiple letters to match in case the background color changed, and I incorporated the anagram solver from the other video to give me my “guesses.”

    The last bit of swiping that was kind of fancy was mapping those guesses to the identified letters and their positions. That looks like:

    from collections import defaultdict
    from typing import Dict, List
    import pyscreeze
    import pyautogui as pg
    def guess_to_movement(guess: str, letter_points: Dict[str, List[pyscreeze.Point]]) -> None:
    letter_indices = defaultdict(lambda: 0)
    for i, letter in enumerate(guess):
    duration = 0.001
    point_index = letter_indices[letter]
    pos = letter_points[letter][point_index]
    letter_indices[letter] += 1
    pg.moveTo(x=pos[0], y=pos[1], duration=duration)
    if i == 0:

    The data we’re dealing with looks like {“e”: [Point(1,2), Point(3,4)], “b”: [Point(5,6)]}

    So if we had a guess like Bee we’d

    1. go to the point corresponding to B
    2. roll B’s index forward in case there was another B again
    3. put the mouse down since it’s the first index
    4. (Looping around) now go to the first E point, and incrementing the index corresponding to E
    5. (Looping around) now go to the second E point, and increment the index, though we won’t need it
    6. Pick up the mouse

    And there you have it, something that can find letters on a page, translate those letters to guesses, and translate those guesses back to swiping.

    After doing this for a while it can be satisfying to watch, but mostly I just became a screenshot hoarder. Still haven’t found my letter Z yet 🙁

    Thanks for reading! Feel free to try out the code if you want to sit back and watch the swiping.


    I Wrote a Wordscapes Bot in Python, And Became a Screenshot Hoarder was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • AI Art -Creative Technologies for the Future

    From Leonardo da Vinci, to Michelangelo, Pablo Picasso and now, codes, and algorithms, Artworks have indeed come a far way, taking on different shapes and permeating varied spaces.

    The new phenomenon of artwork is known as AI Art which is the creation of art using artificial intelligence. Through text-to-image software, AI can now build visual pieces using language prompts and previous data sets, rather than photographing or drawing an image.

    Key Benefits


    Most people are aware of the immense fortune that can be made by selling non-fungible tokens (NFTs), with art created by humans being a popular commodity. Today, with the advancements in AI, NFT generative art is a rapidly growing market with NFT/crypto and art enthusiasts buying and selling AI-generative art pieces. For example, Art Blocks, a generative-art platform is well recognized as the leading space for esteemed artworks and frequent trading. As of September 2022, Arts Blocks is worth over 800 million U.S. dollars.

    The Bot Libre metaverse platform enables influencers, gamers, and businesses to engage these NFT spaces by providing an extensive API, integrations and SDKs for popular 3D platforms.

    Simplifies Tasks

    In the same way Bot Libre chatbots can allow businesses to connect with and serve their customers better, an AI art generator allows persons to create beautiful art for a fraction of the time, and cost. For example, book covers, illustrations, presentations can be quickly produced by entering the relevant prompts in the generator.

    Limitless Designs

    If you can think of it, you can create it. You simply input the relevant text and the AI generator will get to work, and lest you think the results are mediocre, these art pieces are mimicking notable artwork and copping first prizes in competitions all over the world. AI generators also allow for the merging of simulation and reality , creating unique art experiences.

    Be the Movement

    With AI, the possibilities are endless. If you are an AI, art and metaverse enthusiast, looking to build, participate and grow wealth from all the offerings of web3.0, then join the Bot Libre Beta Program. As a member, you will get early access to unique metaverse solutions and become early adopters of metaverse technologies. For more information, contact sales@botlibre.com.

    Learned something? Please give us a

    to say thanks and to help others find this article


    AI Art -Creative Technologies for the Future was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Metaverse Only Ticket Sale

    Right now, we have a crazy special for the Chatbot Conference.

    We have ten tickets for you to Name your Own Price and attend the Morning Sessions of the Chatbot Conference on Nov 15th!

    Metaverse Only Ticket Sale was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • A Chatbot that Introduces you to Friends in the Metaverse

    Do you want to see a Chatbot in the Metaverse that introduces people to each other based on their personality?

    We created Alice, a chatbot for Chatbot Conference on Nov 15th, where the bot introduces attendees to each other based on their compatibility!

    You can play with the Bot here: https://play.decentraland.org/?position=5%2C118&

    Join us at the Chatbot Conference

    A Chatbot that Introduces you to Friends in the Metaverse was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Step-by-step Guide to Building Slack Chatbot for Internal IT Support [No code]

    Why use Slack for internal IT Support

    According to Enlyft, there are around 135,711 companies that currently use slack as collaborative software.

    Chances are, your business might be one of those 135,711 companies. Though using slack as a means of communication between members of the same team or different teams in a company leads to productive work culture, companies can leverage the instant messaging platform even more. By turning slack into your business’ employee support hub.

    Here’s why.

    1. Helps you get more out of your existing software

    Be it Jira Cloud for getting notifications about issues as and when they get mentioned, or HubSpot for your sales and marketing efforts, or Freshservice for managing your IT services, you can add the slack version of the apps your business already uses in the channel of your choice from the slack app directory.

    This makes it easier for your employees to use slack’s version of IT service management apps like Freshservice for

    • 1. Converting slack direct message (DM) conversations to tickets in Freshservice
    • 2. Adding slack conversation as ticket description for context
    • 3. Getting in touch with the Subject Matter Expert (SME) of an IT issue right away via slack DMs.

    And that’s just the tip of the iceberg.

    2. It’s super-flexible

    With slack, you can create separate channels for different teams or, you can create a shared channel for your organization and a third-party vendor to collaborate. Channels are a great way of letting employees stay in the loop of things. Be it support agents getting notified in slack about tickets raised via DM or a channel, or an agent reacting to an issue raised by a requestor in a channel to let them know about its status, slack helps in streamlining IT processes.

    Moreover, your company’s help desk agents will be able to guide an employee with their issue via slack’s audio and video calls feature on-the-go. Pretty Neat, huh?

    3. Prevents Silos among Teams

    According to this infographic by the Queens University of Charlotte, 49% of Millennials (who are soon to comprise the majority of the workforce) support social tools for workplace collaboration.

    In fact, about 40% of Millennials would even pay out of pocket for social collaboration tools to improve productivity. That’s how much they believe in the dream team of collaboration and technology.

    Slack, through its plethora of real-time collaboration and document authoring tools like Google Drive, Dropbox or Microsoft OneDrive makes the dream team of collaboration and technology all the more, real. Through pinned messages and files, new joiners or people already in your team’s Slack channel will be able to review things such as:

    • Product spec
    • Tech spec
    • Designs

    This way, lots of onboarding meetings and a slew of forwarded email threads to root through for new employees can be avoided.

    Team members will also be able to scan through all previous conversations, decisions and the people involved in the channel. This kind of transparency ultimately leads to the reduction of help desk tickets raised by employees. Now that’s more like it.

    4. Easier for triaging issues

    Let’s say you have a slack channel called #support for employees to report their IT issues. Whenever an employee reports their issue in the #support channel, the employee or the help desk manager can call the attention of another member who might be an SME for that issue by including an @mention. The person mentioned will then be notified immediately. As seen in the above example, the @mention comes in handy when the help desk manager wants to triage issues mentioned in the channel to the corresponding SME. The SME can then update the status of the issue in the channel itself with the help of emojis that’s easier to track for the employee who reported the issue as well as for the help desk manager.

    But with limitations.

    There are lot of benefits of using slack in your company. And although it is beneficial for companies to use slack, it comes with several limitations especially if you want to automate user interactions and workflows for IT helpdesk or workplace support. Thankfully, you can overcome these limitations by having a slack chatbot that can do much more than just notifications or converting DM to tickets.

    What is Slack Chatbot

    Slack is a modern workplace communication or chat tool that helps users connect and collaborate quickly. It also serves as a platform for users to interact with 3rd party apps, which makes it easy for all teams to get work done quickly.

    With slack being one of the most widely used communication hub, having a chatbot on slack makes it easy for companies to automate user interactions and workflows that help offer several benefits. Companies are starting to adopt bots on slack that can help automate IT Helpdesk and HR support but also see increased adoption in other parts of the business such as finance, and facilities.

    Today, several conversational ai no-code platforms offer quick and efficient way for companies to build bots (for different use cases) and deploy them on slack thus making a slack chatbot more appealing as it does not require human intervention and can autonomously support users. And it doesn’t stop there, you can also automate app workflows from your slack chatbot using no-code platforms. And what this means is, slack Chabot can automate both conversations and interact with apps to automate workflows as well that makes it very attractive to deliver customer and employee service automation.

    How to build slack bot using a no-code platform.


    Think of workativ assistant like an icing on the cake to all that you can already do with slack at workplace. With workativ assistant, you can build a conversational bot that sounds humane and solves your employees’ issues with the power of both NLP and workflow automation in the snap of a finger.

    Yeah, you heard it right. But Thanos’ snap can only turn half of the universe’s population to dust, while a bot can turn most of not all of your employees’ IT woes into dust in no time. Let’s see what makes workativ assistant’s bot so worthy of wielding the infinity gauntlet more than Thanos.

    Here is a short video of how to use a no-code platform like workativ assistant to build your slack chatbot.

    Get — Free IT Slack Chatbot

    How slack chatbot can automate your IT Helpdesk

    Slack chatbot can be very useful for companies to automate IT Helpdesk operations. Having an effective slack bot as your first-line agent can really benefit companies to automate repetitive issues, decreasing mean time to respond, improving employee experience and reducing costs.

    Let’s look at the top 6 issues that slack bot can automate for IT Helpdesk.

    1. Unlocking Accounts


    Your account has been locked unexpectedly, and you want to get it unlocked quickly! This is one of the most frequent queries that hit the help desk. It is repetitive and has a defined process. A perfect candidate for your slack bot.


    In this case, the user types in something like Unlock My Account or select Unlock Account from a list of options the Slack chatbot provides. The bot understands the query, asks for user details to verify, and unlocks the account in seconds.

    2. Resetting Passwords


    Password Reset is the most common request in the IT helpdesk. An agent may take longer than a chatbot to resolve such a trivial issue. With the self-service slack chatbot, you can go through the transparent resolution process yourself and get your password reset in seconds.


    The user has to simply type in Reset Password into their Slack window. The Bot understands and asks the user for some details like email address for verification. Then, it either sends a password reset link to the user’s email address or asks the user to key-in the new password and resets it.

    3. User Provisioning


    When a new user joins a company or moves to a different department, your IT and HR teams works with the process and systems to create new year, assigns email, adds role and user access privileges to various applications and so on depending on company policy. This takes time.


    Let the Slack chatbot do that for you in seconds!

    All you need to do is type in their query or request (say, create an account for Aaron Smith) in the Slack chat box. The bot looks for key words in the user’s input and responds with either more options to clarify the issue or asks for specific user details for verification. Once verified, it proceeds with the provisioning or deprovisioning process as requested.

    4. Access Requests


    Another candidate for automation is access requests when users change roles or needs access to app. The process and efforts are time consuming with traditional IT Helpdesk.


    Slack bot can handle this easily. A user types in the query (say I am not able to access the HR portal) and the chatbot asks for the email address for verification and verifies if the user has access before. Post validation, the bot either raises a request to the management for providing access to the user or allows access to the particular resource (here HR portal) itself. Takes only a few seconds.

    5. Asset Request


    Companies provide workplace assets for employees. And when the asset breaks or needs new or additional assets like laptop or keypad, employees raise new asset requests with IT Helpdesk. This is a defined process that can be automated fairly quickly.


    With slack bot, user types in the query (say My laptop is not working) and the bot asks for more detailed description of the issue. When the user elaborates the issue, the bot proceeds with a request to the management for issuing a new laptop, creates an IT ticket and shares it details with the user as well.

    6. Suspend a User


    Suspending users refers to revoking a user’s access to a particular service and removing them from the company’s email list. Businesses come across similar situations quite often. You wonder if that can be done in seconds?


    With slack bot, user needs to do is type “Suspend < user’s name >” and the bot, after validating and getting required approval, will either suspend the user itself or raise a raise a ticket for second level agent to suspend the user. `

    Top 5 reasons for you to use a no-code platform to build your slack chatbot.

    Because it’s easy. Here are some reasons on why you should choose a no-code platform to build you slack bot. We have used workativ assistant as an example.

    1. One-click slack integration

    Deploying a bot in your preferred slack workspace’s channel is as easy as pie. Just click on the add to slack button, grant the permissions required by workativ assistant to access your slack workspace, add the bot to the channel of your choice, and you’re good to go.

    2. Automates repetitive IT issues with workflows and not just conversations

    According to INRY, password resets constitute an astonishing 20% to 50% of help desk calls. And like you’d already know; password resets aren’t that much of an issue to call another person for a solution when we ourselves can solve it.

    By automating repetitive, mundane tasks like a password reset, unlocking an account, etc., the average cost-per-call to your internal help desk gets reduced drastically. And workativ assistant makes it possible using its workflow automation feature to integrate your bot with several IAM apps and create workflow or an automation in just a few clicks of a button for resetting a password. No coding knowledge required. Handy, right?

    3. Manage several simple or complex use-cases with chatbot builder

    Yes, you can create automations like a breeze using workativ assistant. But what use are those automations when you don’t deliver the solution properly?

    This is where workativ assistant’s intuitive chatbot builder comes into play. With chatbot builder’s myriad of options, you can create conversations for any number of scenarios with a human touch more so that people who chat with the bot can’t tell the difference between chatting with a human and a bot. Again, no coding knowledge required.

    4. App integrations and workflow marketplace

    You can connect your bot with your business’ apps and use pre-built app workflows for your chatbot

    Be it sending an OTP via Twilio, creating a ticket via Freshservice, or sending a message to a slack channel, workativ assistant can do this and more for you once you connect it to the required app.

    And you don’t even have to create Automations from scratch. Through the workativ assistant workflow marketplace, you can add ready-made automations for the required apps with just the click of a button.

    5. Trains itself to better understand your employees

    Workativ assistant’s training module enables the bot that you create to learn from its historical data of conversations with your employees and train itself to better detect an employees’ intention for initiating a conversation.

    Top 6 benefits of slack bot at workplace using workativ assistant.

    Now that you know why using slack as an internal help desk can help transform your workplace support, why not combine it with workativ assistant to let your employees get the best out of your internal IT support?

    Think about it. With slack’s superior features and workativ assistant’s conversational ai-powered automations, you can do so much more for your employees.

    1. Supercharge self-service for your employees

    By deploying a bot built using workativ assistant in the slack channel for reporting IT issues, your employees can solve their problems themselves from the comfort of the channel.

    2. 24×7 availability

    Help desk agents can’t be available 24×7 to help out employees with their issues. After all, they’re human too. They need ample rest just like the rest of us.

    To “help” your help desk agents, you can build a bot that offers IT support for repetitive tasks like a password reset, unlocking an account, etc., (as discussed earlier) in your workplace support slack channel as well as train itself to resolve problems based on solutions previously offered for similar problems by a help desk agent. This allows employees to solve their problems quickly as and when they arise without the hassles of long waiting queues.

    3. Call deflection

    Enabling employees to resolve their IT issues themselves via bot in your workplace support slack channel prevents the bottleneck of a single help desk agent handling huge number of calls. Providing self-serve to employees via bot also thwarts the need for help desk agents to provide in-person support.

    4. All-encompassing

    Adding the slack version of your business’ apps from the slack app directory every time can be a bit frustrating.

    With workativ assistant, you can connect your business’ apps with bot and automate tasks for those apps instead of adding them from the Slack App Directory. This makes it easier on your IT Admins as well as your employees. Be it creating a ticket in Zendesk or sending an email via Outlook, your employees can use the bot to take care of it.

    5. Productive and satisfied employees

    Enabling your employees to solve their IT issues themselves in a slack channel via bot leads them to solve their issues then and there itself and continue with their work.

    For employees, this eliminates the frustration that comes with the labyrinthine way of getting an IT issue resolved like sending multiple emails, redirects to different SMEs, etc., Employee self-service also let’s help desk agents focus on resolving the more pressing IT issues at hand.

    6. Cost savings

    With bot deployed in a slack channel, you can get rid of the overheads that come with repetitive tickets and truly see your help desk costs take a dive immediately. Building and using a slack bot with workativ starts at $299 per month flat. Compare that with hiring a live agent. The cost savings are 10x. More on pricing here.

    Steps to deploy your bot on slack for Internal IT Support

    Deploying your bot on slack is easy. It is just an easy set of steps to follow and you will be done with having a bot on slack in no time. Let us see some of the major steps involved in the process.

    Once you have built your bot, and ready to deploy on slack, you can login to your workativ assistant workspace.

    • Select Slack as the desired Chat Channel
    • Click Add to Slack to start a new integration
    • Sign in to your Slack workspace on the URL: https://api.slack.com
    • Create a new app for the Workativ Assistant chatbot and select the desired App Name (Bot name)
    • Customize your bot by selecting its Logo, Background Colour, and Bot Name
    • Update the required information in both Slack App page and Workativ’s Slack Integration page
    • Save the changes and click Add to Slack

    There you go! You have successfully deployed your chatbot on slack, and you can easily access it by signing into your slack workspace.


    Since you have reached the conclusion, you must be clear by now that Slack is one of the best enterprise-level communication tools for the interaction between the chatbot and the users. It is found that 70% of users prefer using slack for reporting their support issues. And while it’s great for people to interact, using Slack chatbot can really transform workplace support by automating both interactions and as well workflows.

    In a nutshell, it is evident that companies are ought to select slack as the suitable platform for deploying their chatbots. With the AI-powered no-code platforms like Workativ assistant, you can leap your slack bot journey. Bringing together Workativ Assistant, Slack, and other third-party tools makes your BOT no less than a SUPER-BOT. Power-packed and Smart!

    Can’t wait to transform your business’ slack channel into an IT help desk? Get in touch with us, and we’d gladly give you a demo.

    Disclaimer: This article was originally published here.


    Step-by-step Guide to Building Slack Chatbot for Internal IT Support [No code] was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Flash Sale! Save up to $250 on Chatbot Conference Tickets.

    The Chatbot Conference is only 3 weeks away, and right now, we are having our last sale of the year!

    You can save up to $250 on tickets.

    And it gets better. We just launched our Points Program and a Community, so every dollar you spend on tickets earns you a point you can use towards future Conferences, our Certified Workshops, and Membership Packages.

    Register Today and see you on November 15th.



    Flash Sale! Save up to $250 on Chatbot Conference Tickets. was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Types of Activation Functions in Deep Learning explained with Keras

    Activation does it means activating your car with a click ( if it has that ,of course) , well the same concept but in terms of neurons , neuron as in human brain ? , again close enough, neuron but in Artificial Neural Network (ANN).

    The activation function decides whether a neuron should be activated or not.

    A biological neuron in the human brain

    If you have seen an ANN, which I sincerely hope you do you have seen they are linear in nature, so to use non — linearity in them we use activation functions and generate output from input values fed into the network.

    A sample ANN network

    Activation functions can be divided into three types

    1. Linear Activation Function
    2. Binary Step Activation Function
    3. Non — linear Activation Functions

    Linear Activation Function

    It is proportional to the output values, it just adds the weighted total to the output. It ranges from (-∞ to ∞).

    Graph showing linear activation function

    Mathematically, the same can be written as

    Equation of Linear Activation

    Implementation of the same in Keras is shown below,


    Binary Step Activation Function

    It has a specific threshold value that determines whether a neuron should be activated or not.

    Binary Step Activation Function Graph

    Mathematically, this is the equation of the function

    Equation of Binary Step Activation Function

    Implementation of the same is not present in Keras so a custom function is made using TensorFlow as follows


    Non — Linear Activation Functions

    It allows ANN to adapt according to a variety of data and differentiate between the outputs. It allows the stacking of multiple layers since the output is a combination of input passed through multiple layers of the neural network.

    Various non — linear activation functions are discussed below

    Sigmoid Activation Function

    This function accepts the input (number) and returns a number between 0 and 1. It is mainly used in binary classification as the output ranges between 0 and 1 e.g. you train a dog and cat classifier , regardless of how furry that dog is it classifies it as a dog not cat , there is no between , sigmoid is perfect for it.

    Graph of Sigmoid function

    Mathematically, the equation looks like this

    Sigmoid Function Equation

    Implementation of the same in Keras is shown below,


    TanH Activation Function

    This activation function maps the value into the range [ -1 , 1 ]. The output is zero centered , it helps in mapping the negative input values into strongly negative and zero values to absolute zero.

    Comparison of tanh with sigmoid

    Mathematically, the equation looks like this

    Equation of tanh

    Implementation of the same in Keras is shown below


    ReLU ( Rectified Linear Unit)

    It is one of the most commonly used activation functions, it solved the problem of vanishing gradient as the maximum value of the function is one. The range of ReLU is [ 0 , ∞ ].

    Graph comparing Sigmoid and ReLU

    Mathematically, the equation looks like this

    Equation of ReLU

    Implementation of the same in Keras is shown below,


    Leaky ReLU

    Upgraded version of ReLU like Covid variants .. sensitive topic …ok fine .. getting back to Leaky ReLU , it is upgraded as it solves the dying ReLU problem , as it has small positive slope in negative area.

    Comparison of ReLU (left) and Leaky ReLU (right)

    Mathematically, the equation looks like this

    Implementation in Keras is coming right below


    SoftMax Activation Function

    Its a combination of lets guess .. is it tanh , hmm not quite , ReLU ? no or its leaky counterpart .. mhh not quite …. ok lets reveal it .. it is a combination of many sigmoid. It determines relative probability.

    In Multiclass classification , it is the most commonly used for the last layer of the classifier. It gives the probability of the current class with respect to others.

    Example of Softmax function

    Mathematically, the equation looks like this

    Equation of Softmax function

    Implementation in Keras is given below


    The whole notebook containing all codes used above

    Google Colaboratory

    If you wanna contact me , lets connect on LinkedIn link below


    Types of Activation Functions in Deep Learning explained with Keras was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Types of Loss Functions in Deep Learning explained with Keras.

    Loss functions are what make ANN (Artificial Neural Network) understand what is going wrong and how to get to that golden accuracy range, just like loss makes you cherish the profit and identify what went wrong.

    Cause profit will come after right?.. RIGHT??

    Now coming to the mathematical definition of the loss function, it is used to measure the inconsistency between the predicted value (^y) and the actual label (y). It is a non-negative value, where the robustness of the model increases along with the decrease of the value of the loss function.

    It’s straightforward actually, it’s basically how well your algorithm models the dataset, if its prediction is totally off, your loss function will output a higher number. If it is pretty good, it will output a lower number.

    In this article, they are divided into three types

    1. Classification Losses
    2. Regression Losses
    3. Model Specific Losses

    Let’s discuss them in-depth,

    Classification Losses

    In this, there are again various categories,

    Binary Cross Entropy Loss / Log Loss

    This loss function is mainly used in the training of a binary classifier, it compares each of the predicted probabilities to the actual class output which can be either 0 or 1.

    It then calculates the score that penalizes the probabilities based on the distance from the expected value.

    The mathematics behind it is discussed below,

    That means how close or far from the actual value.

    Equation of Log Loss

    Here, pi is the probability of class 1, and (1-pi) is the probability of class 0.

    When the observation belongs to class 1 the first part of the formula becomes active and the second part vanishes and vice versa in the case observation’s actual class are 0.

    Implementation in Keras is shown below


    Hinge Loss

    It is used for classification problems and an alternative to cross — entropy, being primarily developed for support vector machines (SVM), difference between the hinge loss and the cross entropy loss is that the former arises from trying to maximize the margin between our decision boundary and data points.

    Mathematically the equation is shown below,

    Equation of Hinge Loss

    Implementation in Keras is below,


    Categorical Cross Entropy

    It is a SoftMax activation plus a Cross-Entropy loss. If we use this loss, we will train an image classifier using CNN to predict for each class present for example which bird class a bird image classifier belongs to .

    It is used for multi-class classification.

    Since activation functions are not discussed in this article and if you don’t know about it I i got you covered I have one more article covering activation functions in Deep Learning using Keras link to the same is below…

    Types of Activation Functions in Deep Learning explained with Keras

    Mathematically, the formula is shown below

    Categorical Cross-Entropy Loss Equation

    Implementation in Keras is shown below,


    Sparse Categorical Cross Entropy Loss

    Sparse CCEL(Categorical Cross Entropy Loss) and CCEL both compute categorical cross — entropy, the only difference being how the targets/labels should be encoded.

    When using Sparse Categorical Cross entropy the targets are represented by the index of the category (starting from 0).

    Your outputs have a shape of 4×2, which means you have two categories. Therefore, the targets should be a 4 dimensional vector with entries that are either 0 or 1. This is in contrast to Categorical Cross entropy where the labels should be one-hot encoded.

    Mathematically, the equation is

    Equation of Sparse Cross Entropy Loss

    When to use which,

    When to use categorical cross entropy and when to use sparse

    Implementation in Keras is shown below,


    Kullback — Leibler Divergence Loss

    Simply put, it is the measure of how a probability distribution differs from another probability distribution.

    Mathematically, it can be explained using

    KL divergence between two distributions P and Q.

    Equation of Kullback — Leibler

    The “||” operator indicates “divergence” or Ps divergence from Q.

    KL divergence can be calculated as the negative sum of the probability of each event in P multiplied by the log of the likelihood of the event in Q over the probability of the event in P.

    Diversion for a given event

    Implementation in Keras is as follow,


    Regression Losses

    In this, there are again various categories,

    MSE ( Mean Square Error / Quadratic Loss / L2 Loss)

    It is the average squared difference between observed and predicted values. e.g. in Linear Regression, we find lines that best describe the provided data points. Many lines can describe data points but which line to choose which best describes it can be found using MSE.

    In below Diagram , predicted values are on the lines and actual values are shown by small circles.

    Diagram showing Linear Regression

    Error is the distance between data point and fitted line.

    Mathematically, it can be stated as

    Equation for Mean Square Error

    Implementation in Keras is shown below,


    Mean Absolute Error / L1 Loss

    Now we move on to Absolute values no messing around, all round up now!

    It computes the mean of squares of errors between labeled data and predicted data. It calculates the absolute difference between the current output and the expected output divided by the number of output.

    Unlike Mean Squared Error , its not sensitive towards outliers.

    Mathematically , it can be written as

    Equation for Mean Square Error

    As seen in the formula modules is added giving only the absolute values for the error.

    Implementation in Keras is shown below,


    Huber Loss / Smooth Mean

    The best of both of worlds, iOS & Android both phones together? Nah..

    Its Huber Loss function , it combines MSE and MAE ,if loss value is greater than delta use MAE, if less use MSE.

    Mathematically , it can be written as

    Equation of Huber Loss
    Comparision of Hubber (green ) , MAE (red) and MSE (blue)

    Implementation in Keras is below


    Now coming to Model Specific Losses they are mentioned with models in which they are used below,

    MinMax (GAN Loss)

    Generative Adversarial Networks uses this particular Loss and its a simple one ( that’s what they say).

    Before this loss a little insight on GAN is needed so lets describe it in summary below

    • Two Neural Networks are involved.
    • One of the networks, the Generator, starts off with a random data distribution and tries to replicate a particular type of distribution.
    • The other network, the Discriminator, through subsequent training, gets better at classifying a forged distribution from a real one.
    • Both of these networks play a min-max game where one is trying to outsmart the other.

    Now coming back to min-max loss, mathematically its equation is

    Equation of Min — Max Loss

    The generator tries to minimize this function while the discriminator tries to maximize it and it saturates for the generator, making it stop training it is behind discriminator …sad generator noises….

    This can be further categorized into two parts 1) Discriminator Loss and 2) Generator Loss

    Discriminator Loss

    Discriminator train by classifies both the real data and the fake data from the generator.

    It penalizes itself for misclassifying a real instance as fake, or a fake instance (created by the generator) as real, by maximizing the below mentioned function.

    Equation for Discriminator Loss
    • log(D(x)) refers to the probability that the generator is rightly classifying the real image,
    • maximizing log(1-D(G(z))) would help it to correctly label the fake image that comes from the generator.

    Generator Loss

    While the generator is trained, it samples random noise and produces an output from that noise. The output then goes through the discriminator and gets classified as either “Real” or “Fake” based on the ability of the discriminator to tell one from the other.

    The generator loss is then calculated from the discriminator’s classification — it gets rewarded if it successfully fools the discriminator, and gets penalized otherwise.

    The following equation is minimized to training the generator,

    Minimized to train the generator

    This whole implementation of a Deep GAN Network along with loss in mentioned below as the loss is defined with respect to the model whole implementation needs to be referred.

    docs/dcgan.ipynb at master · tensorflow/docs

    Focal Loss (Object Detection)

    It is extension of cross entropy loss function and it down-weight easy examples and focus training on hard negatives.

    Focal loss applies a modulating term to the cross entropy loss in order to focus learning on hard misclassified examples. It is a dynamically scaled cross entropy loss, where the scaling factor decays to zero as confidence in the correct class increases.

    Mathematics coming right up,

    Focal Loss Equation

    Focal Loss adds a factor (1−pt)^γ to the standard cross entropy criterion. Setting γ>0 reduces the relative loss for well-classified examples (pt>.5), putting more focus on hard, misclassified examples. Here there is tunable focusing parameter γ≥0.

    Implementation in Keras is shown below,

    Output of the loss function above

    The whole notebook with each losses implemented is mentioned below,

    Google Colaboratory


    If you liked this article and want to read more like it , you can visit my medium profile and if you wish to connect here is my LinkedIn profile


    Types of Loss Functions in Deep Learning explained with Keras. was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Chatbot Conference in the Metaverse

    November 15–17 in Zoom Events & Decentraland

    Chatbot Conference 2022

    We have very exciting news!

    The next Chatbot & Conversational AI Conference this November 15–17, 2022. This year’s event will be held on Zoom Events and in the Metaverse so that you can attend remotely from anywhere in the world!

    The event will take you from Learning to Designing to Building a Conversation AI Agent during our 3-day event!

    By the end of the event, you’ll have a Conversation AI Agent that you can share with your team or implement in your business, and you’ll get Certified!

    Now let’s jump into the Agenda.

    Zoom Events & the Metaverse

    This year’s event will be held in ZOOM and Decentraland.


    Why the Metaverse?

    Conversational AI is already in the Metaverse. Inworld recently raised $50 Million for their platform, which creates AI-Powered Virtual Characters.

    These characters can be used in games, in the metaverse, and online as brand ambassadors.

    And yes, their co-founder, Kylan Gibbs, is also our Keynote Speaker!


    Our goal was to give you a sneak peek experience of what will be like when Conversational AI, Web3.0, NFTs, and the Metaverse begin merging.

    So, we created such an experience!

    AI Bots in the Metaverses: This BOT will live in the Metaverse in Decentraland and attend our Conference. It solves one of the significant challenges of hosting events online: the social aspect of introducing people to each other.

    This bot will use your Personality NFT to make high-quality intros!

    Check out the Demo Here: https://play.decentraland.org/?position=5%2C118&

    Killer Agenda

    Our agenda is well thought out with you in mind. We start the day with the big picture of where the Conversational AI industry is now and where it is going.

    The morning sessions feature Kylan Gibbs, co-founder & Chief Product Officer @ Inworld, who just raised $ 50 Million for creating AI-powered Digital Humans!

    Morning Agenda: November 15, 2022

    The Afternoon Sessions are where the rubber hits the road. We will do deep dives in areas of opportunity and look at execution.

    The Afternoon has 3 Tracks.

    • Industry Track: Sessions in Finance, Banking, HR, Hospitality, Customer Centers, &
    • Execution Track: Design, Context, and NLU
    • Live Podcast: Interviews and Q&A

    Afternoon Agenda: November 15, 20

    Certified Workshop in Conversational UX & NLU

    Day 2: November 16, 2022 | Certified Conversational UX Workshop

    CDI will do a live workshop via Zoom. In this workshop, you will learn how to design a Conversational AI agent by learning the most useful design frameworks.

    This is a hands-on workshop where you will apply your learning to your project.

    By the end of the workshop, you’ll be able to earn a Certificate.

    Day 3: November 17, 2022 | Certified AI Workshop

    On Day 3 we will give your bot life….

    Botcopy will share its latest framework for creating a create NLU system that leverages data and eliminates waste. This is a dramatic shift in how NLU systems are currently built and instead leverages a lean and intelligent building approach.

    So what is the approach? And what will you learn?

    First, you will learn all the Dialogflow basics for creating a Conversational AI Agent, such as intents, entities, context, fall back loops, etc.

    Second, you will learn the latest building framework which is a combination of very smart onboarding, fallback loops, and data gathering which creates a system for creating the correct FAQs in the proper manner without guesswork!

    This is a hands-on, full-day workshop where you will apply put together this framework!

    By the end of the workshop, you’ll be able to earn a Certificate.

    Join us Today

    If you haven’t reserved your spot, hit the link below and join us in November!

    Chatbot Conference in the Metaverse was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Building the Metaverse With Open Source — Bot Libre Metaverse

    Building the Metaverse With Open Source — Bot Libre Metaverse

    The virtual experiences that are promised from the metaverse will make several ordinary experiences more captivating and more inclusive as more persons have access regardless of distance and even time. Students, teachers, co-workers, family, friends, romantic partners and even strangers getting to know each other can find deep connection, productivity and success from the metaverse.

    It’s clear that people already understand the immense value of web3, in a recent Forbes Digital Assets article, “the market was worth $478.7 million in 2020, and experts expect it to grow to $800 billion in just four more years.”

    With such open enthusiasm, an open-source platform is the necessary engine that will drive the growth of the metaverse. By using open source to create the metaverse, it is possible to advance initiatives supporting the creation of decentralized, distributed, and interoperable virtual worlds.

    Fortunately, as shared by opensource.com, all of this is accomplished utilizing just already-available, industry-standard web technologies, as well as open-source software and content. So, while each creator will customize their virtual world, the development concepts remain the same.

    Through Bot Libre, you already have access to and can download all the tools and material you need to start building the metaverse. The Bot Libre platform enables influencers, gamers, and businesses to engage the Metaverse by integrating true artificial intelligence and chatbots. Bot Libre bots can interact with users and navigate 3D spaces, Bot Libre provides an extensive API, integrations, and SDKs for popular 3D platforms.

    Bot Libre is making significant strides. Through our Mozilla Hubs integration users can create their own private 3D virtual spaces. These spaces can be used for events like conferences, virtual storefronts and online classes. By adding a Bot Libre chatbot to your 3D space, you will provide ease of access to all attendees and prevent any customer from being overlooked.


    Also, Bot Libre’s OMNI AI model combines vision deep learning models with NLP deep learning models to provide multiple senses, integrated learning, awareness and navigation in the Metaverse. This will allow businesses to be functional and fully engaged with users in the Metaverse .With these models, users can explore a variety of different locations to chat with Bot Libre’s chatbots and bots can walk around different 3D spaces following or guiding users through the space. With Bot Libre’s AI algorithms, the chatbot’s avatars can avoid obstacles and find the shortest path to locations and objects.

    Metaverse Solutions – Vision & NLP AI

    BUT WAIT …It gets better

    Bot Libre is now providing early access to unique metaverse solutions through our Beta Program.

    We are looking for businesses, organizations, and developers that are interested in being early adopters of the Metaverse technologies, in order to shape, play, participate, and even profit from the Metaverse, by working with us to drive our open source metaverse AI solution. If you are interested in applying to be part of the program please contact sales@botlibre.biz .

    Learned something? Please give us a

    to say thanks and to help others find this article

    Building the Metaverse With Open Source — Bot Libre Metaverse was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

Got any book recommendations?