Last week, Deephaven announced its URI package. A URI is a sequence of characters that identifies a resource on the web. Think of a URI as a generalization of a URL. A Deephaven URI identifies a table. By linking to a URI, you share your results with others without them needing to replicate your setup or know the details of your queries.
It takes one import and one line of code to resolve a URI:
from deephaven.uri import resolve
shared_table = resolve(f"dh+plain://{your_host}:{your_port}/scope/{your_table})
This is the sixth and final blog in the series of real-time crypto price predictions with AI. In this blog, I’ll share my results with URIs.
- Acquire up-to-date crypto data with Apache Airflow
- Implement an LSTM model with TensorFlow
- Implement a linear regression model with Nvidia RAPIDS
- Test the models on simulated real-time data
- Implement the models on real-time crypto data from Coinbase
- Share AI predictions with URIs
I’ve already built, tested, and deployed my AI models. My results are worth sharing, and Deephaven’s URIs make it easy to do just that. All I need is the URI for a consumer to resolve.
If I want to share my results locally, I need three pieces of information:
- The container name
- The port on which Deephaven is being run
- The table name
In my case, the container in which my predictions were made is called crypto-predictor
, the port is 10000, and the table name (as we saw in the previous blog) is real_time_prediction
. With that information, anyone with access to my local machine can get my results without having to do any of the tedious work machine learning is known for.
from deephaven.uri import resolve
container = "crypto-predictor"
port = 10_000
table = "real_time_prediction"
jeremiahs_predictions = resolve(f"dh+plain://{container}:{port}/scope/{table}")
If I alone have access to my local machine, then I could share the table across a private network, or even publicly. In this case, I need the IP/hostname of my machine rather than the container name. Just like before, a consumer could resolve my table with a URI:
from deephaven.uri import resolve
hostname = "jeremiahs-computer"
port = 10_000
table = "real_time_prediction"
jeremiahs_predictions = resolve(f"dh+plain://{hostname}:{port}/scope/{table}")
URIs can also be used to resolve CSV and Parquet files. For the former, they can be resolved from a local or remote source. For the latter, they must be local. Try it for yourself! We have tons of data in CSV and Parquet format over at our Examples repository.
I hope this blog series has given you some inspiration to build cool applications with Deephaven. Whether you want to use AI to predict crypto prices like me, or carve your own path, Deephaven has the tools to accomplish your goals. Don’t hesitate to reach out to us on Slack if you have any questions or feedback for us.
Source link
lol