Introduction to Fuzzy logic, Fuzzy & Crisp sets

                            Introduction to Fuzzy Logic, Fuzzy and Crisp Sets

                                                               Fuzzy Logic

Fuzzy Logic deals with the degree of truth instead of giving exact true or false as the answer.

For better understanding in simple language, let’s discuss an example here.

There is a pear and there are two sets:

  • Set of pears
  • Set of pear cores

Now, take a bite of the pear. It will still belong to the set of pears, Right?

Just keep taking the bites and you will reach a point when just a single bite will be left, and after that, the pear will get into the set of pear cores.

Now, the area between both the sets is not clearly defined since the object can not belong to both sets. Now, consider these two sets as fuzzy sets.

                                                Fuzzy Logic Concept

Fuzzy sets provide a degree of membership to each of its member. Take ‘1’ as belonging to the set and ‘0’ as outside the set and object belonging partially to the set will have a degree between 0 to 1.

Hence, when one will take the first bite of pear, then it’s degree of membership will get changed from 1 to 0.9 and furthermore, after another bite it gets converted in 0.8 and then 0.7 and so on up to that 0.1, after which it will no longer belong to the set of pears and will get into the set of pear cores.

The number (from 0 to 1) which is assigned to the object is called the degree of membership.

                                                                       Fuzzy Sets

 In terms of Mathematics, a set is basically a collection of items.

Let’s take an example here:

As the age for giving vote is 18 years, so we have to figure out the people who are eligible for voting and who will be eligible to vote next year for 2019 elections.

For this, the people aged equal or more than 18 will pass the criteria, but people below 18 will not be considered. Even the one with 17 years of age will be marked as ineligible, even though he will be 18 till the next year (coming elections time)


Hence, the fuzzy set comes into play.

It will give a degree of membership as 0.8 to people aged 16 and 0.9 to the people aged 17 years, so that we will get to know that they will be eligible for polling next year.


                                                                Crisp Sets

 Crisp sets are just like binary sets. It deals with true and false or 0 and 1.

I gives output direct as in or out, there is no in between.

Let’s discuss an example of a race here, according to crisp logic, a threshold will be decided, sat 0.5 and above this person will be considered as fast and below this, slow.

But in fuzzy sets, intermediate values can be discussed as fast, very fast, slow, medium.


                                                       Crisp Set VS Fuzzy Set           



         CRISP SET


         FUZZY SET

1. Crisp set deals with binary logic. Fuzzy sets can have intermediate values.
2. Values here will be exact like 0 or 1 (True or False) Values can lie between the interval of 0 and 1, like 0.4,0.6 etc.
3. It deals with boundary values, i.e certain answers. It’s having a concept of “degree of membership” and thus can deal with uncertain answers.
4. Example:  In a Race: A person can be marked as fast or slow. Example: Similarly in a Race: Marking can be done on the basis of Slow, Medium, Fast and Very Fast.




Get Started!

Hey my lovely readers,

I was bit occupied earlier and was not having something spicy to share with you all. Today, I get back to work again and will surely update some new and interesting things in coming days.

To embark with, I wanna share a link with you all which can help you in understanding JavaScript in a fun way. Go through this and try each task as I did and it will surely be a wonderful experience for you all if you will do justice with the work.

Even you can go through Hacktoberfest for getting some stickers and T-Shirt. It’s conducted in October every month.

That’s all but stay tuned .. 🙂


Django Poll App

Firstly What Django is?

Django is a free and open source web application framework, written in Python. A web framework is a set of components that helps you to develop websites faster and easier.

This is a perfect tutorial for getting started. Choose the tutorial as per the version of your django installed. One can go with the latest:

You can install it using:

sudo apt-get install python-django

I had followed the above link to make my django app. I used django version 1.7 and python 3+

Here I am going to discuss about some of my struggles in doing this work:

