FMU getState/setState for model exchange with PyFMI - fmi

I'm involved in a project in which I use a model exchange FMU. I'm using PyFMI to interact with it. One of the things that I need to do is get the state of the model at certain time ( get_fmu_state() is the function in PyFMI) and restore it later (set_fmu_state(state)). The flag "canGetAndSetFMUstate" is activated.
The use of these sentences seem to do nothing in my code...is it neccesary to do something more?
I didn't find any example that shows that capability. The FMI specification (https://www.fmi-standard.org) only dedicates a few lines to that feature.
Have you ever deal with this feature?
Thanks in advance.
Regards,
Ignacio.

Related

Python sentiment / text analysis advice

I don't know if this is the right place to ask this but, i am trying to build a bot in Python that will read incoming messages on a Slack channel where customer post their issues such as 'unable to connect to VPN', 'can someone reply to my ticket' etc…
The bot will analyze the message, determine if the customer is angry or not, and then propose a solution until an agent is free to actually check the issue.
Now, I was experimenting with TextBlob for the sentiment analysis part, but I don't know which technologies to actually use to determine the issue based on specific keywords and provide a solution to the user. Can someone propose me some python libraries/technologies that I could use to achieve this ?
To be honest your question is to generic to answer in one go.
Nontheless, you first have to clearly define the scope of your project. In doing so, you might want to first do a quick literaty review (Google Scholar) to familiarize with the state of the art technologies and methods.
From my little experience, a common (maybe simple) technique (lexicon-based approach) used to determine the sentiment of a word, is to use a pre-compiled dictionary (you can create your own though) that contains words - sentiment mappings. For example:
word:tired, sentiment:negative, score:5
So each time the bot finds the keyword "tired" in a sentence it will assign its corresponding negative value (polarity) to the sentence.
You might want to consider applying POS tags in the input text, as sometimes nouns or ``verbs carry significant meaning, compared to adjectives for example.
Keep in mind though, that negative comments can be written in the form of sarcasm. Sarcasm detectioin is a more difficult task though.
Alternatively, you could try using a pre-trained model such as bert-base-multilingual-uncased-sentiment that can be found here in Hugging Face.
For more information on the matter you have a look at this post.
Again as I mentioned, you have to clearly define your goals. This will enable you to specify the libraries or methodology available to solve your problem. Hope my answer helps.

How to save keras model in different formats

I am new to this field, this question might look dumb to some of you but please bear with it.
I have created a keras model which works well. I can save it in .hdf5 format using model.save("model_name.hdf5) which is good.
Main question is if there is any other format i can save my model in so that it can be used in c++/android/JavaScript. Is this even possible to do so?? If you are thinking why I am asking for all 3 languages, its because I have 3 projects each of them use respective language.
Thanks for any help in advance.
The answer depends on what you are going to save and use in another language.
If you just need the architecture of the model to be saved, you may save it as JSON, which can later be used in any other platform and language you are going to use.
model_json = model.to_json()
If you also need the weights and biases, I do not know any specific tool, but you can simply read the stored data in python, create a multidimensional array, and then save it in a file appropriate for any of the languages you need. For example, the weights of the second layer can be found in model.layers[2].get_weights().
Finally, if you want to run the model in another language, you need to implement the for-loops that make the processing. You might find some conversion tools for your target language. For example, for C, this tool can help.

Data set for predictive/preventive manufacturing

I'm eager to try out some more with Microsoft Azure Machine Learning and would like to find a data set to make a use case concerning predictive manufacturing. Microsoft already offers a data set (semi conductor) for a use case like this, but I would like to try out some more. Does anybody of you know where I can find another data set similiar to the one provided by MS?
Basically I'm looking for a bunch of sensor data in a manufacturing process and a classification whether it came to a failure or not.
Your help would be greatly appreciated ;)
Thanks,
Clemens
This blog post contains interesting sources of data that you can use with Azure ML. From the post:
Data.gov – http://www.data.gov/
Kaggle - http://www.kaggle.com/
UCI Machine Learning Repository - http://archive.ics.uci.edu/ml/
Specifically, you could check out the manufacturing data set on data.gov.

