Are there examples of using reinforcement learning for text classification? - machine-learning

Imagine a binary classification problem like sentiment analysis. Since we have the labels, cant we use the gap between actual - predicted as reward for RL ?
I wish to try Reinforcement Learning for Classification Problems

Interesting thought! According to my knowledge it can be done.
Imitation Learning - On a high level it is observing sample trajectories performed by the agent in the environment and use it to predict the policy given a particular stat configuration. I prefer Probabilistic Graphical Models for the prediction since I have more interpretability in the model. I have implemented a similar algorithm from the research paper: http://homes.soic.indiana.edu/natarasr/Papers/ijcai11_imitation_learning.pdf
Inverse Reinforcement Learning - Again a similar method developed by Andrew Ng from Stanford to find the reward function from sample trajectories, and the reward function can be used to frame the desirable actions.
http://ai.stanford.edu/~ang/papers/icml00-irl.pdf

Related

How to use Reinforcement Learning for a Classification problem?

Using Python, I'm trying to predict if an individual is eligible for a loan or not. So, my output will be either a 1 or 0.
I want to use a Reinforcement Learning approach to learn and experiment. But, I haven't found any useful resources on how to use RL in classification problems.
My question is, is to suitable to use RL or is it too complex for my problem and it's not used in similar real-world problems?
If the answer is yes, how can I apply RL in classification problems?

What's the difference between reinforcement learning, deep learning, and deep reinforcement learning? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 25 days ago.
Improve this question
What's the difference between reinforcement learning, deep learning, and deep reinforcement learning? Where does Q-learning fit in?
Reinforcement learning is about teaching an agent to navigate an environment using rewards. Q-learning is one of the primary reinforcement learning methods.
Deep learning uses neural networks to achieve a certain goal, such as recognizing letters and words from images.
Deep reinforcement learning is a combination of the two, using Q-learning as a base. But instead of using actual state-value pairs, this is often used in environments where the state-action space is so large that it would take too long for Q-learning to converge. By using neural networks, we can find other state-action pairs that are similar. This “function approximation” allows effective learning in environments with very large state-action spaces.
Deep learning is a method using neural networks to make function approximators to solve various problems.
Ex: Learning a function which takes an image as input and output the bounding boxes of objects in the image.
Reinforcement learning is a field in which we have an agent and we want that agent to perform a task i.e, goal based problems where we use trial and error learning methods.
Ex: Agent learning to move from one position on grid world to a goal position without falling in a pit present in between.
Deep reinforcement learning is a way to solve goal based problems using neural networks. This is because, when we want agents to perform task in real world or current games, the state space is very big.
It takes agent very long time to even visit each state once and we cannot use look up tables to store the value functions.
So, to tackle this problem we use neural networks to approximate the state to generalize the learning process
Ex: We use DQN to solve many atari games.
Q-learning : It is a temporal difference learning method, where we have a Q-table to look for best action possible in the current state based on Q value function.
For learning Q values we use the reward and the maximum possible next state Q value.
Q-learning basically falls under Reinforcement learning and its deep reinforcement learning analog is Deep Q network (DQN).
The goal of machine learning methods is to learn rules from data and make predictions and/or decisions based on them.
The learning process can be done in a(n) supervised, semi-supervised, unsupervised, reinforcement learning fashion.
In reinforcement learning (RL), an agent interacts with an environment and learns an optimal policy, by trial and error (using reward points for successful actions and penalties for errors). It is used in sequential decision making problems [1].
Deep learning as a sub-field of machine learning is a mathematical framework for learning latent rules in the data or new representations of the data at hand. The term "deep" refer to the number of learning layers in the framework. Deep learning can be used with any of aforementioned learning strategies, i.e., supervised, semi-supervised, unsupervised, and reinforcement learning.
A deep reinforcement learning technique is obtained when deep learning is utilized by any of the components of reinforcement learning [1]. Note that Q-learning is a component of RL used to tell an agent that what action needs to be taken in what situation. Detailed information can be found in [1].
[1] Li, Yuxi. "Deep reinforcement learning: An overview." arXiv preprint arXiv:1701.07274 (2017).
Reinforcement learning refers to finish -oriented algorithms, which learn how to attain a coordination compound objective (goal) or maximize along a particular dimension over many steps. The basic theme behind Reinforcement learning is that an agentive role will learn from the environment by interacting with it and getting rewards for performing actions.
Deep Learning uses multiple layers of nonlinear processing units to extract feature and transformation
Deep Reinforcement Learning approach introduces deep neural networks to solve Reinforcement Learning problems thus they are named “deep.”
There's more distinction between reinforcement learning and supervised learning, both of which can use deep neural networks aka deep learning. In supervised learning - training set is labeled by a human (e.g. AlphaGo). In reinforcement learning (e.g. AlphaZero)- the algorithm is self-taught.
To put it in simple words,
Deep Learning - It's uses the model of neural network(mimicking the brain , neurons) and deep learning is used in image classification , data analyzing and in reinforcement learning too.
Reinforcement learning - This is a branch of machine learning, that revolves around an agent (ex: clearing robot) taking actions(ex: moving around searching trash) in it's environment(ex:home) and getting rewards(ex: collecting trash)
Deep-Reinforcement learning - This is one among the list of algorithms reinforcement learning has , this algorithm utilizes deep learning concepts.
Reinforcement learning (RL) is a type of machine learning that is mainly motivated by the feedback control of systems. RL is usually considered a type of optimal control that learns through interacting with a system/environment and getting feedback. RL usually replaces the computationally expensive dynamic programming methods with single time-step/multi time-step learning rule. Popular temporal difference methods in RL are considered somewhere in between dynamic programming and monte carlo methods. Classic RL methods use tabular algorithms that are not that scalable.
Deep learning (DL) is considered crucial part of modern machine learning (classical machine learning usually mean SVM, liner regression etc.). DL uses deep multilayered neural networks (NN) with backpropagation for learning. By using well designed deep NN networks complex input-output relations can be learned. Because of this property of approximating very complex functions DL have been extremely popular in recent years (2010-ish), especially in natural language tasks and computer vision tasks. One of the attractive aspect of DL is that these models can be end-to-end, meaning we do not need to do manual feature engineering. There are numerous types of DL algorithms, like Deep neural networs, convolutional neural networks, GRU, LSTM, GAN, attention, transfromer etc.
Deep RL uses deep NN architectures to replace the tabular methods for very high dimensional problems. Informally speaking, the controller is no longer a table look-up rather we use a deep NN as the controller. Because of leveraging deep NN in RL this is commonly known as deep RL.
roughly speaking:
deep learning uses deep neural networks to approximate complicated functions.
reinforcement learning is a branch in machine learning where your learner learns through interaction with environment. It is different from supervised or unsupervised learning.
if you use deep learning to approximate functions in reinforcement learning you call it deep reinforcement learning.
Reinforcement learning is a type of artificial intelligence that aims to model human-like decision-making. It's based on the idea that humans learn from their actions and reward themselves for doing things that are good, and punish themselves for doing things that are bad. Reinforcement learning algorithms try to replicate this process by changing the value of some variable in response to an action.
Deep learning is a type of machine learning model which uses multiple layers of processing to solve problems more effectively than traditional approaches. Deep learning models can be used for image recognition, speech recognition, and translation.
Deep reinforcement learning is a type of deep learning model that tries to solve problems by using sequences of actions called episodes to improve over time as well as by comparing results from different episodes. It's also known as Q-learning because it was first described by Richard Sutton in 1997 using the Q function (the fourth derivative).
Q-learning is a particular type of deep reinforcement learning algorithm that makes use of Q values (quantified measures) instead of actual rewards or penalties, which means it can be used without having access to real data or rewards/penalties yet still produce useful results

