Using trained models in script visuals
As you learned in Chapter 5, Importing Unhandled Data Objects, thanks to object serialization and its string representation, you can import any object into a Python or R visual as a DataFrame of strings. Once this DataFrame is available in the script visual, you can convert it back to the original object using inverse deserialization transformations. Of course, since you can do what we’ve described with any object, you can also do it with ML models that have already been trained outside of Power BI.
When the appropriately deserialized model is available in the script visual session, new observations can be immediately predicted using the scoring function described in the previous section.
The first thing you might ask is what’s the point of being able to score a dataset within a script visual if the data always has to be available first in the Power BI data model to be used in the visual? In fact, if the data of the observations...