Voice authentication

I am stuck in big problem, because I don't have any idea or example how to do it.
What i need to do is compare two voices, eg:
person 1 said "hello"
person 2 said "hello"
after that if person 1 say again "hello" system should be able to identify whether it's person 1 or person 2 (it is like voice authentication system).
I need to do this in C# or C++.
I found that "Microsoft speech API" and "synthetic toolkit" will help full for my task but I didn't found good tutorial or way to do it. Can anyone please help to success this task
If you're just looking for a library that will help you with this, check this page out.
http://en.wikipedia.org/wiki/List_of_speech_recognition_software
If your actual job is creating speech recognition code from scratch, then you're going to have a much more difficult job. Especially since there are several different routes you can go. Nearly all of them require some kind of feature extraction though (fft for example). So make sure you've prepped up on your signal processing methods. After you've extracted your features you can begin implementing several different methods. Hidden-markov models, neural networks (of many different varieties..), cross correlation...
Hidden markov model paper
http://mi.eng.cam.ac.uk/~mjfg/mjfg_NOW.pdf

Open source projects for email scrubbing generating structured data from unstructured source?

Don't know where to start on this one so hopefully you guys can clear up my question. I have project where email will be searched for specific words/patterns and stored in a structured manner. Something that is done with Trip it.
The article states that they developed a DataMapper
The DataMapper is responsible for taking inbound email messages
addressed to plans [at] tripit.com and transforming them from the
semi-structured format you see in your mail reader into a highly
structured XML document.
There is a comment that also states
If you're looking to build this yourself, reading a little bit about
Wrappers and Wrapper Induction might be helpful
I Googled and read about wrapper induction but it was just too broad of a definition and didn't help me understand how one would go about solving such problem.
Is there some open source project out there that does similar things?
There are a couple of different ways and things you can do to accomplish this.
The first part, which involves getting access to the email content I'll not answer here. Basically, I'll assume that you have access to the text of emails, and if you don't there are some libraries that allow you to connect java to an email box like camel (http://camel.apache.org/mail.html).
So now you've got the email so then what?
A handy thing that could help is that lingpipe (http://alias-i.com/lingpipe/) has an entity recognizer that you can populate with your own terms. Specifically, look at some of their extraction tutorials and their dictionary extractor (http://alias-i.com/lingpipe/demos/tutorial/ne/read-me.html) So inside of the lingpipe dictionary extractor (http://alias-i.com/lingpipe/docs/api/com/aliasi/dict/ExactDictionaryChunker.html) you'd simply import the terms you're interested in and use that to associate labels with an email.
You might also find the following question helpful: Dictionary-Based Named Entity Recognition with zero edit distance: LingPipe, Lucene or what?
Really a very broad question, but I can try to give you some general ideas, which might be enough to get started. Basically, it sounds like you're talking about an elaborate parsing problem - scanning through the text and looking to apply meaning to specific chunks. Depending on what exactly you're looking for, you might get some good mileage out of a few regular expressions to start - things like phone numbers, email addresses, and dates have fairly standard structures that should be matchable. Other data points might benefit from some indicator words - the phrase "departing from" might indicate that what follows is an address. The natural language processing community also has a large tool set available for text processing - check out things like parts of speech taggers and semantic analyzers if they're appropriate to what you're trying to do.
Armed with those techniques, you can follow a basic iterative development process: For each data point in your expected output structure, define some simple rules for how to capture it. Then, run the application over a batch of test data and see which samples didn't capture that datum. Look at the samples and revise your rules to catch those samples. Repeat until the extractor reaches an acceptable level of accuracy.
Depending on the specifics of your problem, there may be machine learning techniques that can automate much of that process for you.

Resources