How to convert multiple matrices into one single vector in Python?

By | 2017-04-24T20:38:51+00:00 April 24th, 2017|languages, python|

This is a quick post on how to convert multiple matrices into a single vector using Python's numpy package. To begin with let us define 2 matrices. [crayon-59001a75deac7872972356/] What we want to do is to merge the contents of mat1 and mat2 into a single vector. To reach that goal first we need to convert each of them into vectors. For this we will make use of Numpy's reshape. [crayon-59001a75deadd186357120/] The -1 value for the newshape parameter of reshape ensures that the output has only 1 dimension. A matrix with 1 dimension is called a vector, which is what we want to achieve. Now that we have flattened both the matrices, we can merge (concatenate) [...]

Move panel to the top on Linux Mint 18

By | 2017-04-18T12:05:27+00:00 April 23rd, 2017|Linux, operating systems|

Linux Mint is a very stable operating system for Desktops and I personally use it on my laptop. However I like Ubuntu GNOME's panel on the top feature. In this post, I will quickly show how to move Linux Mint's panel to the top of the screen rather the default at the bottom of the screen. Here is how the Panel looks like on Linux Mint 18 Cinnamon Desktop edition. The panel is at the left hand bottom. To move it right click anywhere on the panel and click Modify Panel. Next click on Move Panel option. Now the screen turns little greyish and you are given [...]

How to find out the recently installed package on Ubuntu/Linux Mint

By | 2017-04-17T15:34:21+00:00 April 22nd, 2017|Linux, operating systems|

On many occasions I tend to install and try out new packages on Ubuntu/Linux Mint. If the operating systems does not work as expected I usually check which was the last package that I had installed or on what date a particular package was installed. In this post I will share few commands that I use to get this information. APT and apt-get are very powerful commands which works with Ubuntu's Advanced Packaging Tool (APT). The following command gives us the list of all the packages installed [crayon-59001a75e7267971747726/] As you see in the following output it does not give the details of the date installed, hence the output cannot [...]

How to copy files in Ubuntu and skip files if they are already in the destination

By | 2017-04-17T06:43:43+00:00 April 21st, 2017|Linux, operating systems|

I usually backup my work to an external hard drive. Since this is a weekly task, I want to be able to copy only the files which had changed in the past week rather than copying all the files all over again. The file explorers in Ubuntu/Linix Mint are very stable but the GUI does not have an option to meet this requirement of mine. Thanks to the CP command I am able to get this done. Here is the command that I use. [crayon-59001a75eb4ef091940297/] The parameters used with the CP command mean the following. -r copy directories recursively -u copy the source file only if the destination [...]

How to resolve time differences after dual booting Windows 10 and Linux Mint 18

By | 2017-04-16T21:14:48+00:00 April 20th, 2017|Linux|

I use Linux Mint 18 as primary operating system and sometimes boot to Windows 10. Since both of these operating systems are installed side-by-side, I boot to them using dual options in grub. Every time I boot to Windows and boot to Linux Mint or vice versa, I faced a strange problem. On Linux Mint, the system time would jump by few hours however if I check the Date and time settings, the timezone is correct represented. After troubleshooting this for sometime, I noticed the following. Ubuntu by default maintains the realtime clock in UTC time Windows maintains the realtime clock in Local Time Hence the [...]

Using PyCharm with Anaconda Virtual Environments

By | 2017-04-15T20:37:34+00:00 April 19th, 2017|Linux, operating systems, python, tools|

If you are regular reader of my blog, you would have noticed that I use Python mostly in Anaconda virtual environments. PyCharm is my favourite IDE for Python. Now the question is does PyCharm support conda environments? Fortunately the answer is Yes! In this post I will walk through the settings in PyCharm so that you can chose the right conda environment. Launch PyCharm and navigate to Settings --> Project Interpreter. If you click on the dropdown arrow, it should list all the interpreters currently available on the system which also includes interpreters from conda environments. If for some reasons you don't see the desired interpreter [...]

Finding the dot product in Python without using Numpy

By | 2017-04-18T12:16:20+00:00 April 18th, 2017|machine learning, python|

In Deep Learning one of the most common operation that is usually done is finding the dot product of vectors. In very simple terms dot product is a way of finding the product of the summation of two vectors and the output will be a single vector. This Wikipedia article has more details on dot products. The following formula should make it clear where $latex \vec{X}&s=1$ and $latex \vec{Y}&s=1$ are vectors. $latex \vec{X}=(x_1,x_2...x_n)&s=1$ $latex \vec{Y}=(y_1,y_2...y_n)&s=1$ then the dot product formula will be $latex \vec{X}.\vec{Y}=(x_1y_1+x_2y_2+...+x_ny_n)&s=1$ Here is an example of dot product of 2 vectors. $latex \vec{X}=(6,5,4)\vec    {Y}=(3,2,1)&s=1$ so $latex \vec{X}&s=1$  dot $latex \vec{Y}&s=1$ will be $latex \vec{X}.\vec{Y}=(6*3+5*2+4*1) = 32&s=1$ Finding the dot [...]

How to install PyCharm on Ubuntu

By | 2017-04-15T12:39:01+00:00 April 17th, 2017|languages, python, tools|

Pycharm is my favorite IDE for Python especially its feature rich debugger. This is a quick post where will be installing PyCharm on Ubuntu. Let's first download PyCharm Community Edition installer to the desired location where we want to have PyCharm installed. I had chosen ~/pycharm folder. Next we will extract the archive using the following command [crayon-59001a7605064204045355/] In the terminal navigate to the folder where the file is located, in my case /home/pradeep/pycharm/pycharm-community-2017.1.1/bin. Then execute the following command in the following terminal. [crayon-59001a7605079849679942/] If you just execute you may encounter "command not found error". So make sure to enter the command with the "./" along with [...]

Find battery usage details from Ubuntu terminal

By | 2017-04-13T21:59:06+00:00 April 16th, 2017|Linux, operating systems|

Requirement I usually connect to my laptop using SSH from my workstation. At times I need to check the battery remaining on the laptop. In order to do this I need to remote desktop into the laptop. Since this is a small task, I don't want to remote desktop to the laptop every time. Solution There is no doubt that the Linux Terminal is very powerful. In this case as well I can get the battery information right from the terminal. Upower is what we will use for this task. [crayon-59001a76087e2256483211/] Executing the above code will enumerate and list the power devices attached to the computer. Here [...]

How to configure static IP for your home PC and connect remotely

By | 2017-04-13T12:25:39+00:00 April 15th, 2017|Linux, operating systems, tools|

I have a desktop at home which is my lab and many a times I need to connect to it when I am away. Since the public IP address for the router keeps changing dynamically, I needed a way to connect to the machine reliably. There were two options. Get a static IP address from the ISP Go for a Dynamic DNS (DDNS) name Dynamic DNS is a good option where you can bind your local computer's port to a domain name and access from it anywhere. Even there are free DDNS providers like but I found the configuration and hassles of maintaining a DDNS name [...]