Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Get Prediction using H2O AI for an Iris using the H2OAI PowerShell Module. Associated Blogpost
# Default H2O AI Server running locally via Start-H2O
$url = "http://localhost:54321/3/{0}"
# Neural net algorithm for determining Iris type
$modelAlgorithm = 'deeplearning'
# Get Iris Training data and put on the local filesystem
Invoke-RestMethod -Method Get '' | out-file ./iris_wheader.csv
# Prediction Column
$predictValues = 'class'
# Data to make prediction from stored as a CSV on the local filesystem
sepal_len, sepal_wid, petal_len, petal_wid
"@ | out-file -encoding ASCII ./iris_predict.csv
# Send to H2O AI and get prediction
$dataPath = (Get-ChildItem ./iris_predict.csv).DirectoryName
$result = $null
$result = Get-H2OPrediction -url $url -dataset "$($dataPath)/iris_wheader.csv" -predictData "$($dataPath)/iris_predict.csv" -modelAlgorithm $modelAlgorithm -modelSplit ".85,.15" -predictColumn $predictValues
$result.prediction | Format-Table
label data
----- ----
predict {0}
Iris-setosa {0.999969054518561}
Iris-versicolor {3.09454814387964E-05}
Iris-virginica {2.15784441455808E-28}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.