Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. Q-Learning Algorithm
2. State–action–reward–state–action Algorithm
(SARSA)
3. Deep Q Network Algorithm (DQN)
4. Deep Deterministic Policy Gradient Algorithm
(DDPG)
Application of Reinforcement Machine
Learning
1. Resources management in computer clusters
2. Traffic Light Control
3. Robotics
4. Web System Configuration
5. Personalized Recommendations
6. Deep Learning
Linear Regression
It is a basic and commonly used type of
predictive analysis. These regression estimates
are used to explain the relationship between one
dependent variable and one or more
independent variables.
Y = a + bX
where
Y – Dependent Variable
a – intercept
X – Independent variable
b – Slope
Example:
University GPA' = (0.675)(High School GPA) +
1.097
Code for Linear Regression
x_train <-
input_variables_values_training_datasets
y_train <-
target_variables_values_training_datasets
x_test <-input_variables_values_test_datasets
x <- cbind(x_train,y_train)
linear <- lm(y_train ~ ., data = x)
predicted= predict(linear,x_test)
Logistic Regression
It’s a classification algorithm, that is used where
the response variable is categorical. The idea of
Logistic Regression is to find a relationship
between features and probability of particular
outcome.
Example
When we have to predict if a student passes or
fails in an exam when the number of hours spent
studying is given as a feature, the response
variable has two values, pass and fail.
Code for Logistic Regression
x <- cbind(x_train,y_train)
logistic <- glm(y_train ~ ., data =
x,family='binomial')
predicted= predict(logistic,x_test)
Example:
One class is linearly separable from the others
like if we only had two features like Height and
Hair length of an individual, we’d first plot these
two variables in two dimensional space where
each point has two co-ordinates
Code for Support Vector Machine
x <- cbind(x_train,y_train)
fit <-svm(y_train ~ ., data = x)
predicted= predict(fit,x_test)
Example:
Emails are given and we have to find the spam
emails from that.A spam filter looks at email
messages for certain key words and puts them in
a spam folder if they match.
Code for Naive Bayes
x <- cbind(x_train,y_train)
fit <-naiveBayes(y_train ~ ., data = x)
predicted<-predict(fit,x_test)
Random Forest
Random forest is collection of tress(forest) and it
builds multiple decision trees and merges them
together to get a more accurate and stable
prediction.It can be used for both classification
and regression problems.
Example:
Suppose we have a bowl of 100 unique numbers
from 0 to 99. We want to select a random sample
of numbers from the bowl. If we put the number
back in the bowl, it may be selected more than
once.
K-Means Algorithm
K-means clustering is a type of unsupervised
learning, which is used when you have unlabeled
data and the goal of this algorithm is to find
groups in the data
Steps to use this algorithm:-.
1-Clusters the data into k groups where k is
predefined.
2-Select k points at random as cluster centers.
3-Assign objects to their closest cluster center
according to the Euclidean distance function.
4-Calculate the centroid or mean of all objects in
each cluster.
Examples:
Behavioral segmentation like segment by
purchase history or by activities on application,
website, or platform
Separate valid activity groups from bots
1. Q-Learning Algorithm
2. State–action–reward–state–action Algorithm
(SARSA)
3. Deep Q Network Algorithm (DQN)
4. Deep Deterministic Policy Gradient Algorithm
(DDPG)
Q-Learning
devtools::install_github("nproellochs/Reinforcem
entLearning")
devtoos::install_local("ReinforcementLearning_1.
0.0.tar.gz")
library(ReinforcementLearning)
data("tictactoe")
head(tictactoe, 5)
environment <- function(state, action) {
...
return(list("NextState" = newState,
"Reward" = reward))
}
env <- gridworldEnvironment
print(env)
# Define state and action sets
states <- c("s1", "s2", "s3", "s4")
actions <- c("up", "down", "left", "right")
# Sample N = 1000 random sequences from the
environment
data <- sampleExperience(N = 1000, env = env,
states = states, actions = actions)
head(data)
# Define reinforcement learning parameters
control <- list(alpha = 0.1, gamma = 0.5, epsilon
= 0.1)
# Perform reinforcement learning
model <- ReinforcementLearning(data, s =
"State", a = "Action", r = "Reward",
s_new = "NextState", control = control)
# Print result
print(model)
Deep Q Network (DQN)