Machine learning algorithm for few samples and features

I am intended to do a yes/no classifier. The problem is that the data does not come from me, so I have to work with what I have been given. I have around 150 samples, each sample contains 3 features, these features are continuous numeric variables. I know the dataset is quite small. I would like to make you two questions:
A) What would be the best machine learning algorithm for this? SVM? a neural network? All that I have read seems to require a big dataset.
B)I could make the dataset a little bit bigger by adding some samples that do not contain all the features, only one or two. I have read that you can use sparse vectors in this case, is this possible with every machine learning algorithm? (I have seen them in SVM)
Thanks a lot for your help!!!
My recommendation is to use a simple and straightforward algorithm, like decision tree or logistic regression, although, the ones you refer to should work equally well.
The dataset size shouldn't be a problem, given that you have far more samples than variables. But having more data always helps.
Naive Bayes is a good choice for a situation when there are few training examples. When compared to logistic regression, it was shown by Ng and Jordan that Naive Bayes converges towards its optimum performance faster with fewer training examples. (See section 4 of this book chapter.) Informally speaking, Naive Bayes models a joint probability distribution that performs better in this situation.
Do not use a decision tree in this situation. Decision trees have a tendency to overfit, a problem that is exacerbated when you have little training data.

What is Reinforcement machine learning?

