Creating a mental health resource chatbot with a deep neural network.

You: Hey Serenity, how are you? Serenity: Good Alisha! How can I help you? You: I want to learn more about Schizophrenia, what is Schizophrenia? Serenity: Schizophrenia is a serious psychiatric disorder characterized by the person slowly losing contact with reality, often experiencing delusions or hallucinations. You: I know someone who has Schizophrenia, what can I do to support them? Serenity: Here are some tips Alisha; Maintain a low-stress environment, Use language that is positive and supportive instead of critical, Have one person speak at a time and keep voices down.

The Basics

NLP

Deep Learning

Building a mental health educational chatbot

Step 1: Initializing Chatbot Training

Step 2: Building the Deep Learning Model

import tensorflow as tf  
from tensorflow.python.framework import ops
ops.reset_default_graph()
net = tflearn.input_data(shape=[None, len(training[0])])
net = tflearn.fully_connected(net, 8)
net = tflearn.fully_connected(net, 8)
net = tflearn.fully_connected(net, len(output[0]), activation='softmax')
net = tflearn.regression(net)
model = tflearn.DNN(net)
try:
model.load('model.tflearn')
except:
model.fit(training, output, n_epoch=1000, batch_size=8, show_metric=True)
model.save('model.tflearn')

Step 3: Building the Chatbot

def chat():
print("Start talking with the bot(type quit to stop)!")
while True:
inp = input('You:')
if inp.lower() == 'quit':
break
results = model.predict([bag_of_words(inp, words)])
results_index = numpy.argmaz(results)
tag = labels[results_index]
for tg in data ["intents"]
if tg ['tag'] == tag:
responses = tg['responses']
print(random.choice(responses))
chat()

Results

You: Hi Serentiy  
Serenity: Hi Alisha, how can I help you?
You: What are some symptoms of depression?
Serenity: Here are some symptoms of depression: Hopeless outlook, Lost interest, Increased fatigue, Suicidal thoughts, and Anxiety
You: What italian restaurants should I try in Toronto?
Serenity: Unfortunately, I do not have an answer for that.

The Future

--

--

--

15 yo futurist, change maker and innovator at The Knowledge Society.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Future of Work in Healthcare

METAVERSE — A Futuristic Technology Or A Passing Fad?

Will Robots Take Over Human Tasks In The Next 10 Years?

The age of AI in banking: reimagining financial decision making

Which Freelancers Will Be Replaced by AI?

Haste makes waste

4 reasons why Student Accommodation Websites should have a chatbot

March 2020: What’s new in the chatbot world?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alisha Arora

Alisha Arora

15 yo futurist, change maker and innovator at The Knowledge Society.

More from Medium

Build a Sign Language Image Classifier with me!

Image Caption Generation

AI/ML continues to dominate Emerging Tech

Breaking news:ML can help detect fake news and this isn’t fake news 😉