- Deep learning
- Feed-forward neural networks
- Recurrent neural networks
A machine learning subfield of learning representations of data. Exceptional effective at learning patterns.
Deep learning algorithms attempt to learn (multiple levels of) representation by using a hierarchy of multiple layers.
\[h = \sigma(W_1x + b_1)\] \[y = \sigma(W_2h + b_2)\]
Learned hypothesis may fit the training data very well, even outliers ( noise) but fail to generalize to new examples (test data)
How to avoid overfitting?
# Use Keras Functional API input <- layer_input(shape = list(maxlen), name = "input") model <- input %>% layer_embedding(input_dim = max_words, output_dim = dim_size, input_length = maxlen, weights = list(word_embeds), trainable = FALSE) %>% layer_lstm(units = 80, return_sequences = TRUE) output <- model %>% layer_global_max_pooling_1d() %>% layer_dense(units = 1, activation = "sigmoid") model <- keras_model(input, output) summary(model)
# instead of accuracy we can use "AUC" metrics from "tensorflow.keras" model %>% compile( optimizer = "adam", loss = "binary_crossentropy", metrics = tensorflow::tf$keras$metrics$AUC() # metrics = c('accuracy') )
history <- model %>% keras::fit( x_train, y_train, epochs = 10, batch_size = 32, validation_split = 0.2 )
A transformer adopts an encoder-decoder architecture.
Transformers were developed to solve the problem of sequence transduction, or neural machine translation. That means any task that transforms an input sequence to an output sequence.
More details on the architecture and implementation:
ChatGPT: https://chat.openai.com/
Write with Transformer: https://transformer.huggingface.co/
Talk to Transformer: https://app.inferkit.com/demo
Transformer model for language understanding: https://www.tensorflow.org/text/tutorials/transformer
Pre-trained models: https://huggingface.co/transformers/pretrained_models.html
Go to https://chat.openai.com/ and login
How many parameters has chatgpt-3 model been trained on?
How many parameters has chatgpt-4 model been trained on?
What is the next generation NLP?
Suppose we want to build an application to help a user buy a car from textual catalogues. The user looks for any car cheaper than $10,000.00. Assume we are using the following data: txt <- c(“Price of Tesla S is $8599.99.”, “Audi Q4 is $7000.”, “BMW X5 costs $900”). Could you give me a regular expression to do this in R?