This file contains hidden or 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
from deephaven import InputTable, TableInputHandler | |
namespace = 'OMSExample' | |
tradeTableName = 'Trades' | |
# Create the input table if it doesn’t exist | |
if not db.hasTable(namespace, tradeTableName): | |
InputTable.newInputTable(db, namespace, tradeTableName, | |
TableInputHandler.c("Symbol", "java.lang.String"), | |
TableInputHandler.cKey("Timestamp", "com.illumon.iris.db.tables.utils.DBDateTime"), |
This file contains hidden or 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
orders = ( | |
db.i('FeedOS', 'EquityQuoteL1').where("Date = currentDateNy()") | |
.update("rand = Math.random()", "Buy = rand > 0.9999", "Sell = rand < 0.0001") | |
.where("Buy = true || Sell = true") | |
.update("Shares = Buy ? (int) Math.round(Math.random() * 100) : (int) Math.round(Math.random() * -100)") | |
.view("Date", "Timestamp", "Symbol = LocalCodeStr", "Bid", "Ask", "Shares") | |
) |
This file contains hidden or 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
def unifrac(samp1, samp2, classes): | |
t1 = origTable.where(f"!({samp1}==0 && {samp2}==0)")\ | |
.view(samp1, samp2, "Taxonomy=Silva_Taxonomy+`;`+Name")\ | |
.update("Taxonomy = (String)fixTaxonomy.call(Taxonomy)",\ | |
"TaxArr = (String[])getTaxArr.call(Taxonomy)",\ | |
"Len = TaxArr.length") | |
for i, c in enumerate(classes): | |
t1 = t1.update(f"{c} = Len<{i+1} ? null : TaxArr[{i}]") |
This file contains hidden or 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
def jsd(samp1, samp2, pseudo): | |
t1 = pseudo.update(f"m = ({samp1} + {samp2}) / 2",\ | |
f"kld1 = {samp1} * log({samp1} / m)",\ | |
f"kld2 = {samp2} * log({samp2} / m)")\ | |
.by(AggCombo(AggSum("kld1", "kld2")))\ | |
.update("divergence = (0.5*kld1) + (0.5*kld2)") | |
return t1.getColumn("divergence").get(0) |
This file contains hidden or 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
from deephaven import * | |
client = PersistentQueryTableHelper.getClientForPersistentQuery(3*60*1000, owner="noormalik", name="EarningsCallSentimentAnalysis") | |
callPredictions = PersistentQueryTableHelper.getPreemptiveTableFromPersistentQuery("callPredictionsPre", helper=client) |
This file contains hidden or 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
# Run the following to get java details: R CMD javareconf | |
Sys.setenv(JAVA_HOME = | |
'/Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home/') | |
source(sprintf("%s/iris/.programfiles/%s/integrations/r/irisdb.R",home,system)) | |
idb.init(devroot = sprintf("%s/iris/.programfiles/%s/",home,system), | |
workspace = sprintf("%s/iris/workspaces/%s/workspaces/r/",home,system), | |
propfile = "iris-common.prop", | |
userHome = home, | |
keyfile = keyfile, |
This file contains hidden or 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
home <- "/Users/username" | |
system <- "Deephaven New" | |
keyfile <- sprintf("%s/priv.dh-demo.base64.txt",home) | |
workerHeapGB <- 4 | |
jvmHeapGB <- 2 | |
workerHost <- "dh-demo-query1.int.illumon.com" |
This file contains hidden or 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
--- | |
title: "StudentsPerformance" | |
output: html_document | |
--- | |
# Introduction | |
This project uses a public, synthesized exam scores dataset from Kaggle to analyze | |
the average scores in each subject relative to the student's parents' level of | |
education and whether the student took a preparation course before the exam. |
This file contains hidden or 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
# To see where the trend changes, we can add changepoints | |
add_changepoints_to_plot(fig1.gca(), m, forecast) |
This file contains hidden or 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
def prophet_plot(df): | |
m = Prophet() | |
m.fit(df) | |
# Make a forecast dataframe 1 year ahead | |
future = m.make_future_dataframe(periods=365) | |
forecast = m.predict(future) | |
# Return forecasted data, & component breakdown of forecasts |