Power Search Tutorial-2

In the previous tutorial, we have learned different kinds of content like search by image, etc. In this page, we will learn about different kind of search operators.

Search Operators

An operator is something extra you add to your query to filter results or to get more precise results.

Site: Operator

This operator will list the webpages from that site. For example: You entered the query [artificial intelligence] and get lots and lots of results. Now you want to see the webpages of the same topic from the website “stanford.edu”. So, you write [artificial intelligence site:stanford.edu]. It will narrow the results and list the pages from that site only.

 

Similarly, you can write only top-level domain too like [artificial intelligence site:edu]

Filetype: operator

Filetype operator let’s find files of a particular type. Like if you want a pdf on a particular topic then you can use this operator to quickly gather the information the way you want. Like you enter the query [artificial intelligence filetype:pdf]. It will list the the pdf’s on that topic.

[artificial intelligence filetype:ppt] will list all the powerpoint presentations on it.

Now I want to find say KML file. Now KML file or KMZ file is a file that you can import in google my maps and google earth. Let’s say [IIT bombay filetype:kml] as shown in figure.

imageedit_2_4717902574

It will list KML or KMZ files marked red ellipse. Once you entered the link it will download the file illustrated by green ellipse. You can open this file in Google my maps as shown below.

Screenshot from 2019-09-25 13-56-42.png

The Minus Operator

The minus sign is used to eliminate irrelevant results. Let’s play with google using this operator.

You entered the query [best shampoo]. It will list the shampoo available in your country as shown in figure 1. Now, I want a shampoo without parabens and sulphates their ingredients then I will write a query [best shampoo -parabens -sulphates]. So it will list different set of webpages as shown in figure 2.

Screenshot from 2019-09-26 00-37-12
Figure 1
Screenshot from 2019-09-26 00-37-22
Figure 2

 

quotes and OR operator

Use quotes to search for a phrase. Like you want to search a song and you rembered any line of the song. So you will write that line within quotes and it will return you the full song lyrics. Now take a break and enjoy that song.

Like I remember a song line “meetha meetha pyara pyara”. Now I enter the query in same way and it will search in that sequence only. Bravo, I got the song videos and information.

Screenshot from 2019-09-26 00-46-46

BTW, it was my favourite show.

Moving on tho the OR operator it is used to include more than one way of expressing an idea. This tool is handy when you are looking for synonym terms or phrases and want both of the results merged together.

Let’s try on example to cement this idea. You entered the query [“power search”]. It will  show 32,50,000 results. Now search another query [“google search”]. It will show 20,80,00,000 results. When you write both terms using an OR operator it will merge results I mean it will show results that suits either one or both and show results 21,10,00,000 results.

imageedit_7_9195167437

imageedit_6_7528256569imageedit_4_9532449658

Note: It’s an operator, not a filter. It will actually add more results to your search.

intext: operator

intext: operator is used to ensure the word you want is actually on the page you find.

Let’s say you want to see the academic result from your college website. One way is the hit and trial method. But you are a power searcher now. So what you can do is add something to your query to get more precise results. Here I will use intext operator to list the webpages which have word “results” in it. So, finally I will write the query [site:gndec.ac.in intext:results]. Wow, the first site I got is absolutely correct.

Screenshot from 2019-09-26 14-31-48.png

Google provides Advanced Search User Interface utility. Try it out and play with it. The interesting which I liked the most is languages. You can list the webpages of a query in particular language too. Example: You want to find yoga online class in hindi then go to advanced Search in settings and select language hindi as shown below.

Screenshot from 2019-09-26 15-00-08 Screenshot from 2019-09-26 15-05-55At the end I will say,

Visit each of the links below to explore ways to keep yourself updated on Google Search tools:

Power Search Tutorial-1

Hello friends, it’s been a long time I have not written a blog. So, we start with common but globally required topic i.e. how to search effectively. You must have used Google Search Engine but have you explored it and ever extended your search to the next level? Many of you no. right! It’s never too late. I’ll provide here a very good link of the same.

https://coursebuilder.withgoogle.com/sample/course

It’s an amazing course. I will share the concepts which were new to me.

Different kinds of content

For detail explanation of it refer to Lesson 2.5

Google provides different kinds of content like web pages, images, videos, news, and more option. Browsing to more option list various kind of content like videos, shopping,  flights, finances personal as shown below

Screenshot from 2019-09-14 01-04-30

In the option, “personal” SERP i.e. Search Engine Result Page will show the results from your google drive, Gmail and your google account which only you can see. It may show your browsing history below.

Screenshot from 2019-09-14 01-03-51

Google Scholar

Google Scholar provides a simple way to broadly search for scholarly literature. From one place, you can search across many disciplines and sources: articles, theses, books, abstracts, and court opinions, from academic publishers, professional societies, online repositories, universities, and other web sites.

For usage of it refer to the link

Likewise, you can read about Google Patents from the above link.

Search by Image

