Dialogflow Multi-Item Recognition - machine-learning

I am pretty new to Dialogflow, and I am building this food ordering chatbot.
The users can say
I want a chicken burrito.
or
I want two chicken burrito, one beef burger, two coca-cola, one french fries.
but the problem I am facing now is that Dialogflow can only match up to three items, e.g. I want two chicken burrito, one beef burger, two coca-cola. The recognition will just fail completely if there are more than three items to be matched in one sentence.
Any help would be much appreciated!

Related

Multi label text classification

I'm trying to do multi label text classification.
I have 18 categories.
for example facility, trash, over crowding, access, guide knowledge etc...
For each category , i need to do the sentimental analysis also.
For example :
A visit to Grand Teton National Park in northwestern Wyoming isn't complete without a trip to Antelope Flats, one of the most epic locations in the American West with views of the entire Teton Range and abundant wildlife. This 640-acre stretch of land was established to preserve critical habitats and migration routes for a variety of species. It also provides visitors with a taste of the Old West, complete with old homesteads and spectacular mountain views. From Jackson, drive north on Highway 189. After you pass Moose Junction (the entrance to Grand Teton National Park), you will see Blacktail Butte on your left. Drive a bit further and just beyond the butte you will see a right hand turn which is Antelope Flats Road. After several miles you will come to a junction with several structures on your left and a dirt road on your right. The structures are abandoned homesteaders' barns and houses from the turn of the 20th century, part of the famous Mormon Row barns. Take the dirt road another mile and you will find the T.A. Moulton Barn, one of the most famous in the world. Antelope Flats Road can be linked up to the Gros Ventre-Kelly Road for a big loop. This will take you through the small town of Kelly and along the Gros Ventre River. It's a great way to see moose, bison, pronghorn antelope, badgers, coyotes, the largest elk herd in the West, raptors and much more, a photographer's dream.
This is the example of the text giving to the model.
This text has multiple labels : it is related to multiple categories : scenery, experience , wild life ect..
Firstly i should have to categories into these multiple labels and then need to find out the sentiments for each category.
For example , for category trash alone, the user might have given a bad reviews, but for others a good review.
So overall sentiments of the text will be possitve.
I need to get the sentiment of the trash category alone, as an example.
How to do that?
My training data have the reviews which is mentioning mixed categories, and in each category column has 0,1, and NAs
0 = negative for the category
1 = positive for the category
Na : not mentioned of rthe category
Can anyone help me how to do this ?

Predicting Football match winners based only on previous data of same match

I'm a huge football(soccer) fan and interested in Machine Learning too. As a project for my ML course I'm trying to build a model that would predict the chance of winning for the home team, given the names of the home and away team.(I query my dataset and accordingly create datapoints based on previous matches between those 2 teams)
I have data for several seasons for all teams however I have the following issues that I would like some advice with.. The EPL(English Premier League) has 20teams which play each other at home and away (380 total games in a season). Thus, each season, any 2 teams play each other only twice.
I have data for the past 10+ years, resulting in 2*10=20 datapoints for the two teams. However I do not want to go past 3 years since I believe teams change quite considerably over time (ManCity, Liverpool) and this would only introduce more error into the system.
So this results in just around 6-8 data points for each pair of team. However, I do have several features(upto 20+) for each data point like Full-time goals, half time goals, passes, shots, yellows, reds, etc. for both teams so I can include features like recent form, recent home form, recent away form etc.
However the idea of just having only 6-8 datapoints to train with seems incorrect to me. Any thoughts on how I could counter this problem?(if this is a problem in the first place i.e.)
Thanks!
EDIT: FWIW, here's a link to my report which I compiled at the completion of my project. https://www.dropbox.com/s/ec4a66ytfkbsncz/report.pdf . It's not 'great' stuff but I think some of the observations I managed to elicit were pretty cool (like how my prediction worked very well for the Bundesliga because Bayern win the league all the time).
That's an interesting problem which I don't think has an unique solution. However, there are a couple of little things that I could try if I were in your position.
I share your concerning about 6-8 points per class being too little data to build a reliable model. So I would try to model the problem a bit differently. In order to have more data for each class, instead of having 20 classes I would have only two (home/away) and I would add two features, one for the team being home and other one for the away team. In that setup, you can still predict which team would win given if it is playing as home or away, and your problem has more data to produce a result.
Another idea would be to take data from other European leagues. Since now teams are a feature and not a class, it shouldn't add too much noise to your model and you could benefit from the additional data (assuming that those features are valid in another leagues)
I have some similar system - a good base for source data is football-data.co.uk.
I have used last N seasons for each league and built a model (believe me, more than 3 years is a must!). Depends on your criterial function - if criterion is best-fit or maximum profit you may build your own predicting model.
One very good thing to know is that each league is different, also bookmaker gives different home win odds on favorite in Belgium than in 5th English League, where you can find really value odds for instance.
Out of that you can compile interesting model, such as betting tips to beat bookmakers on specific matches, using your pattern and to have value bets. Or you can try to chase as much winning tips as you can, but possibly earns less (draws earn a lot of money even though less amount of draws is winning).
Hopefully I gave you some ideas, for more feel free to ask.
Don't know if this is still helpful, but features like Full-time goals, half time goals, passes, shots, yellows, reds, etc. are features that you don't have for the new match that you want to classify.
I would treat this as a classification problem (you want to classify the match in one of 3 categories: 1, X, or 2) and add more features that you can also apply to the new match. i.e: the number of missing players (due to injury/red cards), the number of wins/draws/losses each team has had in a row immediately BEFORE the match, which is the home team (already mentioned), goals scored in the last few matches home and away etc...
Having 6-8 matches is the real problem. This dataset is very small and there would be a lot of over-fitting, but if you use features like the ones I mentioned, I think you could also use older data.

