Python tutorials

Introduction to GANs with Python and TensorFlow

Introduction Generative models are a family of AI architectures whose aim is to create data samples from scratch. They achieve this by capturing the data distributions of the type of things we want to generate. These kind of models are being heavily researched, and there is a huge amount of hype around them. Just look at the chart that shows the numbers of papers published in the field over the past few years: Since 2014, when the first paper on […]

Read more

Python for NLP: Creating Bag of Words Model from Scratch

This is the 13th article in my series of articles on Python for NLP. In the previous article, we saw how to create a simple rule-based chatbot that uses cosine similarity between the TF-IDF vectors of the words in the corpus and the user input, to generate a response. The TF-IDF model was basically used to convert word to numbers. In this article, we will study another very useful model that converts text to numbers i.e. the Bag of Words […]

Read more

The Python Help System

When writing and running your Python programs, you may get stuck and need to get help. You may need to know the meaning of certain modules, classes, functions, keywords, etc. The good news is that Python comes with an built-in help system. This means that you don’t have to seek help outside of Python itself. In this article, you will learn how to use the built-in Python help system. Python help() function This function helps us to get the documentation […]

Read more

The Python Assert Statement

In this article, we’ll examine how to use the assert statement in Python. In Python, the assert statement is used to validate whether or not a condition is true, using the syntax: assert If the condition evaluates to True, the program continues executing as if nothing out of the ordinary happened. However, if the condition evaluates to False, the program terminates with an AssertionError. >>> assert True Nothing happens when the code above is executed, since the condition evaluates to […]

Read more

Python: Print without Newline

In this article, we’ll examine how to print a string without a newline character using Python. In Python, the built-in print function is used to print content to the standard output, which is usually the console. By default, the print function adds a newline character at the end of the printed content, so the next output by the program occurs on the next line. Try running this code to see an example: print(‘Banana’) print(‘pudding.’) Output: Banana pudding. As expected, the […]

Read more

Python for NLP: Creating TF-IDF Model from Scratch

This is the 14th article in my series of articles on Python for NLP. In my previous article, I explained how to convert sentences into numeric vectors using the bag of words approach. To get a better understanding of the bag of words approach, we implemented the technique in Python. In this article, we will build upon the concept that we learn in the last article and will implement the TF-IDF scheme from scratch in Python. The term TF stands […]

Read more

Python’s Bokeh Library for Interactive Data Visualization

Introduction In this tutorial, we’re going to learn how to use Bokeh library in Python. Most of you would have heard of matplotlib, numpy, seaborn, etc. as they are very popular python libraries for graphics and visualizations. What distinguishes Bokeh from these libraries is that it allows dynamic visualization, which is supported by modern browsers (because it renders graphics using JS and HTML), and hence can be used for web applications with a very high level of interactivity. Bokeh is […]

Read more

Python for NLP: Developing an Automatic Text Filler using N-Grams

This is the 15th article in my series of articles on Python for NLP. In my previous article, I explained how to implement TF-IDF approach from scratch in Python. Before that we studied, how to implement bag of words approach from scratch in Python. Today, we will study the N-Grams approach and will see how the N-Grams approach can be used to create a simple automatic text filler or suggestion engine. Automatic text filler is a very useful application and […]

Read more

Gradient Boosting Classifiers in Python with Scikit-Learn

Introduction Gradient boosting classifiers are a group of machine learning algorithms that combine many weak learning models together to create a strong predictive model. Decision trees are usually used when doing gradient boosting. Gradient boosting models are becoming popular because of their effectiveness at classifying complex datasets, and have recently been used to win many Kaggle data science competitions. The Python machine learning library, Scikit-Learn, supports different implementations of gradient boosting classifiers, including XGBoost. In this article we’ll go over […]

Read more

Python List Sorting with sorted() and sort()

In this article, we’ll examine multiple ways to sort lists in Python. Python ships with two built-in methods for sorting lists and other iterable objects. The method chosen for a particular use-case often depends on whether we want to sort a list in-place or return a new version of the sorted list. Assuming we want to sort a list in place, we can use the list.sort() method as follows: >>> pets = [‘Turtle’, ‘Cat’, ‘Fish’, ‘Dingo’] >>> pets.sort() >>> pets […]

Read more
1 158 159 160 161 162 182