Up to now you entered the query and get the images related to it but what if you have an image and you want the information of the same? So Google will help you out here. They provide “Google images” where you can upload an image or provide a link of it and you will get information like it’s an original website, date of the site publish and many more. You can apply filters on it to check the credibility of an image as illustrated in unit 5 of the above link.

Search with a picture from a website

  1. On your computer, open the Chrome browser.
  2. Go to the website with the picture you want to use.
  3. Right-click the picture.
  4. Click Search Google for image. You’ll see your results in a new tab.

Have a break and move to the next tutorial

Python Tutorial #2

What exactly u and r – string flag means?

In Python 2, you can store the string in 2 different types.

The first one is ASCII which is str type in python, it uses 1 byte of memory. (256 characters, will store mostly English alphabets and simple symbols)

The 2nd type is UNICODE which is unicode type in python, it uses 2 bytes of memory. (65536 characters, so this include all characters of all languages on earth)

By default, python will prefer str type but if you want to store the string in unicode type you can put u in front of the text like u’text’ or you can do this by calling unicode(‘text’)

So u is just a short way to call a function to cast str to unicode. That’s it!

Now the r part, you put it in front of the text to tell the computer that the text is raw text, backslash should not be an escaping character. r’\n’ will not create a new line character. It’s just plain text containing 2 characters where first character is ‘\’ and second character is ‘n’

In [68]: a=’qmi\nasd’

In [69]: print(a)
qmi
asd

In [70]: a=r’qmi\nasd’

In [71]: print(a)
qmi\nasd

If you want to convert str to unicode and also put raw text in there, use ur because ru will raise an error.

NOW, the important part:

You cannot store one backslash by using r, it’s the only exception. So this code will produce an error: r’\’

To store a backslash (only one) you need to use ‘\’

If you want to store more than 1 characters you can still use r like r’\’ will produce 2 backslashes as you expected.

 

Python Tutorial #1

Here are some of the points which are important to me.

Regular expressions:

.*? means “match zero or more characters but as little as possible“. It is called a non-greedy match.

.* means almost the same except that as much as possible is matched (greedy match).

Examples:

  • Using f.*?a to match foo bar baz results in foo ba (stops after first a)
  • Using f.*a to match foo bar baz results in foo bar ba (stops after last a)

In Python regular expression, greedy means as much as possible.

Numeric Operator:

integer division,  a//b

float division,  a/b

Split Function: Separate two inputs with space by split function

i, c = input().split()

Difference between lists and tuples in python?

We can use tuples as

  1. keys in dictionaries
  2. elements of sets

whereas lists can not.

 

What is Data Science?

In today’s era, data is in many forms like audio, video, text files and in a large amount too. Due to this more than 80% of the data is unstructured. Data Science here comes in a role to make complex and analytical models to enhance useful information from this variety of data.

This useful information can not only predict the things but also can automate things like self-driving cars, pilotless aircraft. We can extract precise information for our customer’s requirements for business profit.

For more information, one can refer to the site

You can build your own Neural Network from scratch using this site

Below are the most common python libraries for data science with reference link.

Numpy

http://cs231n.github.io/python-numpy-tutorial/

https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html

Matplotlib

https://matplotlib.org/users/pyplot_tutorial.html

Install Anaconda

https://www.digitalocean.com/community/tutorials/how-to-install-anaconda-on-ubuntu-18-04-quickstart

Linear Regression Theory

https://www.internalpointers.com/post/linear-regression-one-variable

Multiple Linear Regression

https://datatofish.com/multiple-linear-regression-python/

Learning in Neural Networks

What is Learning?

Learning rule in Neural Network means machine learning i.e. how a machine learns. It is a mathematical logic to improve the performance of Artificial Neural Network.

Learning rule is one of the most important factors to decide the accuracy of ANN.

sc_learning

Synapse

Dictionary meaning of synapse is togetherness, conjunction. The purpose of the synapse is to pass the signals from one neuron to target neuron. It is the basis through which neurons interact with each other.

Presynaptic and Postsynaptic Neuron

Information flow is directional. The neuron which fires the chemical called neurotransmitter is presynaptic neuron and the neuron which receives neurotransmitter is postsynaptic neuron.

Learning Rules

sc_learning_1

Hebbian Learning

It is one of the oldest learning algorithms. A synapse(connection) between two neurons is strengthened if the neuron A on either side of the synapse is near enough to excite neuron B, and repeatedly or persistently takes part in firing it. It leads to some growth process or metabolic changes in one or both cells such that A’s efficiency as one of the cells firing B, is increased.

Generalization of Hebbian Rule

\,\Delta w_i = \eta x_i y,

The four properties which characterize Hebbian synapse are:-

Time-dependent mechanism:- In it, modification in the Hebbian Synapse depend on the exact time of the occurrence of the presynaptic and postsynaptic activities.

Local mechanism:- Since synapse holds information-bearing signals. This locally available information is used by Hebbian synapse to produce local synaptic modification that is input specific.

