Using trained models in script visuals
As you learned in Chapter 4, Importing Unhandled Data Objects, thanks to object serialization and its string representation, you can import any object into a Python or R visual in the form of a dataframe of strings. Once said dataframe is available in the script visual, you can revert it to the original object via inverse deserialization transformations. Since you can do what we described with any object, evidently you can also do it for machine learning models already trained outside of Power BI.
When the appropriately deserialized model is available in the script visual session, new observations can be predicted immediately using the scoring function described in the previous section.
The first thing you might ask yourself is what's the point of being able to score a dataset inside a script visual when the data must always be available first in the Power BI data model in order to use it in the visual. In fact, if the data of the observations...