Skip to main content

Posts

Stochastic Gradient Descent

The full form of SGD is Stochastic Gradient Descent . It is an iterative optimization algorithm that is used to find the minimum of a function. SGD works by randomly selecting one data point at a time and updating the parameters of the model in the direction of the negative gradient of the function at that data point. SGD is a popular algorithm for training machine learning models, especially neural networks. It is relatively simple to implement and can be used to train models on large datasets. However, SGD can be slow to converge and may not always find the global minimum of the function.  I can explain how SGD works with an example. Let's say we have a neural network that is trying to learn to predict the price of a stock. The neural network has a set of parameters, such as the weights and biases of the individual neurons. The goal of SGD is to find the values of these parameters that minimize the error between the predicted prices and the actual prices. SGD works by iteratively...

How to Get Cluster Number for K-means Algorithm

There are a few different ways to get the cluster number for K-means . One way is to use the elbow method. The elbow method plots the sum of squared errors (SSE) for different values of K. The SSE is a measure of how well the data points are clustered. The elbow method works by finding the point where the SSE curve starts to bend sharply. This point is usually considered to be the optimal number of clusters. Another way to get the cluster number for K-means is to use the silhouette coefficient. The silhouette coefficient is a measure of how well each data point is assigned to its cluster. The silhouette coefficient ranges from -1 to 1. A value of 1 indicates that the data point is perfectly assigned to its cluster, while a value of -1 indicates that the data point is misassigned. The optimal number of clusters is the one that produces the highest average silhouette coefficient. Finally, you can also use the gap statistic to get the cluster number for K-means. The gap statistic is a me...

Basic Machine Learning Alogrithms

Here is a table of the machine learning algorithms, along with whether they are supervised or unsupervised learning algorithms: Algorithm Supervised Unsupervised Linear regression Supervised No Decision trees Supervised No Random forest Supervised No Ada boost Supervised No Gradient boost Supervised No Logistic regression Supervised No K-nearest neighbors (KNN) Supervised No Support vector machines (SVM) Supervised No K-means Unsupervised Yes Collaborative filtering Unsupervised Yes Principal component analysis (PCA) Unsupervised Yes In supervised learning, the algorithm is given labeled data, which means that the data is paired with the correct output. The algorithm then learns to map the input data to the output data. In unsupervised learning, the algorithm is not given labeled data. The algorithm must learn to find patterns in the data without any guidance. Here is a table of the above machine learning algorithms whether they can be used for regression or classification: Algorith...