Last active
July 21, 2020 22:26
-
-
Save darrenjrobinson/8ad338b5fb8c59503c0ec3a1fb2902c5 to your computer and use it in GitHub Desktop.
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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