Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get Prediction using H2O AI for an a Time Series Dataset using the H2OAI PowerShell Module. Associated Blogpost https://blog.darrenjrobinson.com/h2o-ai-powershell-module/
# Linear Regression Model
$modelAlgorithm = 'glm'
# Time Series Data
$dataCSV = "C:\data\A2B-AX-3y.csv"
$sourceData = Import-Csv $dataCSV
# Last Record as Prediction data
$dataPredict = Import-Csv -Path $dataCSV | Select-Object -Last 1 | export-csv ./dataPredict.csv
"Prediction Data"
Import-Csv -Path $dataCSV | Select-Object -Last 1
# Predict Value
$predictValues = 'Close'
$result = $null
$dataPath = (Get-ChildItem ./dataPredict.csv).DirectoryName
$result = Get-H2OPrediction -url $url -dataset $dataCSV -predictData "$($dataPath)/dataPredict.csv" -modelAlgorithm $modelAlgorithm -modelSplit ".85,.15" -predictColumn $predictValues
"Confidence: $($result.modelConfidence)"
"Prediction: $($result.prediction.data)"
<# OUTPUT
Prediction Data
Open : 1.46
High : 1.47
Close : 1.435
Low : 1.435
Volume : 17366
Date : 21-01-2020
Confidence: 0.000503095287004826
Prediction: 1.45785244828493
#>
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.