Saturday, January 18, 2025

Discriminative AI

This type of AI algorithm that classify or distinguish class of target objects objects. It is applied in areas include NLP (sentiment classification, topics classification), re commendation (predicts user preference) and computer vision. 

Saturday, January 11, 2025

Large Language Midel

LLM is trained with lots of text and is used to predict the next word or sentence based on input (prompt) and the previous interaction in the session. The older RNN loop back the output to generate newer output but it has limited “memory” than LLM. 


Wednesday, January 8, 2025

GAN types

GAN generate image randomly which is unpredictable. By using an additional condition vector to indicate the class of image we like to the graining, we can get GAN to generate specific class of image we wanted. This is called conditional GAN. 

A controllable GAN is  a GAN that we can use the random vector to influence part of the image. For example, change the image hair color, gender etc through altering the value of the input vector. This is equivalent of mapping the vector space to the image space. The input vector may need much more values (dimension) to make the out put more controllable. It is because in a low dimensional vector, one value change may affect multiple feature of the image. This is called entanglement. A higher dimensional vector is more likely to minimize the correlation of 1 value to many features in the image space 

Monday, January 6, 2025

Random vector input for GAN

The input vector contains random value samples from a normal distribution. In other words, the value close to the mode will s more likely to be used than those value distant from the mode. The vector, called the noise vector, is equivalent to encoding of real data (image). 

Training GAN

(1) generate a batch of images with the generator. The initial image will not noise and easily distinguished by the discriminator. 

(2) grab a batch of real images. Marked the combined batch with label 0 or 1 for fake or real images. 

(3) feed the batch to the discriminator. Using back propagation to adjust the weighs and bias of the discriminator so that it can learn to recognise the real image  

(4) freeze the weigh and bias for the discriminator. Create a batch of fake image from the generator. Label these image as real and use the output from the discriminator to anjust the weigh and bias of the generator through back propagation and gradient descent for the complete model (discriminator toward generator)

(5) repeat the training until the discriminator cannot discern the fake picture from real (ie the out out is about 0.5. 

Sunday, January 5, 2025

GAN

Generative adversarial network is used to generate image from an input vector of random value. GAN comprises of 2 neural networks - genarator used to create innate and a discriminator used to rate how real the image generated is. 

The image created by generator is fed to the discriminator with real images. The output from the discriminator s used to train the generator so that it eventually generate image that the discriminator could not differentiate form real ones.  Training us via back propagation to adjust the weighs and bias  

Once the model is grained, the discriminator is discarded. The generator is used to generate artificial images 

Wednesday, January 1, 2025

CNN architecture

A CNN consists of multiple layers of convolution and pooling. A convolution layers uses a set (multiple kernels) to learn from its input. The output is fed into the pooling layers which has no weigh and bias like the convolution layer as it has nothing to learn. Pooling later submarines the output of a convolution layer by dividing the input matrix into a set of 2x2 grid and extract the maximum value from each grid cell. This reduce the spatial extent of the input which feed into the next convolution layers  

The final convolution layer feed into a conventional neural network called the dense layer to give the final output