Choose Payment Option
Pay at store or pay when you receive the items.
Tutorial on building your own intelligent conversation agents using Python
Lucy API is a Python API for building smart conversation agent. It allows companies to handle messages sent to their chat channels automatically. Â
This tutorial is to help you install and configure necessary packages for Python for the data mining class. Contact me (inssong@gmail.com) if you have any questions following the steps to prepare for your assignments.
Overview of the installation of Lucy API:
Video tutorial. (If the video does not playback properly, please try out Google Chrome.).
First, download and install Python 2.7Â (install 32-bit version) on your computer.
Next, download and install PyCharm IDE from JetBrains. It is free for students. Make sure to sign up for the free student license.
Now, let's install some basic packages for data mining.
Numpy package is often required for various data mining modules. However, installation is a bit tricky because you need to install suitable binary files for your OS.
SciPy package provides useful tools for scientific computing and plotting. Installation is similar to Numpy.
Matplotlib is a convenient tool if you need to plot anything. This is optional, so install it if you need.
scikit-learn is a Python machine learning package with excellent documentation in learning data mining algorithms.
NLTK is a natural language processing package for Python
Now, we have the necessary tools installed, let's test if the tools are correctly installed. Open PyCharm, create a new Python project and add a python file.
# Numpy test
import numpy as np
parray = [1.2, 2, 2]  # this is python array
C = np.array(parray) Â # a matrix, a vector
print C*2 + 10  # Matlab like matrix operation
Run the Python script in Pycharm (type Shift+Ctrl+F10 in the editor).
Try a classification example from scikit-learn.
KOPO MES allows users to create their own journeys and chapters for the journeys. A chapter is a personalized chat channel for students. We can use Python to handle messages sent by students for the chapters.
Now, we need to get the ID of the chapter. We can get this from the chapter list page of the journey. Click on the column icon on the top-left of the table and check ID to show IDs of the chapters. We need this ID to identify chapters in the Python program. Video tutorial.
Now, create another account for your Lucy Agent Bot and share the chapter with the Lucy Agent bot using the email address of the bot. ** Make sure to give Edit permission.
Follow the following steps to download, configure and run the Lucy Bot agent on your computer.
Try a demo of Lucy Bot on "Lucy Bot Echo Demo" of this journey. If the bot is running, it will echo back your messages.
We can now run our very own conversation agent. Just add more intelligent message handlers using machine learning algorithms. Note: the account for Lucy Agent must have an edit right for the chapter to read and reply to the messages for the chapter.
Video tutorial on running Lucy conversation agent.
Let's build a classifier that can predict if a sentence is an open question or a closed question.
Although this sounds a trivial task, you will soon find out that that not the case. The number of possible sentences in the world can be too many. We ourselves can classify sentences fairly easily because we have been trained on it for over 10 or 20 years. However, we cannot wait 10 years for our program to learn to classify sentences.
See lucy_predict.py that uses an SVM classifier to predict whether a sentence is an open question or not.
It uses the provided vocabulary to convert a sentence to a set of features, which are then used to predict if the sentence is an open question.
What if we do not know what kind of messages are sent from users. Certainly, there are many more types of sentences other than questions and statements. Instead of listing all sentence types, we can cluster messages and use the clusters as class labels and handle messages accordingly.
Build your database of messages and cluster the messages using a clustering algorithm.
To call LucyAPI services from a web application (e.g., HTML5 application), you will need to fix "Access-Control-Allow-Origin' error. On Google Chrome, you can install a plugin to solve this problem.
Now, think about what else can you do to make the conversation agent helpful for students?
Pillow (Python Imaging Library. This is a replacement of PIL. Do not install PIL): python -m pip install pillow
Word Cloud: python -m pip install wordcloud
The following trainers are available for hire for your organizations:
Please contact Dr. Insu Song (inssong@gmail.com) if you would like to arrange training sessions with our experts.
Other useful links for your data mining carrier.
LAPACK (Linear Algebra Package): http://netlib.org/lapack/lug/lapack_lug.html
HPC Challenge Benchmarks:Â http://icl.cs.utk.edu/hpcc/
Top 500 Super Computers:Â http://www.top500.org/
Using Python in Hadoop: http://www.michael-noll.com/tutorials/writing-an-hadoop-mapreduce-program-in-python/
NLTK for Python (Natural Language Processing): http://www.nltk.org/book/
Using R on Hadoop: http://hortonworks.com/hadoop-tutorial/using-rhadoop-to-predict-visitors-amount/Â
Name | Comments | Date |
---|