Breaking down FileMaker’s new (and really easy) way to implement machine learning.
With the release of FileMaker 19, an extremely easy way to implement very complex machine learning has been made available to MacOS and iOS FileMaker custom apps. Machine Learning offers the ability to automate “identification and analysis” processes by using trained machine learning “models”. With FileMaker, it’s now easy to script an entire decision tree with both machine learning and human interaction; Leading to very powerful workflows that can ensure a high quality of data.
These models can be implemented to replace tasks that usually require human interaction to complete. One example of this is Sentiment Analysis, which can be used to gauge the tone of an email and automatically escalate it if the tone is determined to be angry. Another use case would be the identification of an uploaded picture, to determine if the content is likely to match the requested picture content. There are many use cases that can lead to significant savings in time for human interaction.
Since FileMaker’s CoreML functionality takes advantage of recent iOS 11+ and MacOS 10.13+ updates that introduced the CoreML framework, FileMaker’s CoreML functionality is limited to iOS and MacOS as well. This should especially be taken into consideration for Windows and Linux FileMaker servers, as server-side scripts (Schedules and “Perform Script on Server”) will not be able to load CoreML functions).
So just how easy is it to implement these machine learning models with FileMaker? It’s just three easy steps:
Step 1: The Configure Machine Learning Model script step. You will utilize this script step to “install” a machine learning model, stored in a container field, into a named session object that can be used in Step 2. The script step has a number of parameters:
Step 2: The ComputeModel() function. This new function is used to take a loaded machine learning model (by name) and passing it specific contents for machine learning processing. The first parameter to this function is modelName, which is provided from Step 1 above. Other parameters to this function are flexible by using [Key;Value] pair parameters (same as with other functions like Substitute() that support flexible parameters).
So a ComputeModel() function that passes three parameters for estimating the cost of a house may look like this:
ComputeModel( “estimatePrice” ; [ “zipCode” ; “43215” ] ; [ “bedrooms” ; 3 ] ; [ “bathrooms” ; 2 ] )
Or a function that passes an image for analysis may look something like this:
ComputeModel( “isThisAToaster” ; “image” ; MyTable::ImageField )
An additional note for Vision type CoreML models is that they also support two additional features that can limit the number of results returned. This is important as some machine learning models for image analysis can return thousands of results (for instance, if you had a vision model that returned the coordinates of all the green pixels in an image). These two additional parameters are:
Step 3: Evaluate the model results. For the majority of use cases, the above ComputeModel() function will be used in a Set Variable or Set Field script step so that the results of the machine learning analysis can be checked. Results from most machine learning models are returned as JSON, so it’s quite easy with FileMaker’s native JSON functions to process the model results.
For example, if I passed this calculation with my vision model to identify toasters in an image:
ComputeModel( “locateToasters” ; [“image” ; MyTable::ImageField] ; [“confidenceLowerLimit” ; 1] ; [“returnAtLeastOne” ; 1] )
I would get the result with the highest confidence similar to this:
[{"location":"upper-left","confidence":0.920526770564}]
And I would be able to create a simple script that marks the toaster location in my record:
Set Variable [ $result ; JSONGetElement( ComputeModel ( etc…) ; 0 ) ]
If [ JSONGetElement( $result ; “confidence” ) > .75 ]
Set Field [ MyTable::ToasterDetails ; “There is a toaster located in the “ & JSONGetElement( $result ; “location” ) & “ of the picture.” ]
End If
That’s it! Easy machine learning integration with just a few steps in FileMaker 19! Do you have ideas for how you would use machine learning? Please comment below.