Exploring New Techs!

  • We here at Technotizers are Engineering students, curious technology learners and try to share our knowledge with everyone. Connecting technology with daily life and engaging more and more students into it is our goal. For contribution in articles, do contact us.

  • We here at Technotizers are Engineering students, curious technology learners and try to share our knowledge with everyone. Connecting technology with daily life and engaging more and more students into it is our goal. For contribution in articles, do contact us.

  • We here at Technotizers are Engineering students, curious technology learners and try to share our knowledge with everyone. Connecting technology with daily life and engaging more and more students into it is our goal. For contribution in articles, do contact us.

Movie Recommendation System with GUI

 


Hello Technotizers, this article will present to you a simple Movie Recommendation System with GUI developed with Python.

Everybody loves watching movies irrespective of age, gender or geographical location. People from different location get connected to each other via this amazing medium. Yet what’s the most astonishing is the fact that how unique our choices are in terms of movie preferences. Some people like movies according to genres like action, romance, sci-fi, etc. whereas some people prefer to watch movies of their favorite actors and directors. Hence considering all this, it is really very difficult to predict whether a certain movie will be liked by everyone or not. But on that note, it is still observed that similar movies are liked by a specific part of the society.

So this is where data scientists come into play by extracting all the behavioral patterns of not only the users but also form the movies itself. Now let’s let’s jump right into the basics of a recommendation system.

·         What is a Recommendation System?

In simple words, a Recommendation System’s goal is to go through a filtering process and extract patterns of user preferences and various products and services to recommend similar products and services to the users. This is observed quite often nowadays through various social media sites or shopping sites. Search for a mobile phone and these sites will recommend to you various mobiles and related products for almost 1-2 weeks. Watch an action movie once and Netflix will be notifying you for watching other similar action movies. There are many advantages and applications of a Recommendation system and they are used insistently by all the companies to recommend their products and services.

·         What are the different filtration strategies?


  • Content-based Filtering

This filtration strategy is based on the data provided about the product and services. The algorithm is designed to recommend products that are similar to the ones that a user has liked previously. This similarity that is generally cosine similarity (a mathematical technique) is analyzed from the data available about the products and services as well as the user’s past preferences.

For example, if a user likes movies such as ‘Joker’ then we can recommend him the movies of ‘Joaquin  Phoenix ’ or movies with the genre ‘Thriller’ or maybe even movies directed by ‘Todd Phillips’. So what exactly happens here the recommendation system checks the previous preferences or searches of the user and finds the film “Joker”, then tries to find similar movies to that using the information available in the database such as the movie cast, the director, genre of the film, production house, etc. and based on this information find movies similar to “Joker” like ‘American Psycho’ and ‘Entertainment’.

Disadvantages

    1. Different products cannot be much exposed to the user.
    2. Businesses and companies cannot be expanded as the user does not try different types of products as inly similar products are recommended.

 

  • Collaborative Filtering

This filtering strategy relies on the combination of user behavior and comparison and contrast with the behavior of other users in the database. Every user's history plays an important role in this algorithm. The primary difference between content-based filtering and collaborative filtering as in the latter, the interaction of all users with the elements affects the recommendation algorithm, while for content-based filtering only the data of the user concerned is taken into consideration. There are multiple approaches to implementing collaborative screening. but the main concept to capture is that the collaborative filtering of multiple users' data influences the result of the recommendation and is not dependent on any single user's data for modeling purposes.

 

·         This is a basic movie recommendation system build with python which suggests movies based on the movie given by user.

·         Libraries used:

It uses python libraries like pandas, numpy, Tkinter and some modules from sklearn.

Pandas: Pandas is a software library written for the Python programming language for data manipulation and analysis. In particular, it offers data structures and operations for manipulating numerical tables and time series. 

Numpy: NumPy is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays.

Tkinter: Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit, and is Python's de facto standard GUI. Tkinter is included with standard Linux, Microsoft Windows and Mac OS X installs of Python. The name Tkinter comes from Tk interface.

Sklearn: Scikit-learn is a free software machine learning library for the Python programming language.  It features various classificationregression and clustering algorithms including support vector machinesrandom forestsgradient boostingk-means and DBSCAN, and is designed to interoperate with the Python numerical and scientific libraries NumPy and SciPy.

This project is a content based recommender which uses the “movie.csv” data file to recommend related movies. Features like cast, genres and director are included in it and movies are recommended based on these features. This dataset exclusively covers Bollywood movies but can be used for any data set by setting the features as wanted.

 

CountVectorizer method from sklearn is used to transform the text in combined features into a vector on the basis of the frequency (count) of each word that occurs in the entire text. In order to use textual data for predictive modeling, the text must be parsed to remove certain words – this process is called tokenization. These words need to then be encoded as integers, or floating-point values, for use as inputs in machine learning algorithms. This process is called feature extraction (or vectorization).

Scikit-learn’s CountVectorizer is used to convert a collection of text documents to a vector of term/token counts. It also enables the ​pre-processing of text data prior to generating the vector representation. This functionality makes it a highly flexible feature representation module for text.