Unsupervised Feature extraction of dishes by building tree structure of ingerdients with Natural Language Processing

I am building a recommendation system for dishes. Consider a user eating french fries and rates it a 5. Then I want to give a good rating to all the ingredients that the dish is made of. In the case of french fires the linked words should be "fried" "potato" "junk food" "salty" and so on. From the word Tsatsiki I want to extract "Cucumbers", "Yoghurt" "Garlic". From Yoghurt I want to extract Milk product, From Cucumbers vegetable and so on.
What is this problem called in Natural Language Processing and is there a way to address it?
I have no data at all, and I am thinking of building web crawler that analyzes the web for the dish. I would like it to be as little Ad-Hoc as possible and not necessarily in English. Is there a way, maybe in within deep learning to do the thing? I would not only a dish to be linked to the ingredients but also a category: junk food, vegetarian, Italian food and so on.
This type of problem is called ontology engineering or ontology building. For an example of a large ontology and how it's structured, you might check out something like YAGO. It seems like you are going to be building a boutique ontology for food and then overlaying a rating's system. I don't know of any ontologies out there of the form you're looking for, but there are relevant things out there you should take a look at, for example, this OWL-based food ontology and this recipe ontology.
Do you have a recipe like that:
Ingredients:
*Cucumbers
*Garlic
*Yoghurt
or like that:
Grate a cucumber or chop it. Add garlic and yoghurt.
If the former, your features have already been extracted. The next step would be to convert to a vector recommend other recipes. The simplest way would be to do (unsupervised) clustering of recipes.
If the latter, I suspect you can get away with a simple rule of thumb. Firstly, use a part-of-speech tagger to extract all the nouns in the recipe. This would extract all the ingredients and a bit more (e.g. kitchen appliances, cutlery, etc). Look up the nouns in a database of food ingredients database such as this one.

Rails Searching (Full text vs Semantic) for Food Products

