Skip to content

Commit

Permalink
Changed path of mock files, updated README, and improved website.
Browse files Browse the repository at this point in the history
  • Loading branch information
MMenchero committed Jan 5, 2024
1 parent 8bd58c4 commit fa628b2
Show file tree
Hide file tree
Showing 11 changed files with 58,995 additions and 71 deletions.
77 changes: 47 additions & 30 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ output: github_document

<!-- README.md is generated from README.Rmd. Please edit that file -->

```{r, include = FALSE}
```{r setup, include=FALSE}
library(httptest2)
start_vignette("mocks")
options("TIMEGPT_TOKEN"="dummy_token")
options(digits=7)
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
Expand All @@ -13,10 +19,6 @@ knitr::opts_chunk$set(
)
```

# nixtlar

The `nixtlar` package provides R users with a SDK for [Nixtla's TimeGPT API](https://docs.nixtla.io/).

<!-- logo -->
# nixtlar <a href="https://nixtla.github.io/nixtlar/"><img src="man/figures/logo.png" align="right" height="139" alt="nixtlar website" /></a>

Expand All @@ -26,49 +28,64 @@ The `nixtlar` package provides R users with a SDK for [Nixtla's TimeGPT API](htt
[![License](https://img.shields.io/badge/License-Apache%202.0-blue)](https://www.apache.org/licenses/LICENSE-2.0)
<!-- badges: end -->

The `nixtlar` package provides R users with a SDK for [Nixtla's TimeGPT](https://docs.nixtla.io/).

## 🔄 nixtlar: Your Gateway to TimeGPT from R
### Your gateway to TimeGPT

With `nixtlar` you can easily interact with TimeGPT through simple API calls, making the power of TimeGPT readily accessible in your projects. Learn more about TimeGPT [here](https://arxiv.org/abs/2310.03589).
TimeGPT is a cutting-edge generative pre-trained transformer model that has been trained on the largest collection of publicly available time series data. Accessible to R users via the `nixtlar package`, TimeGPT democratizes forecasting, enabling rapid and accurate predictions, even for datasets not seen during training. Learn more about TimeGPT [here](https://arxiv.org/abs/2310.03589).

## 💻 Installation
### Installation

You can install the development version of `nixtlar` from [GitHub](https://github.com/) with:

``` r
```{r eval=FALSE}
# install.packages("devtools")
#devtools::install_github("MMenchero/nixtlar")
devtools::install_github("Nixtla/nixtlar")
```

## 🎈Quick Start
### Example

To use TimeGPT, you first need to request a token from Nixtla. You can do this at https://dashboard.nixtla.io/.
Get started with TimeGPT now.

Once you have the token, you'll need to set it up in your R session. The `nixtlar` package provides a function to do this.
```{r}
#library(nixtlar)
library(nixtlar)
# Set up token
#set_token("YOUR_TOKEN")
```
# Load sample dataset
df <- nixtlar::electricity # this can also be a tsibble!
You'll need to set the token every time you re-start your R session. `nixtlar` also includes a function to validate the token.
# Set TIMEGPT Token
nixtlar::nixtla_set_token("TIMEGPT TOKEN")
```{r}
# Validate token
#validate_token("YOUR_TOKEN")
# Forecast the next 8 steps using TimeGPT
fcst <- nixtlar::timegpt_forecast(df, h = 8, id_col = "unique_id", level = c(80,95))
# Plot TimeGPT forecast
nixtlar::timegpt_plot(df, fcst, h = 8, id_col = "unique_id", max_insample_length = 100)
```