This app is basically that people can view poll and can vote in that. Admin can add, delete or change polls.

  • The first problem I faced was in below command: startproject mysite

    This command is for starting a new project. Later on it’s solved by removing .py from above command. As in ubuntu there is django-admin.

  • django-admin is Django’s command-line utility for administrative tasks.
  • In mysite/, you need to edit as per your database. I had used Mysql so I replaced:

    ‘default’: {
        ‘ENGINE’: ‘django.db.backends.sqlite3’,
        ‘NAME’: os.path.join(BASE_DIR, ‘db.sqlite3’),

which is of Sqlite with mysql:

    ‘default’: {
        ‘ENGINE’: ‘django.db.backends.mysql’,
        ‘NAME’: ‘database name’,
        ‘USER’: ‘root’,
        ‘PASSWORD’: ‘**’,
        ‘HOST’: ‘localhost’,


  • I was getting an error when I gave this command:
python migrate

Error: pymysql not found

Then I installed: sudo apt-get install python-pip

pip install pymysql

  • One more error I was getting that mysql can not be connected to localhost. I had given some random port address in file after HOST. Then I deleted that line.

Till this point I am done with Django Welcome Page.

Its just a discussion that after that you will see a make migration command. By running makemigrations, you’re telling Django that you’ve made some changes to your models. This reminds me of Commit and push commands of git which finally pushes the changes to the rmeote repository.

Now lets play with API provided by Django,

  • It was silly but I got Indentation Error due to space between >>> and my text.
  • Its good to set different port number if you are working on a server

python runserver 8100

Basically you are working separately in API, admin and user content.

Part-2 :


It’s all about creating an admin page and setting a GUI for managing Question, Choices etc.



Here comes the section for polls.



Happy Valentine’s day

Love? What is it? It can be affection between two persons, trust on a friend, respect for your elders and what not!

Well said: Love is in the air. ❤

Today was really memorable for me. I went to an orphanage home (I met little wonders over there). That feeling of dancing with them, singing for them was just magical 🙂

It was beyond perfection. I have visited such place first time in my life and was just mesmerized in that moment. I was so happy by seeing a smile on their faces. Those twinkle eyes were just priceless. They all took my heart.

Taare Zameen par :))
Jaise Rango Bhari Peechkari…
Jaise Titliyan Phoolo Ki Pyari…
Jaise Bin Matlab Ka Pyara Rishta Ho Koi..  ^_^

P.S: A click from the day

“We make a ‘LIVING’ by what we get, and make a ‘LIFE’ by what we give” 🙂


A New Beginning

I was thinking to write down my thoughts from few days, finally got the chance today.

I absorbed many of the new things in this weekend. Starting with Design Aids Project (Mainly LaTeX), How to get started with a good Business Proposal, as my team had cleared the first phase of B-plan competition.

This exhilarates the spark in me to move further with some of the new tasks.

Apart from all above gossip :p

I converted a png image into a .txt file as I need it for LaTeX project.

Do refer OCR for seeing the steps.

Apart from this I completed Hacktoberfest  Challange too and got a mail from Digital Ocean for a new tee 😀

I worked upon improving Readme files, about Resume in LaTeX. A little bit about general information addition in the documentation regarding few topics.

Overall it was good spending time with GitHub :p 😉


But still, I found that last 2 weeks were not that much productive as it can be. So again on the track now after clearing all of the stuff in which I was indulged from few days.

.. 🙂 ..

Slog and Blog!

Today I tried setting an environment for computer graphics system so that output of c++ program can be seen from a terminal as well.

For this, I followed this link suggested by one of my friend (Gagan)

I was getting an error explained below after running the command

sudo apt-get install build-essentials


E: Encountered a section with no Package: header

E: Problem with MergeList /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_natty_main_binary-i386_Packages

E: The package lists or status file could not be parsed or opened.

For solving above I ran below two commands:

sudo rm -vf /var/lib/apt/lists/*

sudo apt-get update 

Apart from this my octave Ghost error also got solved. The problem was mainly related to broken packages in the installation of PPA packages and octave software.

Moreover, I got involved in Design Aiding project.

P.S: Music is LIFE (May be irrelevant here, but karo jo dil chahe :p ^_^ )

Time to be in Action!

Today was an ok day. One thing I did today is to get back to blogging :p

Firstly, I installed google chrome on ubuntu through terminal:

wget -q -O - | sudo apt-key add -

sudo sh -c 'echo "deb [arch=amd64] stable main" >> /etc/apt/sources.list.d/google.list'

sudo apt-get update

sudo apt-get install google-chrome-stable

Apart from this I got to know about Grammarly

Currently working upon flatpak.

Apart from this got to know about downloading youtube videos from terminal

sudo apt-get install youtube-dl

sudo apt-get install python-pip

sudo pip install –upgrade youtube-dl


The best way to predict the future is to create it … 🙂