Cosine similarity measures the similarity between two movies based on the matrix produced by the CountVectorizer. Cosine similarity measures the similarity between two vectors of an inner product space. It is measured by the cosine of the angle between two vectors and determines whether two vectors are pointing in roughly the same direction. It is often used to measure document similarity in text analysis. Cosine similarity is a metric used to determine how similar two entities are irrespective of their size. When we say two vectors, they could be two product descriptions, two titles of articles or simply two arrays of words.

 

The GUI is created using Tkinter which accepts user input and displays the result.

An example of the implementation and its output is given below.



With this we come to an end of this article. Hope it was helpful. Do provide your feedback and ideas through comments, it would be highly appreciated. See you soon!

Keep coding and exploring new techs!!

 

 

NLP and ANN Based College Enquiry Chat-bot



Hello Technotizers, this article is focusing on providing some information about a Machine Learning based project which is NLP and ANN Based College Enquiry Chat-bot. in the previous article we had seen a basic chat-bot which had certain limitations. Some of those limitations  have been overcome in this project. Do read the previous article if you have missed it out. AIML Based College Enquiry Chat-bot

Note: This project is only for education purpose and does not aim to promote any institution whatsoever.

1.     Introduction

This project is focusing on creating a simple chat-bot to be used by students to get information about the college without visiting the college website or actual college. A chat-bot is a program which can do real conversations with textual and/or auditory methods. Using Artificial Intelligence (AI), chat-bots can simulate human conversations. There are two categories of chat-bots. One category is command based chat-bots where chat-bots rely on a databank of replies. The user must be very specific while asking the questions so that the bot can answer. Hence, these bots can answer limited set of questions and cannot perform function outside of the code. The other category is chat-bots based on AI or machine learning algorithms, these bots can answer ambiguous questions which means the user do not have to be specific while asking questions. Thus, these bots create replies for the user’s queries using Natural Language Processing (NLP). Making a AI based chat-bot s a tedious job and is difficult to understand the process as compared to a databank based chat-bot. Our project develops a NLP chat-bot as a part of learning to create basic chat-bots. It focuses on giving specific information about the college.


Figure 1: How a Chat-bot Works

Figure 1 shows how a chat-bot works. Whenever a user asks any query, the bot will first analyse the request, then identifies intents and entities, builds a response andsends it back to the user. Now, intents mean intention of the query and entity means details of that query. For example, if a student wants to know the fees of a course then the intent will be fees and entity will be name of the course in this case.

2.     Motivation

Chat-bots are motivated by the need of traditional websites to provide a chat facility where a bot is required to be able to chat with user and solve queries. When live agent can handle only two to three operations at a time, chat-bots can operate without an upper limit which really scales up the operations. Also, if any school or business is receiving lots of queries, having a chat-bot on a website takes off the load from support team. Having a chat-bot clearly improves the response rate compared to human support team. In addition, since millennial prefer live chats over a phone call, they find a chat-bot, which provide a highly interactive marketing platform, very attractive. Furthermore, a chat-bot can automate the repetitive tasks. There can be some scenarios where a business or school receives same queries in a day for many times and support team must respond to each query repetitively. Lastly, the most important advantage of having a chat-bot is that it is available 24/7. No matter what time it is, a user can get a query solved. All these advantages of a chat-bot constitute the motivation to implement a College Enquiry Chat-bot.

Before implementing College Enquiry Chat-bot, various existing chat-bots were reviewed such as Amazon Shopping App, YONO SBI chat-bot, Alexa, etc. In order to understand the requirement of a chat-bot, consider an example of Amazon Shopping App. In this app, when a customer buys an item, he/she does not have any information about how to return the item. To get this information, the customer must call and wait to talk to customer representative for a long time. However, this whole process is tedious for a customer. Hence, Amazon created a chat-bot to answer simple queries of customers. Similarly, the College Enquiry Chat-bot is designed to help students to get information on a fingertips.

3.    Objectives:

  •       With the help of Chat-Bot a student need not have to be physically present in college office for the enquiry and thus gaps the bridge between administration and the students.
  •   Helping students to get basic information about the college.
  •       Creating an easy to use chat-bot for both staff and students which requires user to enter any option provided by the chat-bot.
  •       Students opting for admission in the college can have quick information about the college using this chat-bot.

4.     Limitations of existing system:

  • ·             Time consuming and hectic
  • ·             Needs personal attendance
  • ·             Isn’t available 24/7
  • The existing system is not only tedious but also makes a gap between administration and students. Surfing the website for small information can be irritating sometimes. It is rather better to just enter your query and get information on your fingertip. Now-a -days there are many changes that occurred in the Education system with help of advanced technological improvements. Everything is happening over the internet without any difficulty. In previous days for submitting a small application we had to visit that place, but as the days are passing away it’s completely changing. Collecting the applications manually will be hectic procedure and it also needs a lot of manpower. For reducing that manpower and such difficulties many devices or systems were emerged day by day. One of them is a chat-bot which serves as an efficient communication tool between system and users. Chat-bot bridges the gap between traditional enquiry means and users that are particular about time.

5.   Implemented Technique

 

