Skip to content

Instantly share code, notes, and snippets.

Nexosis Ops nexosisops

View GitHub Profile
@nexosisops
nexosisops / nexosis_client_sample_powershell.ps1
Last active Feb 12, 2018
Nexosis Powershell Client Sample
View nexosis_client_sample_powershell.ps1
# Submit dataset
Import-NexosisDataSetFromCsv `
-dataSetName 'widget-sales' `
-csvFilePath 'sales-file.csv'
# Create a forecast session
$session = Start-NexosisForecastSession `
-dataSetName 'widget-sales' `
-targetColumn 'daily_transaction' `
-startDate 2017-12-12 `
@nexosisops
nexosisops / anomalies.sh
Last active Jan 12, 2018
Anomalies Quick Start
View anomalies.sh
# Depends on Python3
# Add your Nexosis api key before executing
apiKey="YOUR API KEY HERE"
baseUrl="https://ml.nexosis.com/v1"
curl -s -H "api-key: $apiKey" -X POST "$baseUrl/imports/url" \
-H "Content-Type: application/json" \
-d '{"dataSetName":"cardio","url":"https://raw.githubusercontent.com/Nexosis/sampledata/master/cardio.json"}'
sleep 10s
View Invoke-CalculateCsGoStatsForSteamId.ps1
Function Invoke-GetCsGoMetricsBySteamId {
Param(
$steamId
)
try {
"Processing Steam ID $steamId" | Write-Verbose
if ($env:steamApiKey -eq $null) {
'You must set the $env:steamApiKey variable before running this command:' | Write-Host
View nexosis_client_sample_ruby.rb
# Submitting dataset
data = CSV.open('sales-file.csv','rb', headers: true)
NexosisApi.client.create_dataset_csv 'widget-sales', data
# Creating a forecast session
session = NexosisApi.client.create_forecast_session(
'widget-sales',
'2017-12-12',
'2017-12-22',
'daily_transaction'
View nexosis_client_sample_scala.scala
// Submit dataset
val client = new NexosisClient()
client.getDataSets.create("widget-sales", new FileInputStream("./sales-file.csv"))
// Creating a forecast session
val session = client.getSessions.createForecast(
"widget-sales",
"daily_transaction",
DateTime.parse("2017-12-12T0:00:00Z"),
DateTime.parse("2017-12-22T0:00:00Z"),
@nexosisops
nexosisops / nexosis_client_sample_python.py
Last active Jan 24, 2018
Nexosis Python Client Sample
View nexosis_client_sample_python.py
# Submit dataset
client = nexosisapi.Client()
with open('sales-file.csv') as f:
result = client.datasets.create_csv('widget-sales', f)
# Create a forecast for the next 30 days on the 'sales' column
session = client.sessions.create_forecast(
'widget-sales',
'daily_transaction',
date_parser.parse('2017-12-12 00:00:00 -0:00'),
View nexosis_client_sample_javascript.js
// Submit dataset
const NexosisClient = require('nexosis-api-client').default;
const client = new NexosisClient({key: process.env.NEXOSIS_API_KEY});
client.DataSets.create('widget-sales', readDataFrom(csvFile));
// Create a forecast session
let session = {};
client.Sessions.createForecast(
'widget-sales',
moment().startOf('day'),
View nexosis_client_sample_java.java
// Submit dataset
NexosisClient client = new NexosisClient();
InputStream inputStream = new FileInputStream(new File("./sales-file.csv"));
client.getDataSets().create("widget-sales", inputStream);
// Creating a forecast session
SessionResponse response = nexosisClient.getSessions().createForecast(
"widget-sales",
"daily_transaction",
DateTime.parse("2017-12-12T0:00:00Z"),
View nexosis_client_sample_csharp.cs
// Create client
var client = new NexosisClient();
// Submit dataset
client.DataSets.Create("widget-sales", DataSet.From(File.OpenText("C:\\path\\to\\sales-file.csv")));
// Creating a forecast session
var sessionResponse = client.Sessions.CreateForecast(
Sessions.Forecast(
"widget-sales",
DateTimeOffset.Parse("2017-12-12 10:11:12 -0:00"),
You can’t perform that action at this time.