Home » Python

Python

“Cook” it and “Pre Hook” it

“Cook” it and “Hook” it, wow !! that is a nice line :). Well jokes apart, hello bloggers and blog seekers, it’s been a long while I have set hands on my site writing again. Well, I was having a group training session in my organization where my fellow colleague Bony Roopchandani who explained us the concepts of “Hook” and the ...

Read More »

Python GUI Examples (Tkinter Tutorial)

In this tutorial, we will learn how to develop graphical user interfaces by writing some Python GUI examples using Tkinter package. Tkinter package is shipped with Python as a standard package, so we don’t need to install anything to use it. Tkinter package is a very powerful package. If you already have installed Python, you may use IDLE which is ...

Read More »

Exploring Security, Metrics, and Error-handling with gRPC in Python

In my post “Using gRPC in Python,” we wrote a basic gRPC server implementing a users service. We are going to expand on it and explore more gRPC concepts, such as secure client-server communication via self-signed SSL certificates, implementing gRPC middleware (or interceptors), and error handling. We will be using Python 3.6 for our demos in this article. The git ...

Read More »

scikit-learn: Building a multi class classification ensemble

For the Kaggle Spooky Author Identification I wanted to combine multiple classifiers together into an ensemble and found the VotingClassifier that does exactly that. We need to predict the probability that a sentence is written by one of three authors so the VotingClassifier needs to make a ‘soft’ prediction. If we only needed to know the most likely author we ...

Read More »

Modern Python Web Scraping Using Multiple Libraries

In this post, we will talk about Python web scraping and how to scrap web pages using multiple libraries such as Beautifulsoup, Selenium, and some other magic tools like PhantomJS. You’ll learn how to scrap static web pages, Ajax loaded content, iframes, how to handle cookies and much more stuff What is Web Scraping Web scraping is the process of ...

Read More »

Python: Learning about defaultdict’s handling of missing keys

While reading the scikit-learn code I came across a bit of code that I didn’t understand for a while but in retrospect is quite neat. This is the code snippet that intrigued me: vocabulary = defaultdict() vocabulary.default_factory = vocabulary.__len__ Let’s quickly see how it works by adapting an example from scikit-learn: >>> from collections import defaultdict >>> vocabulary = defaultdict() ...

Read More »

Python: Combinations of values on and off

In my continued exploration of Kaggle’s Spooky Authors competition, I wanted to run a GridSearch turning on and off different classifiers to work out the best combination. I therefore needed to generate combinations of 1s and 0s enabling different classifiers. e.g. if we had 3 classifiers we’d generate these combinations 0 0 1 0 1 0 1 0 0 1 ...

Read More »