Consuming Azure ML web api endpoint from an array
September 23, 2014 4 Comments
Last week, I blogged about creating an Azure ML experiment, publishing it as a web service, and then consuming it from F#. I then wanted to consume the web service using an array β passing in several values and seeing the results. I created added on to my existing F #script with the following code
1 let input1 = new Dictionary<string,string>() 2 input1.Add("Zip Code","27519") 3 input1.Add("Race","W") 4 input1.Add("Party","UNA") 5 input1.Add("Gender","M") 6 input1.Add("Age","45") 7 input1.Add("Voted Ind","1") 8 9 let input2 = new Dictionary<string,string>() 10 input2.Add("Zip Code","27519") 11 input2.Add("Race","W") 12 input2.Add("Party","D") 13 input2.Add("Gender","F") 14 input2.Add("Age","47") 15 input2.Add("Voted Ind","1") 16 17 let inputs = new List<Dictionary<string,string>>() 18 inputs.Add(input1) 19 inputs.Add(input2) 20 21 inputs 22 |> Seq.map(fun i -> invokeService(i)) 23 |> Async.Parallel 24 |> Async.RunSynchronously 25
And sure enough, I can run the model using multiple inputs:
Hi Jamie, I hope you’re well. Could you please email me on ian@mercurypress.co.uk as we’d love to put a story together on your Eject-a-Bed creation for the UK press. Kind regards, Ian Mitchelmore.
Pingback: Phil Trelford's Array
Pingback: Links of the month (September Edition) | Jan @ Development
Pingback: F# Weekly #39-41, 2014 | Sergey Tihon's Blog