You don't need to validate the token every time you set it up, only when you want to ensure its validity.
Using TimeGPT through `nixtlar` requires a token provided by Nixtla. To see how to obtain it and learn about different ways to set it up, please read the [Get Started](https://nixtla.github.io/nixtlar/articles/get-started.html) guide. Here, you can also find a more detailed explanation of how the forecast and plot functions work.

`nixtlar provides` an easy-to-use function to call the TimeGPT API. It works with both [tsibbles](https://tsibble.tidyverts.org/) and base R data frames.
### Main features of `nixtlar`

```{r}
# Call the TimeGPT API
#df <- tssible::as_tsibble(AirPassengers) # df can also be a data frame
- Works with both data frames and [tsibbles](https://tsibble.tidyverts.org/).

#timegpt_forecast(df, h=8, freq=12, time_col="index", target_col="value")
```
- Allows you to use TimeGPT's main features, including:
- Anomaly detection
- Exogenous variables
- Prediction intervals
- Finetuning
- Multiple time series
- Historical forecast
- Cross-validation

- Includes its own plot function.

Please read the **Articles** or check out the **Reference** to understand how you can use all these features.

## 🐍 Python SDK
Are you a Python user? If yes, then check out [NixtlaTS](https://github.com/Nixtla/nixtla), a Python SDK for TimeGPT and check out the [documentation](https://docs.nixtla.io/docs).
### Python SDK

Are you a Python user? If yes, then check out the [Python SDK for TimeGPT](https://github.com/Nixtla/nixtla).

```{r, include=FALSE}
end_vignette()
```
95 changes: 54 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# nixtlar

The `nixtlar` package provides R users with a SDK for [Nixtla’s TimeGPT
API](https://docs.nixtla.io/).

<!-- logo -->

# nixtlar <a href="https://nixtla.github.io/nixtlar/"><img src="man/figures/logo.png" align="right" height="139" alt="nixtlar website" /></a>
Expand All @@ -18,61 +12,80 @@ status](https://www.r-pkg.org/badges/version/nixtlar)](https://CRAN.R-project.or
[![License](https://img.shields.io/badge/License-Apache%202.0-blue)](https://www.apache.org/licenses/LICENSE-2.0)
<!-- badges: end -->

## 🔄 nixtlar: Your Gateway to TimeGPT from R
The `nixtlar` package provides R users with a SDK for [Nixtla’s
TimeGPT](https://docs.nixtla.io/).

## Your gateway to TimeGPT

With `nixtlar` you can easily interact with TimeGPT through simple API
calls, making the power of TimeGPT readily accessible in your projects.
Learn more about TimeGPT [here](https://arxiv.org/abs/2310.03589).
TimeGPT is a cutting-edge generative pre-trained transformer model that
has been trained on the largest collection of publicly available time
series data. Accessible to R users via the `nixtlar package`, TimeGPT
democratizes forecasting, enabling rapid and accurate predictions, even
for datasets not seen during training. Learn more about TimeGPT
[here](https://arxiv.org/abs/2310.03589).

## 💻 Installation
## Installation

You can install the development version of `nixtlar` from
[GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
#devtools::install_github("MMenchero/nixtlar")
devtools::install_github("Nixtla/nixtlar")
```

## 🎈Quick Start
## Example

To use TimeGPT, you first need to request a token from Nixtla. You can
do this at <https://dashboard.nixtla.io/>.

Once you have the token, you’ll need to set it up in your R session. The
`nixtlar` package provides a function to do this.
Get started with TimeGPT now.

``` r
#library(nixtlar)
library(nixtlar)

# Set up token
#set_token("YOUR_TOKEN")
```
# Load sample dataset
df <- nixtlar::electricity # can also be a tsibble!

You’ll need to set the token every time you re-start your R session.
`nixtlar` also includes a function to validate the token.
# Set TIMEGPT Token
nixtlar::nixtla_set_token("TIMEGPT TOKEN")
#> Token has been set for the current session.

``` r
# Validate token
#validate_token("YOUR_TOKEN")
# Forecast the next 8 horizons using TimeGPT
fcst <- nixtlar::timegpt_forecast(df, h = 8, id_col = "unique_id", level = c(80,95))
#> Frequency chosen: H

# Plot TimeGPT forecast
nixtlar::timegpt_plot(df, fcst, h = 8, id_col = "unique_id", max_insample_length = 100)
#> Frequency chosen: H
```

You don’t need to validate the token every time you set it up, only when
you want to ensure its validity.
<img src="man/figures/README-unnamed-chunk-2-1.png" width="100%" />

`nixtlar provides` an easy-to-use function to call the TimeGPT API. It
works with both [tsibbles](https://tsibble.tidyverts.org/) and base R
data frames.
Using TIMEGPT through `nixtlar` requires a token provided by Nixtla. To
see how to get it and different ways to set it up, please read the [Get
Started](https://nixtla.github.io/nixtlar/articles/get-started.html).
Here you can also find a more detailed explanation on how `nixtlar`’s
forecast and plot function work.

``` r
# Call the TimeGPT API
#df <- tssible::as_tsibble(AirPassengers) # df can also be a data frame
## Main features of `nixtlar`

#timegpt_forecast(df, h=8, freq=12, time_col="index", target_col="value")
```
- Works with both data frames and
[tsibbles](https://tsibble.tidyverts.org/).

- Allows you to use TimeGPT’s main features, including:

- Anomaly detection
- Exogenous variables
- Prediction intervals
- Finetuning
- Multiple time series
- Historical forecast
- Cross-validation

- Includes its own plot function.

Please read the **Articles** on this website or check out the
**Reference** to understand how you can use all these features.

## 🐍 Python SDK
## Python SDK

Are you a Python user? If yes, then check out
[NixtlaTS](https://github.com/Nixtla/nixtla), a Python SDK for TimeGPT
and check out the [documentation](https://docs.nixtla.io/docs).
Are you a Python user? If yes, then check out the [Python SDK for
TimeGPT](https://github.com/Nixtla/nixtla).
3 changes: 3 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ navbar:
- href: articles/cross-validation.html
- text: "Historical Forecast"
- href: articles/historical-forecast.html
right:
- icon: "fa-github"
href: https://github.com/Nixtla/nixtlar

home:
links:
Expand Down
Binary file added man/figures/README-unnamed-chunk-2-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions man/nixtlaR-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions tests/mocks/dashboard.nixtla.io/api/timegpt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"data": {
"timestamp": [
"2016-01-14 00:00:00",
"2016-01-15 00:00:00",
"2016-01-16 00:00:00",
"2016-01-17 00:00:00",
"2016-01-18 00:00:00",
"2016-01-19 00:00:00",
"2016-01-20 00:00:00"
],
"value": [
7.960582256317139,
7.7414960861206055,
7.728490352630615,
8.267574310302734,
8.543140411376953,
8.298713684082031,
8.105557441711426
],
"input_tokens": 43,
"output_tokens": 7,
"finetune_tokens": 0
},
"message": "success",
"details": "request successful",
"code": "B10",
"requestID": "CLC9LCNZL6",
"support": "If you have questions or need support, please email [email protected]"
}
Loading

0 comments on commit fa628b2

Please sign in to comment.