Aditya Chatterjee's Blog, page 52
February 19, 2023
Benford's Law in ML
In this article, we have explored Benford's Law and the use of it in the field of Machine Learning. This is one of the core ML laws you must master.
Content :-What is Benford's Law?History and origin of Benford's lawUses of Benford's law in machine learning and data analysisBenford's law applied in auditing and fraud detectionReal-life datasets that do not follow Benford's lawMathematical equation with exampleHow has Benford's law been generalized to other types of digits?Limitations of...February 18, 2023
Number of closed islands [2 solutions]
In this article, we have explored how to find the Number of closed islands in a graph. We have presented two approaches using the concept of BFS/ DFS and Union Find.
Pre-requisites:
BFS and DFSUnion FindProblem StatementGiven a 2-D grid consists of 0s (land) and 1s (water). An island is a maximal 4-directionally connected group of 0s and a closed island is an island totally (all left, top, right, bottom) surrounded by 1s.
Return the number of closed islands.
Example:
Output: 2
Explanation:...
Inline in C++
Inline function is an important feature of C++ which we have explored in depth in this article.
Firstly, we will understand why the inline function is used.
Inline in C++When a program calls a function, the CPU saves the memory address of the call in a predefined area and returns control to the calling function. After the CPU executes the function, it records the function return from in the same location. If a function's execution time is shorter than the switching time from the calling functio...
File reading and writing in C [Text + Binary, Complete Guide]
Transferring data from one programming language to another would have been almost impossible if there wasn't a way of writing and reading data from files. It is a very common practice to share data from one programming language to another. This is done by performing some operations on the file, saving the file and sharing the file through electronic means. The most widely accepted file format across all programming languages are JSON and CSV files.
Due to the persistence of data stored in files,...
Longest Consecutive Subsequence [3 solutions]
In this article, we have solved the problem of Longest Consecutive Subsequence using the concept of Hash Map and Union Find.
Pre-requisites:
Hash MapUnion FindProblem StatementYou are provided with an unsorted array and your task is to find the length of the longest consecutive subsequence of elements from the array. The program should run in O(n) time, where n is the length of the array.
So lets understand the problem through an example:
Input:n=7arr[n]=[1,43,3,2,55,4,6]Output: 4Expl...
Maximum Gap [Solved]
In this article, we are going to see the interesting solution to the problem - "Maximum Gap". This will involve the concept of Bucket Sort and Radix Sort.
Pre-requisites:
Bucket SortRadix SortProblem StatementFind the maximum difference between two successive elements in a given integer array nums after sorting it in non-decreasing order. If the length of nums is less than two, the function should return 0.
Example 1:
Input: nums = [10, 5, 20]
Output: 10
Explanation: After sorting the array...
Layer Normalization: An Essential Technique for Deep Learning Beginners
Deep learning has become one of the most powerful machine learning techniques in recent years. Neural networks are at the heart of deep learning and have shown great performance in various tasks, such as image recognition, speech recognition, and natural language processing. However, training neural networks can be challenging due to issues such as vanishing gradients and overfitting. To address these challenges, normalization techniques have been developed, one of which is layer no...
February 17, 2023
Tic Tac Toe with Reinforcement Learning
Tic Tac Toe is one of the most popular game which needs only two players to play it. This classic game is developed with almost every well-known programming language. In this article, the game is developed using Reinforcement Learning.
IntroductionA machine learning area that trains models or agents to act on their own to complete tasks is called reinforcement learning. This training method teaches the agent through rewarding it for any desired acts, and punishing it for undesired ones. Based o...
Quicksort in C++
In this article, we will learn how to design and implement Quicksort in C++ Programming Language in detail.
Pre-requisites:
Quick SortTime and Space Complexity of Quick SortParallel Quick SortDefinition:Quick Sort is a sorting algorithm based on divide and conquer paradigm. It was first proposed by Tony Hoare in 1959 and is one of the most widely used sorting algorithms in computer science.
The main idea is to divide the array into two sub-parts and then further quick sort algorithm will b...
Association in Unsupervised Learning
In Data Mining, association refers to the process where co occurrences and dependencies between different features in a dataset are discovered. The discovered patterns can then help in understanding the underlying structure of the data and provides insights into the same. In simple words, association refers to the phenomenon where certain entities are always found together because they are related in some way, and the aim is to extract those relations and form insights on th...