How to add new training phrases to Rasa NLU dynamically? - rasa-nlu

I have trained a Rasa bot. I want to add new training phrases to an intent via code and trigger intent so that this new training phrases is available for next utterance. How do I do that?
Could not find any relevant reference in the Rasa documentation. In case of Rasa interactive learning, it seams it is a manual process where a human has to sit an train the model.

You cannot train your Rasa model dynamically. If you add new training examples to your NLU data, you need to retrain the model to have the model understand the new intents.
If you do interactive learning, you will generate new training data. That data can be used to re-train your model afterwards.

I think you can use an Interactive session with bot. By doing this you can train bot with some new utterance and new answers

Related

How to provide parameter input for interaction variable in H2OGradientBoostingEstimator?

I need to use the interaction variable feature of multiclass classification in H2OGradientBoostingEstimator in H2O in Python. I am not sure which parameter to use & how to use that. Can anyone please help me out with this?
Currently, I am using the below code -
pros_gbm = H2OGradientBoostingEstimator(nfolds=0,seed=1234, keep_cross_validation_predictions = False, ntrees=10, max_depth=3, learn_rate=0.01, distribution='multinomial')
hist_gbm = pros_gbm.train(x=predictors, y=target, training_frame=hf_train, validation_frame = hf_test,verbose=True)
GBM inherently creates interactions. You can extract information about feature interactions using the .feature_interaction() extractor method (for an H2O Model). More information is provided in the user guide and the Python docs.
If you want to explicitly add a new column that is the interaction between two numerics, you could create that manually by multiplying the two (or more) columns together to get a new interaction column.
For categorical interactions, there's also the the h2o.interaction() method in Python here to create interaction columns in the data (prior to sending it to the GBM or any algorithm).

How to Intent classification with similar examples in nlu.md in Rasa

I am developing chatbot using Rasa for a Contract Manager Organisation. I am facing few issues and after reading a lot on the forums and Rasa blog, I am unable to conclude to a solution for this. I have several similar intents with similar examples like -
“inform_supplier_start_date” and “inform_contract_start_date”.
“inform_supplier_email” and “inform_customer_email” and “inform_reviewer_email”
Now the issue is, for both the categories of intents the example sentence in nlu.md is same. What I exactly mean is-
##intent:inform_suppler_start_date
-what is the supplier [Microsoft] (supplier_name) start date
-[EON Digital] (supplier_name) start date
##intent:inform_contract_start
1) start-date of [O2 Mobile phones] (contract_name)
2) [O2 Mobile phones] (contract_name) start date
The model isnt able to differentiate and identify the correct intent. It is getting confused and identifying the wrong intent, since the words in these intents are similar.
I need correct intents to be recognised ,so that accordingly, In custom action i can query the Database and get the corresponding result for supplier and contract.
I have many fields like this for which the example data and user queries will be same. For Example-
customer_email & supplier_email & reviewer_email
total_spend_contract & total_spend_supplier & total_spend_customer
contract_number_for_supplier & contract_number_of_contract & contract_number_organisation
What exactly I should be doing to get correct classification. One solution i am thinking of is merging the intents like “supplier_start_date” and "contract_start_date" as one “start_date” and check for the extracted entity inside custom actions in both supplier and contract database. But I dont think that would be proper usage of Natural Language.
Please Suggest, I shall be highly greatful for the same. Regards.
As the examples for your intents are very similar, the model will not be able to differentiate between them. Also the intent is actual the same, inform_suppler_start_date and inform_contract_start inform the bot about a start date. What kind of start date it is should be figured out via the entity recognition. So I would propose to merge the similar intents and check what the entity recognition detected as entities. Depending on whether a supplier or a contract was found, you can execute query A or B.

How to tie entity recognition to intent prediction?

I'm having a problem with Rasa_NLU giving me the wrong entity for an intent. An example is “How do I get to New York?” Where, I tagged the training data to name the entity “city”. In a different intent, it was tagged “destination”.
intent: check_weather
what is the weather in new york?
intent: get_directions
how do I get to new york?
I have a script that takes action on the intent returned and processes the entities. If I get back the get_directions intent, I’ll look in the json for the destination entity, but it has city instead. Using ner_crf, is there a way to de-emphasize entities in an intent, so that the classifier is biased to those that the intent was trained for? That is, the classifier would be weighted to giving a destination for get_directions, and a city for get_weather?
The typical answer I've found is to add more training examples. I'm up to 60 for each of the two intents I have, and it is still getting it wrong.
As of right now, you can only featurize/unfeaturize all entities for a certain intent. I can see that that's not really your use case since both intents require entities -- just different ones. There is currently a community PR open to add per-intent featurization of specific entities, so it will be available in the future.

Communication.ContactName Entity not recognized in LUIS Intent

I have created several utterances in LUIS for an intent to create new meeting items in my application.
I have tagged the corresponding elements in the utterance to recognize the name of the invited person and the date / time of the meeting.
When I train the model and test it afterwards, date and time is recognized every time. Not so for the contactname. I have tried all possible things like adding the utterance as pattern, adding phrase lists, but no success.
What can I do, to make this work? Is there anythink I am missing?
If you're using simple entities, keep in mind that you'll need to train 10-15 utterances, and that there should be different names in all utterances. Using the same name repeatedly may cause faulty training.

Unable to understand correct use of None intent in LUIS

I have an app in LUIS with one intent "Help" (appart from None) and when I test it with utterances that my intent does not cover (e.g "Hi man"), LUIS resolves to the "Help" intent... I have no utterances in "None" intent...
What should I do? Should I add all the utterances I don't want to match "Help" intent in "None"?
Should I need to know everything a user can ask to my bot which is not related with "Help"?
For me, that's not make sense at all... and I think that is exactly how LUIS works...
Intent are the action which we define, None is predefined Intent which come along with every LUIS model that you create , coming back to your problem. You have only define one intent i.e "help" so whenever LUIS gets the any query it will show the highest scoring intent i.e. "help". whenever you create an intent make to sure to save at least 5-6 co-related utterance, so that LUIS can generate a pattern out of it 'more you define co-related utterance better accuracy of result you will get'
if you want LUIS to respond on "HI man" create a new intent 'greet' save some utterance let LUIS do the remaining task, lastly about None intent If any user input 'asdsafdasdsfdsf' string like this. Your bot should be able to handle it respond accordingly like 'this asdsafdasdsfdsf is irrelevant to me' in simple term 'any irregular action that user want bot to perform come under none intent' i hope this will help
You can check the score of the Luis intent and then accordingly send the default response from code. For the utterances which are configured will have a greater score. Also, Luis app shud be balanced in terms of utterances configured as there is not a defined way that u can point utterances to None intent. Please check this link for best practices.
https://learn.microsoft.com/en-us/azure/cognitive-services/luis/luis-concept-best-practices. Also to highlight Luis does not work in terms of keyword matching to the utterances which you have configured. It works in terms of data you add in Luis in respective intents.

Resources