I'm trying to build a search interface for a grocery store in Rails.
I have several grocery store products stored in my database, but I'm struggling to find a good way to search through them.
So far, I've used Thinking Sphinx to do full text searching of the products.
This works well for some items, such as 'eggs', but has several problems for other searches, such as 'lime'.
For example, when I search for 'lime', I get the following returned items:
Diet Sierra Mist Lemon Lime Fridge Mate Soda
G2 Lemon Lime Low Calorie Electrolyte Beverage
Deer Park Berry Lime Sparkling Water
Ocean Spray Cocktail With Lime Cranberry Juice
Vintage Seltzer Water Limn Lime
Coke Diet With Lime Soda Contour Bottle
Coke Diet With Lime Soda Fridge Pack
Diet Sierra Mist Lemon Lime Fridge Mate Soda
Refreshe Soda Diet Lemon Lime Fridge Pack
Refreshe Soda Lemon Lime
Refreshe Soda Lemon Lime Fridge Pack
Sierra Mist Natural Lemon Lime Soda
... etc
All I really wanted was the actual fruit, which are listed as these products in my database:
Limes Large
Organic Limes
Limes Key Prepacked
How can I make my search more intelligent?
It's worth noting that I do have a lot of categorical data on each product.
I essentially have an entire "food tree", where each product is a root node of the tree.
For the product 'Limes Large', for example, I have the following categories:
Fruits & Vegetables > Fresh Fruit > Citrus > Limes Large
How can I better use these categories to improve my search?
In my research, I am starting to believe I need to use semantic searching instead of full text searching.
I came across the Picky gem for Ruby, which looks promising, but I'm not sure if I have the right approach.
Can semantic searching help me perform a better search?
Is Picky a good fit for data categorized in this way? Any other insights?
Any guidance would be really appreciated. Thanks in advance.
I am the developer of Picky – so I am a bit biased ;)
Your question seems to be, if I understand correctly:
Given that I have products that contain the word "lime" in its name,
and given that some of those products are not categorized as fruit,
and some of those products are not categorized as fruit, but as
beverages, you'd like the user to be able to filter the query so to
only search for fruit.
I hope I understand correctly.
Picky's main mode is categorized search. That is, if somebody enters "lime fruit" in a query, Picky will find something like (name:lime, type:fruit), and all other combinations, eg. (company:lime, type:beverage). Or the user could already predefine through a nice interface, that he searches for fruits: "type:fruit lime", this would tell Picky to only look for results in type "fruit", and with "lime" in any category.
However, since you'd like to filter according to whether something is in a category or not, I think a faceted search is best suited for this kind of task. Picky recently got faceted search added. So you'd do something like:
picky_search.search "lime"
to display the results for lime, but also display all possible types for "lime" on the side using
picky_search.facets :type, filter: "lime"
You'd get a hash of possible types, like so: { :fruit => 3, :beverage => 150 }.
Then, if the user clicked on "fruit", you'd send Picky another query, this time with the prepended filter:
picky_search.search "type:fruit lime" or picky_search.search "type:fruit name:lime" if it's already clear that the person is searching in the name for "lime".
This would only return the lime of type fruit.
This is only a quick overview, I hope it helps!
As for the 'categories' you might want to think about using a tagging system also. There are a number of tagging gems out there. That way what is being searched on is roped off from any other data structures or 'trees' you have created.
In order to make it easy you could have it so that the tags that are automatically put on an item at creation are based on its location in the tree and or the items name. This makes it so could be easily changed if the need comes up, but at the same time have the ease of the tree system, while still having the tag system's power of narrow searches.
A good place to start would be bellow.
https://github.com/mbleigh/acts-as-taggable-on#readme
That way you can have something like Diet Sierra Mist Lemon Lime Fridge Mate Soda not tagged with Lemon so it wouldn't come up, but you could still tag something like Sunny D tagged with "Orange Juice." All while not making it to hard on your backend user by having default tags!
As for actually search it might just be worth it to look into using a google search system, while paying for no ads. You could use the tags as your keywords to narrow down the results. I believe this also helps with SEO while at the same time putting the search in google's hands, which means support is basically guaranteed.

How can I approach the Travelling Saleman Problem with multiple salesman?

Merged with Travelling Salesman with multiple salesmen?.
I have a problem that has been effectively reduced to a Travelling Salesman Problem with multiple salesman. I have a list of cities to visit from an initial location, and have to visit all cities with limited salesman.
I am trying to come up with a heuristic and was wondering if anyone could give a hand. For example, if I have 20 cities with 2 salesman, the approach that I thought of taking is a 2 step approach. First, divide the 20 cities up randomly into 10 cities for 2 salesman each, and I'd find the tour for each as if it were independent for a few iteratinos. Afterwards, I'd like to either swap or assign a city to another salesman and find the tour. Effectively, it'd be a TSP and then minimum makespan problem. The problem with this is that it'd be too slow and good neighborhood generation of swapping or assigning a city is hard.
Can anyone give an advise on how I could improve the above? Thanks.

Resources