Home » Archive

Articles tagged with: python

Natural Language Processing (NLP), Python »

[19 Feb 2018 | No Comment]

This article shows how you can use the default Stopwords corpus present in Natural Language Toolkit (NLTK).
To use stopwords corpus, you have to download it first using the NLTK downloader. In my previous article on Introduction to NLP & NLTK, I have written about downloading and basic usage example of different NLTK corpus data.

Natural Language Processing (NLP), Python »

[12 Feb 2018 | No Comment]

Natural Language Processing (NLP) is about the processing of natural language by computer. It’s about making computer/machine understand about natural language. Natural language means the language that humans speak and understand.
Natural Language Toolkit (NLTK) is a suite of Python libraries for Natural Language Processing (NLP). NLTK contains different text processing libraries for classification, tokenization, stemming, tagging, parsing, etc.

Data Structures & Algorithms, Python »

[5 Feb 2018 | No Comment]

This article deals with implementing Bubble Sort algorithm using Python programming language.
Bubble Sort is a simple sorting algorithm that compares each element in the list with its adjacent element and sort that pair of elements if they are not in order.

Data Structures & Algorithms, Python »

[29 Jan 2018 | No Comment]

This article deals with implementing Hash Table using Python programming language. Hash Table is a data structure where data are stored in an associative manner (in key, value format). The key/index is unique. This kind of storage makes it easier to find the data later on.
Hash Table stores data into an array format. It uses a hashing function that generates a slot or an index to store/insert any element or value.

Data Structures & Algorithms, Python »

[22 Jan 2018 | Comments Off on Binary Search implementation in Python [Data Structures & Algorithms]]

This article deals with the binary search algorithm implementation in Python programming language.
Binary search is an improvement to linear search. Binary search requires the searched list to be an ordered list, i.e. the list items should be sorted in ascending order (increasing order).

Data Structures & Algorithms, Python »

[15 Jan 2018 | Comments Off on Linear Search implementation in Python [Data Structures & Algorithms]]

This article deals with the linear search or sequential search algorithm. It’s a very simple search algorithm.
Linear Search

Machine Learning »

[6 Nov 2017 | Comments Off on Titanic: Machine Learning from Disaster – Kaggle Competition Solution using Python]

Kaggle is an online platform that hosts different competitions related to Machine Learning and Data Science.
Titanic is a great Getting Started competition on Kaggle. This is one of the highly recommended competitions to try on Kaggle if you are a beginner in Machine Learning and/or Kaggle competition itself.

Python, Recommender System »

[2 May 2016 | One Comment]

python-recsys is a Python Library for implementing a Recommender System.
Currently, python-recsys supports two Recommender Algorithms: Singular Value Decomposition (SVD) and Neighborhood SVD.

Python, Recommender System »

[7 Mar 2016 | 3 Comments]

Crab as known as scikits.recommender is a Python framework for building recommender engines integrated with the world of scientific Python packages (numpy, scipy, matplotlib).
Currently, Crab supports two Recommender Algorithms: User-based Collaborative Filtering and Item-based Collaborative Filtering.

Python »

[22 Feb 2016 | Comments Off on Python: Read Write JSON]

In this article, I will be showing how to read data from a JSON file and write data to a new JSON file using Python programming language.
Suppose, I have the following JSON data which is saved in a file named sample-1.json.

Python »

[15 Feb 2016 | Comments Off on Python: Read Write CSV]

In this article, I will be showing how to read data from a CSV file and write data to a new CSV file using Python programming language.
Here’s a scenario: Suppose, I have a CSV file with 3 columns (user_id, item_id, and star_rating). It has data of 100 users. Each user has rated 20 different items. So, altogether there are 100 * 20 = 2000 entries in the CSV file.

Python »

[8 Feb 2016 | Comments Off on Python: Graph plotting with Matplotlib (Bar Chart)]

This article deals with plotting line graphs with Matplotlib (a Python’s library).
Below is the data which we will use to plot the bar chart. The data is saved in a CSV file named result3-blog.csv.

Python »

[1 Feb 2016 | Comments Off on Python: Graph plotting with Matplotlib (Line Graph)]

This article deals with plotting line graphs with Matplotlib (a Python’s library).
In the article Machine Learning & Sentiment Analysis: Text Classification using Python & NLTK, I had described about evaluating three different classifiers’ accuracy using different feature sets. In this article, I will be using the accuracy result data obtained from that evaluation.
Below is the result data which we will use to plot line graph. The data is saved in a CSV file named result4-accuracy-blog.csv.

Machine Learning, Natural Language Processing (NLP), Python, Sentiment Analysis »

[25 Jan 2016 | 2 Comments]

This article deals with using different feature sets to train three different classifiers [Naive Bayes Classifier, Maximum Entropy (MaxEnt) Classifier, and Support Vector Machine (SVM) Classifier].
Bag of Words, Stopword Filtering and Bigram Collocations methods are used for feature set generation.

Python »

[18 Dec 2014 | Comments Off on Python: Print variable in human readable form like print_r in PHP]

print_r prints a PHP variable into human readable form.
The same can be achieved in Python using pprint module.