A College enquiry chat-bot project is built using artificial algorithms that analyses user’s queries and understand user’s message. This System is a web application which provides answer to the query of the student. Students just have to query through the bot which is used for chatting. Students can chat just like we do on normal messaging without keeping in mind about case sensitivity. The System uses built in artificial intelligence to answer the query. If the answer found to be invalid, the admin will correct and update the incorrect answer. Admin can view and update the information at any time. System allows admin to delete the invalid answer or to add a specific answer of that equivalent question.

The User can query any college related activities through the system. The user does not have to personally go to the college for enquiry. The System analyses the question and then answers to the user. The system answers to the query as if it is answered by the person. With the help of artificial intelligence, the system answers the query asked by the students. The system replies using an effective Graphical user interface which implies that as if a real person is talking to the user. The user can query about the college related activities through online with the help of this web application. This system helps the student to be updated about the college activities.


6.    Architecture/ Framework

 

System Architecture:



Figure 2: System Architecture


According to the architectural diagram of College Enquiry Chat-Bot System, there are 6 modules which are explained as follows accordingly:

1.  Data (JSON File) – This is the main data file which is programmed in JSON language.

2. Manage – In this module the admin performs the various tasks to fetch into the data various college information requirements like placement sheet, department information, timetable, etc. All this fetched information is then retrieved as a response to the user query accordingly. Admin only has the authority to manage data details.

3. User This module represents user entering into the system.

4. Chat – In this, User types the query and the bot replies to the user query accordingly. Actual Chatting occurs in this phase only.

5. Upload – In this section admin uploads the common/ general information like, faculty information, fee structures, event and seminar notices, etc. which user may query out during chatting phase. Information that is not available while chatting is uploaded.

6. Exit – This is the phase where user after finishing his work closes the system.


7.  Algorithm and process     design:

Algorithm

Step 1: START: IMPORT MODULES AND CREATE NLP OBJECT

Step 2: CREATE THE APP WITH FLASK

Step 3: IF: mymodel.h5 FILE EXISTS IN OS Load the file.

ELSE:

Run model_train.py

Step 4: DEFINE NECESSARY FUNCTIONS FOR EXTRACTING RESULTS

Step 5: GET TEMPLATE FILE

Step 6: GET REQUEST FROM USER AND STORE IN THE VARIABLE USERTEXT.

IF: RESPONSE IS AVAILABLE IN BRAIN FILE

PRINT response ELSE:

PRINT Alternative statement

Step 7: STOP


Process Design


 

Figure 3: Process Design


1.     User adds a query to the chat-bot through the interface.

2.     The main python program extracts the data from the brain file.

3.     The system matches the query with the intents and checks for availability of response in the data.

4.     If response for the query is available it is extracted and passed on to the chat-bot interface with prints the response for the user.

5.     If response is not available then user is asked to visit the website and information is uploaded in the data by the admin.

6.     Brain  file   learns  information  from   various  JSON   files   that  store information like fees, faculty, academics, infrastructure, etc.


Figure 4: Use case diagram

 

The above diagram shows the functions of the user and the admin.

The user can only chat with the chat-bot, whereas the admin can add information, view information, update information and delete information.



8.     Details of hardware &  software

HARDWARE REQUIREMENTS

  • Processor: Intel(R) Core(TM)i3-6100U CPU @2.30Ghz 2.30Ghz Installed.
  • RAM: 4.00GB
  • System Type: 64-bit operating system,x64-based processor.


SOFTWARE REQUIREMENTS

      Python 3.8 (nltk, numpy, flask, pickle, tensorflow, spacy)

      JSON

      HTML

      Any browser


9.     Experiment and Results

1.      Running the program




The main python program runs on the command prompt.

This generates an address which indicates the running address of the chat-bot.


2.    Getting the interface



  • When the generated address is opened in a browser, we come to the main interface of the chat-bot.
  • It is designed for an ease of communication.
  • The user is first greeted with a message, after that the user can chat on this interface.


3.      Trying the chat-bot



  • ·   Here when we enter Computer HOD we get the name of the HOD and also a link to know more about Computer HOD.


 


  • ·  Next, College is entered and we get the college address. Google map link is also provided.


10.   Conclusion and  future work

To conclude, College Enquiry Chat-bot is helpful in guiding students with correct and most up to date sources of information. We can conclude from the above situation that greater the data and more the models and use cases, the better is the reaction produced for the user. It is advantageous for international applicants for queries such as fee payment and academic matters. The system is also not case sensitive which means the user can easily search for query. User can also try a lot of phrases for the same query and still get the correct answer. To improve the current functionalities of College Enquiry Chat-bot, in the future, the scope of the chat-bot can be increased by inserting data for all the departments, training the bot with varied data, testing it on live website, and based on that feedback inserting more training data to the bot. Some of the new features which can be added to the bot are Speech recognition, Integration with multiple channels such as phone call, SMS, Skype, Facebook and Twitter, Integration with services such as password reset and course enrolment and Adding sentiment analysis.

With this we come to an end of this article. Hope it was helpful. Do provide your feedback and ideas through comments, it would be highly appreciated. See you soon!
Keep coding and exploring new techs!!