Python Repeat String Until Length

The multiplication operator (*) allows you to repeat a given string a certain number of times. However, if you want to repeat a string to a specific length, you might need to employ a different approach, such as string slicing or a while loop. For example, while manipulating strings in Python, you may need to … Read more

Want Exploding Bitcoin Prices North of $500,000 per BTC? “Grow N” Says Metcalfe’s Law

Metcalfe’s law states that the value of a network (V) is proportional to the square of the number of connected users of the system (NΒ²). In this article, I’ll develop a Bitcoin price prediction (V) in the year 2030 based on the average growth rate of the number of Bitcoin nodes (N). General Intuition Metcalfe’s … Read more

Python Multiprocessing Pool [Ultimate Guide]

Python Multiprocessing Fundamentals πŸš€ Python’s multiprocessing module provides a simple and efficient way of using parallel programming to distribute the execution of your code across multiple CPU cores, enabling you to achieve faster processing times. By using this module, you can harness the full power of your computer’s resources, thereby improving your code’s efficiency. To … Read more

OpenAI API Functions & Embeddings Course (7/7): Sentiment Analysis using Embeddings

πŸ’‘ Full Course with Videos and Course Certificate (PDF): https://academy.finxter.com/university/openai-api-function-calls-and-embeddings/ Course Overview Welcome back to the final part of this tutorial series. In this part, we’ll be looking at simple sentiment analysis using embeddings. For most text classification tasks, fine-tuned machine learning models will do better than embeddings, because they have been meticulously tuned and … Read more

OpenAI API Functions & Embeddings Course (6/7): Similarity Comparison with Embeddings

πŸ’‘ Full Course with Videos and Course Certificate (PDF): https://academy.finxter.com/university/openai-api-function-calls-and-embeddings/ Course Overview Welcome back to part 6 of this tutorial series. In this part, we’re going to be looking at embeddings. What is an embedding? Without getting into algorithmic arithmetic an embedding is basically a numerical (vector) representation of text that makes no sense to … Read more

OpenAI API Functions & Embeddings Course (5/7): Calling Functions That Do Not Exist to Extract Structured Data

πŸ’‘ Full Course with Videos and Course Certificate (PDF): https://academy.finxter.com/university/openai-api-function-calls-and-embeddings/ Course Overview Welcome back to part 5, Where we’ll be calling functions that do not even exist. We’ll also briefly touch on pitfalls, failures, and retrying to make our code more robust as introducing AI tends to make our code a little more unpredictable and … Read more

OpenAI API Functions & Embeddings Course (4/7): Database Querying using ChatGPT

πŸ’‘ Full Course with Videos and Course Certificate (PDF): https://academy.finxter.com/university/openai-api-function-calls-and-embeddings/ Course Overview Welcome back to part 4, where we’ll be doing something mind-blowing yet again! In this part, we will be connecting ChatGPT to a database and then using ChatGPT to extract information from the database using only natural language on the end user’s part. … Read more

OpenAI API Functions & Embeddings Course (3/7): Multiple Functions and Multiple Calls

πŸ’‘ Full Course with Videos and Course Certificate (PDF): https://academy.finxter.com/university/openai-api-function-calls-and-embeddings/ Course Overview Welcome back to part 3, where we’ll take things one step further and look at having multiple functions and even calling multiple functions in a row. First, let’s make a second function for ChatGPT to call. We have ChatGPT with access to the … Read more

OpenAI API Functions & Embeddings Course (2/7): Function Calls with Parameters

πŸ’‘ Full Course with Videos and Course Certificate (PDF): https://academy.finxter.com/university/openai-api-function-calls-and-embeddings/ Course Overview Welcome to the second part of the tutorial, where we’ll look at the shortcomings of ChatGPT and use our functions with parameters to overcome them. First, make a file in your base directory called ‘Ba_chatgpt_no_weather.py‘ and copy/paste the following basic code into it: … Read more

OpenAI API Functions & Embeddings Course (1/7): Simple Function Request

πŸ’‘ Full Course with Videos and Course Certificate (PDF): https://academy.finxter.com/university/openai-api-function-calls-and-embeddings/ Course Overview πŸ‘‹ Hi, and welcome. I’m Dirk van Meerveld, and I’ll be your host and guide for this tutorial series, where we’ll be focussing on OpenAi’s ChatGPT function calls and the embeddings API. Function calls will allow us to make ChatGPT even smarter by … Read more

The Most Pythonic Way to Get N Largest and Smallest List Elements

Using heapq.nlargest() and heapq.nsmallest() is more efficient than sorting the entire list and then slicing it. Sorting takes O(n log n) time and slicing takes O(N) time, making the overall time complexity O(n log n) + O(N). However, heapq.nlargest() and heapq.nsmallest() have a time complexity of O(n log N), which is more efficient, especially when … Read more