Interactive mechanism:- In it change in Hebbian synapse depends upon the activity levels on both sides of the synapse(i.e. presynaptic and postsynaptic activities).

Conjunctional or correlational mechanism:- The co-occurrence of presynaptic and postsynaptic activities is sufficient to produce synaptic modification. That is why it is referred to as a conjunctional synapse. The synaptic change also depends upon the co-relation between presynaptic and postsynaptic activities due to which it is called correlational synapse.

Competitive Learning

In competitive learning, the output neuron competes among themselves for being fired. Unlike Hebbian Learning, only one neuron can be active at a time. It is the form of unsupervised learning.

It plays an important role in the formation of topographic maps.

The three basic elements to a competitive learning rule:-

  1. A set of neurons that are same except some neurons and which therefore respond differently to the given input set.
  2. A limit imposed on the “strength” of each neuron.
  3. A mechanism that allows a neuron to compete among themselves for a given set of inputs. The winning neuron is called a winner-takes-all-neuron.

The internal activity vof the winning neuron must be the largest among all the neurons for a specified input pattern x. The output signal vof the winning neuron is set equal to one; the output signal of all other neurons that lose the competition is set to zero.

 

The change applied to synaptic weight wji is defined by

{\displaystyle \Delta w_{ij}=\left\{{\begin{matrix}\eta (x_{i}-w_{ij})&{\mbox{ if }}i=j\\0&{\mbox{ otherwise}}\end{matrix}}\right.}

sc_comp

 Boltzmann Learning

Boltzmann learning is statistical in nature. It is derived from the field of thermodynamics. It is similar to an error-correction learning rule. However, in Boltzmann learning, we take a difference between the probability distribution of the system instead of the direct difference between the actual value and desired output.

Boltzmann learning rule is slower than the error-correction learning rule because in it the state of each individual neuron, in addition to the system output is taken into account.

The neurons operate in a binary manner representing +1 for on state and -1 for off state. The machine is characterized by an energy function E

E=-\left(\sum _{{i<j}}w_{{ij}}\,s_{i}\,s_{j}+\sum _{i}\theta _{i}\,s_{i}\right)

where si is the state of neuron and wji is the synaptic weight between neuron i and j. The fact that means that none of the neurons in the machine has self-loopback. 

The probability of flipping the state of neuron j

p_\text{i=on} = \frac{1}{1+\exp(-\frac{\Delta E_i}{T})}

where  \Delta E_i is the energy change.

The neurons of Boltzmann machine is divided into two functional groups, visible and hidden. The visible neurons act as an interface between the network and the environment in which it operates, whereas the hidden neurons always act freely.

sc_boltzmann

The Boltzmann machine works on two modes of operation:

Clamped condition:- In this, the visible neurons are clamped onto the specific states. These states are determined by the environment.

Free-running condition:- In this, all the neurons including the visible neurons and hidden neurons are allowed to operate freely.

Boltzmann Learning uses only locally available observations under two modes of operations: clamped and free running.

Playing with Osmosis

Command to filter the file with tag amenity=school and write the filtered data in second file.

$ osmosis –read-xml file=”ludhiana.osm” –nkv keyValueList=”amenity.school” –write-xml file=”school.osm”

Do you want to update your OSM data without deleting existing data?

So here are the steps given below.

Step 1

Derive a change set between two files. The first file is the file after changing, the second planet file is the file before changing. The changeset will be written in the third file.

$ osmosis –read-xml file=”classroom.osm” –read-xml file=”class_lib_tcc.osm” –derive-change –write-xml-change file=”classroom_classlibtcc_diff.osm”

Step 2

Dump the changeset to the database in append mode. It means it will change only affected data. Rest will exist there.

$ osm2pgsql –slim -a -d classroom -C 2500 –hstore -S openstreetmap-carto.style ~/osmosis_files/class_audi_diff.osm

And you are done.:)

Note: Osmosis and osm2pgsql have different schemas. So for using postgis flags of osmosis we have to create schema compatible with osmosis. I followed this link to create ans setup database.

For my satisfaction, I have written that command again.

$ psql -d classroom -f /home/amisha/osm/osmosis/script/pgsnapshot_schema_0.6_action.sql

OUTPUT

CREATE TABLE
ALTER TABLE

 

Variety: Wallpaper Changer

Variety Software

Variety is an open source wallpaper changer for linux.

Features

  1. It allows to set your own wallpapers.
  2. Provide  an option to change wallpaper automatically on hourly, daily basis.

Installation

sudo add-apt-repository ppa:peterlevi/ppa
sudo apt-get update
sudo apt-get install variety

Open it either from dashboard or from terminal by running command “variety”. Set it according to your needs.

Screenlets: Desktop Widgets

The next thing to make your Ubuntu more beautiful is to display desktop widgets like clock, infoPanelDesktop in Ubuntu system with the help of Screenlets software using this link.

Wireshark: Packet Analyzer

Install Wireshark from this link.