I know about supervised and unsupervised learning but still not getting how Reinforcement machine learning works.
can somebody help me with proper example ? and use cases that how it works ?
Reinforcement machine learning is when the machine learns from experience, where the feedback is "good" or "bad".
A classic example is when training agents for games. You first start training your agent with the data you have (supervised), and when it is exhausted, start training several agents and let the compete each other. Those who win are getting "reinforced", and go on.
This was one of the "tricks" used to train AlphaGo, (and previously in TD-Gammon)
...
The policy networks were therefore
improved by letting them play against each other, using the outcome of
these games as a training signal. This is called reinforcement
learning, or even deep reinforcement learning (because the networks
being trained are deep).
You mentioned about supervised and unsupervised learning.
There is a slight difference in these 3.
Supervised learning: You have label for each tuple of data.
Unsupervised learning: You don't have label for tuples but you want to find relations between inputs
Reinforcement leaning: You have very few labels for sparse entries. that label is rewards.
reinforcement learning is a process how a person learns about a new situation. it takes any random action, observe the behavior of the environment and learns accordingly.
What is a reward.?
a reward is positive or negative feedback from the environment. An action is responsible for all its future rewards. hence it need to take those action which can achieve most positive reward in future.
This can be achieve by Q-learning algorithm. i request you to check about this topic.
I used reinforcement algorithm to train pacman. i hope you know the game. the goal is to take action by which it should not hit the ghosts and also should be able to take all points from the map. it train itself after many iterations and thousands of gameplay. I also used same to train a car to drive on a specific track!
The reinforcement learning can be used to train an AI to learn any game.! Though more complex games require Neural Networks, and that is called Deep learning.
Reinforcement learning is a type of model that is rewarded for doing good (or bad) things. With supervised learning, it is up to some curator to label all the data that the model can learn from. That is the beauty of reinforcement learning, the model obtains direct feedback from its environment and adjusts its behavior automatically. It's how human's learn a lot of our simple life lessons (e.g., avoid things that hurt you, do more of things that make you feel good)
A lot of reinforcement learning is focused around deep learning these days and the biggest examples have been about video games. Reinforcement learning is also a powerful personalization tool. You can think of an amazon recommender as a reinforcement learning algorithm that is rewarded when it recommends the right products by receiving a click or purchase, or a netflix recommender is rewarded when a user starts watching a movie.
Reinforcement learning is often used for robotics, gaming, and navigation.
With reinforcement learning, the algorithm discovers through trial and error which actions yield the greatest rewards.
This type of learning has three primary components: the agent (the learner or decision-maker), the environment (everything the agent interacts with) and actions (what the agent can do).
The objective is for the agent to choose actions that maximize the expected reward over a given amount of time.
The agent will reach the goal much faster by following a good policy. So the goal in reinforcement learning is to learn the best policy.

How to approach a machine learning programming competition

Many machine learning competitions are held in Kaggle where a training set and a set of features and a test set is given whose output label is to be decided based by utilizing a training set.
It is pretty clear that here supervised learning algorithms like decision tree, SVM etc. are applicable. My question is, how should I start to approach such problems, I mean whether to start with decision tree or SVM or some other algorithm or is there is any other approach i.e. how will I decide?
So, I had never heard of Kaggle until reading your post--thank you so much, it looks awesome. Upon exploring their site, I found a portion that will guide you well. On the competitions page (click all competitions), you see Digit Recognizer and Facial Keypoints Detection, both of which are competitions, but are there for educational purposes, tutorials are provided (tutorial isn't available for the facial keypoints detection yet, as the competition is in its infancy. In addition to the general forums, competitions have forums also, which I imagine is very helpful.
If you're interesting in the mathematical foundations of machine learning, and are relatively new to it, may I suggest Bayesian Reasoning and Machine Learning. It's no cakewalk, but it's much friendlier than its counterparts, without a loss of rigor.
EDIT:
I found the tutorials page on Kaggle, which seems to be a summary of all of their tutorials. Additionally, scikit-learn, a python library, offers a ton of descriptions/explanations of machine learning algorithms.
This cheatsheet http://peekaboo-vision.blogspot.pt/2013/01/machine-learning-cheat-sheet-for-scikit.html is a good starting point. In my experience using several algorithms at the same time can often give better results, eg logistic regression and svm where the results of each one have a predefined weight. And test, test, test ;)
There is No Free Lunch in data mining. You won't know which methods work best until you try lots of them.
That being said, there is also a trade-off between understandability and accuracy in data mining. Decision Trees and KNN tend to be understandable, but less accurate than SVM or Random Forests. Kaggle looks for high accuracy over understandability.
It also depends on the number of attributes. Some learners can handle many attributes, like SVM, whereas others are slow with many attributes, like neural nets.
You can shrink the number of attributes by using PCA, which has helped in several Kaggle competitions.

Resources