Explore 3 unsupervised techniques to extract important topics from documents

Image for post
Image for post
Photo by Tolga Ulkan on Unsplash

Building on top of my previous articles on natural language processing

Let’s explore how to perform topic extraction using another popular machine learning module called scikit-learn. In this tutorial, we will be learning about the following unsupervised learning algorithms:

  • Non-negative matrix factorization (NMF)

As for the dataset, you can choose to use your own or download the publicly available 20 News Group Dataset. It consists of approximately 20k documents related to newsgroup. …

An open source testing toolkit that works on most JavaScript projects

Jest logo with the words “Introduction to Jest JavaScript Testing Framework” superimposed
Jest logo with the words “Introduction to Jest JavaScript Testing Framework” superimposed
Logo from Jest’s official GitHub page and modified by Author to include additional text

The topic for today is Jest, a JavaScript testing framework which comes in handy for testing your JavaScript projects. At the time of this writing, it comes with great support for Babel, TypeScript, Node, React, Angular, Vue, and a lot more.

According to the official documentation, it provides the following functionalities:

  • fast and safe

Jest is a great testing toolkit for developers who are looking for other alternatives and have experience with the following testing frameworks:

  • AVA

Let’s proceed to the next section and start installing Jest.


Installation is pretty straightforward via either yarn or npm, based on your own preferences. …

Explore the basic syntax and compare the performance

logos and wordmarks of Requests and aiohttp, separated by “vs”
logos and wordmarks of Requests and aiohttp, separated by “vs”
Image by Author

This tutorial focuses on the comparison between two main packages for calling API requests in Python.

The first is Requests: HTTP for Humans, which is one of the most common packages used by developers. It is a fairly simple and straightforward HTTP library for Python. Besides, it provides great support for HTTP 1.1 and full automation of HTTP connection pooling.

On the other hand, aiohttp, is an asynchronous HTTP framework for both client and server. It was designed to make the most out of network operations in a non-blocking way. In addition, most of the servers are now built using ASGI servers. Calling APIs asynchronous provides an edge in terms of performance especially when I/O operations make up the majority of the processes in your project. …

Explore the key differences between SAST and DAST

Image for post
Image for post
Original Photo by Alex on Unsplash. It was later modified to include the text SAST and DAST.

I have covered an article previously on Weighing the Pros and Cons of Static Application Security Testing. My previous article covers the Top 10 most critical web application and API security risks faced by the developers all over the world based on the report produced by OWASP: a non-profit organization that aims to educate people on security vulnerabilities.

In this tutorial, we are going to explore and compare the differences between Static Application Security Testing (SAST) and Dynamic Application Security Testing (DAST).

Static Application Security Testing (SAST) is one of the method for reducing the security vulnerabilities in your application. Another method is Dynamic Application Security Testing (DAST), which secures your application. …

Minimizing repetition in your code

Image for post
Image for post
Photo by Sara Bakhshi on Unsplash

In this tutorial, I am going to demystify the concept behind dependency injection in FastAPI. For your information, FastAPI now comes with its own built-in dependency injection system which allows you to integrate components easier when building your API.

Dependency injection is a concept in programming where an object receive other objects that it depends on. The other objects are called dependencies. This minimizes code repetition and makes it easier to do testing on your systems.

Based on the official documentation, dependency injection provides the ability to

  • reuse the same shared logic

Build an API that can handle your traffic

A bunch of boxes waiting to be loaded onto a truck.
A bunch of boxes waiting to be loaded onto a truck.
Photo by Evan Krause on Unsplash

By reading this piece, you’ll learn to perform load and stress testing on your RESTful API using a free and open-source load-testing tool called k6. k6 was previously known as Load Impact and is a full-fledged tool for:

  • Smoke testing — verify that your system doesn’t throw errors under a minimal load

A step-by-step guide to deploying a bot locally that handles private and group messages

Image for post
Image for post
Photo by Christian Wiediger on Unsplash

The topic for today is setting up your own bot in Telegram and deploying it locally via a method called polling. This means you can develop and test your bot in your server, as long as it is connected to the internet. https is not required for this, which allows you to kickstart your project right away. You can always scale your project later by configuring your server with https and linking it to Telegram via a webhook.

In this article, you will learn to:

  • Handle different types of incoming messages from users

Utilizing WebSockets, Queue and APScheduler for batch processing in FastAPI

Image for post
Image for post
Photo by Mihály Köles on Unsplash

In this tutorial, I am going to share a simple experiment that I have conducted over the weekend. The basic idea is to queue up all the incoming requests and process them in batches at certain interval each time. To do so, we are going to

  1. establish two-way connections between the clients and our server via WebSockets.

The architecture is fairly straightforward and good enough for our case study. Please be reminded that if you are looking for production-ready solutions, you should be using RabbitMQ (message broker) or Celery (distributed task queue) instead based on your use cases. …

One simple trick to make your life easier

Image for post
Image for post
Photo by Sai Kiran Anagani on Unsplash

By reading this piece, you will learn to create a bash script that automates the restart process for your FastAPI server (production). As you have known, you can restart the server by using the reload argument during development.

uvicorn myapp:app --reload

When FastAPI (uvicorn ASGI) detects changes in the files, it will trigger a reload for you. However, you should not use the reload argument for the production server. This is simply because it will hog your CPU resources in order to detect changes to the local files.

Most of the time, you are going to deploy it using nohup and & argument which allows the process to continue running in the background. As a result, there might arise situations in which you just want to restart FastAPI…

10000 to 10K | 999999 to 1M | 1234567890 to 1.23B

Image for post
Image for post
Photo by Andrew Buchanan on Unsplash

By reading this piece, you will learn to format an integer (123456) into its own string representation (123K) in Python. This helps to improve the user experience in your application as displaying the number as string representation is a lot more coherent to the users. In this tutorial, I am going to showcase two different implementations:

  • a modified version of the codes shared on Stack Overflow

Having said that, this article does not cover string representation that is less than 0 such as micro and nano. …


Ng Wai Foong

Senior AI Engineer@Yoozoo | Content Writer #NLP #datascience #programming #machinelearning | Linkedin: https://www.linkedin.com/in/wai-foong-ng-694619185/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store