Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/token function #277

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2597d6c
WIP: request_df function
MMenchero Mar 29, 2024
d102511
WIP: Added new features to request_df
MMenchero Mar 30, 2024
00ebd23
WIP: Implemented request_df for cross validation
MMenchero Apr 2, 2024
ae51ae9
feat: Added request_df method
MMenchero Apr 2, 2024
c986141
Added request_df method to updated code
MMenchero Apr 2, 2024
8ffacdb
Tested request_df method with new code
MMenchero Apr 3, 2024
56c273c
Resolved merge conflicts
MMenchero Apr 3, 2024
b7dca49
Merged request_df method with new class
MMenchero Apr 3, 2024
67f9779
Cleaned notebooks
MMenchero Apr 3, 2024
8a030ec
Removed commented-out code
MMenchero Apr 3, 2024
db3b21d
Merge remote-tracking branch 'origin/main' into feat/token_function
MMenchero Apr 12, 2024
acd458a
Requested changes
MMenchero Apr 13, 2024
6be0563
Requested changes with clean nbs
MMenchero Apr 13, 2024
1666a1a
Minor fix
MMenchero Apr 18, 2024
62a7cd0
Minor fix for checks
MMenchero Apr 18, 2024
9ae9896
Minor fix, new version
MMenchero Apr 18, 2024
61c6a9b
Added missing file
MMenchero Apr 18, 2024
f40d6d6
New version to fix checks
MMenchero Apr 18, 2024
3b37422
Merge branch 'main' into feat/token_function
MMenchero Apr 18, 2024
1d6fdae
TEST: Trying to fix GA issue
MMenchero Apr 18, 2024
5ae4b34
TEST: Another fix for GA issue
MMenchero Apr 18, 2024
59be883
TEST: Different fix for GA issue
MMenchero Apr 18, 2024
4a4dab3
Merge branch 'main' into feat/token_function
MMenchero Apr 19, 2024
3dfb002
Merge branch 'main' into feat/token_function
MMenchero Apr 23, 2024
59d11c3
fix: Changes to environment.yml
MMenchero Apr 23, 2024
363afce
Fixed merge conflicts
MMenchero Apr 24, 2024
59c50f3
Validated token function after package name change
MMenchero Apr 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed merge conflicts
MMenchero committed Apr 24, 2024
commit 363afce34ddd65b7d226752fddfd4a879178608d
12 changes: 6 additions & 6 deletions .fernignore
Original file line number Diff line number Diff line change
@@ -18,9 +18,9 @@ environment.yml
settings.ini
setup.py
pyproject.toml
nixtlats/nixtla_client.py
nixtlats/utils.py
nixtlats/_modidx.py
nixtlats/__init__.py
nixtlats/distributed/
nixtlats/date_features.py
nixtla/nixtla_client.py
nixtla/utils.py
nixtla/_modidx.py
nixtla/__init__.py
nixtla/distributed/
nixtla/date_features.py
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -57,8 +57,8 @@ jobs:

- name: Check import
run: |
python -c "from nixtlats import TimeGPT;"
python -c "from nixtlats import NixtlaClient;"
python -c "from nixtla import TimeGPT;"
python -c "from nixtla import NixtlaClient;"

run-tests:
runs-on: ${{ matrix.os }}
2 changes: 1 addition & 1 deletion .github/workflows/models-performance.yaml
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ jobs:
cache-environment: true

- name: Install pip requirements
run: pip install ./
run: pip install '.[plotting]'

- name: Run evaluation
run: python -m action_files.models_performance.main
54 changes: 27 additions & 27 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package
name: Upload Python Packages

on:
release:
types: [published]

permissions:
contents: read
push:
tags: ['v*']

jobs:
deploy:

runs-on: ubuntu-latest

permissions:
id-token: write
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: '3.x'
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m pip install --upgrade pip && pip install build

- name: Build nixtla package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

- name: Publish nixtla package
uses: pypa/gh-action-pypi-publish@release/v1

- name: Build nixtlats package
run: >
rm -rf build dist &&
mv nixtla nixtlats &&
sed -i 's/name="nixtla"/name="nixtlats"/g' setup.py &&
find nixtlats -type f -name '*.py' -exec sed -i 's/from nixtla/from nixtlats/g' {} + &&
echo -e 'import warnings\nwarnings.warn("This package is deprecated, please install nixtla instead.", category=FutureWarning)' >> nixtlats/__init__.py &&
python -m build

- name: Publish nixtlats package
uses: pypa/gh-action-pypi-publish@release/v1
42 changes: 42 additions & 0 deletions .github/workflows/test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Upload Python Packages to TestPyPI

on:
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: python -m pip install --upgrade pip && pip install build

- name: Build nixtla package
run: python -m build

- name: Publish nixtla package
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

- name: Build nixtlats package
run: >
rm -rf build dist &&
mv nixtla nixtlats &&
sed -i 's/name="nixtla"/name="nixtlats"/g' setup.py &&
find nixtlats -type f -name '*.py' -exec sed -i 's/from nixtla/from nixtlats/g' {} + &&
echo -e 'import warnings\nwarnings.warn("This package is deprecated, please install nixtla instead.", category=FutureWarning)' >> nixtlats/__init__.py &&
python -m build

- name: Publish nixtlats package
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -25,3 +25,4 @@ nbs/.last_checked
.env
*/summary.md
*/*.png
longhorizon
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -38,13 +38,13 @@ The repo comes with an `environment.yml` file which contains the libraries neede
Once you have `conda` go to the top level directory of the repository and run the following lines (we recommend to use `python=3.10` for development):

```
conda create -n nixtlats python=3.10
conda activate nixtlats
conda create -n nixtla python=3.10
conda activate nixtla
conda env update -f environment.yml
```

#### Install the library
Once you have your environment setup, activate it using `conda activate nixtlats` and then install the library in editable mode using `pip install -e ".[dev]"`
Once you have your environment setup, activate it using `conda activate nixtla` and then install the library in editable mode using `pip install -e ".[dev]"`

#### Set Up TimeGPT token
This library uses `python-dotenv` for development. To set up your TimeGPT token, add the following lines to your `.env` file:
File renamed without changes.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,17 +2,17 @@

<div align="center">
<img src="https://raw.githubusercontent.com/Nixtla/neuralforecast/main/nbs/imgs_indx/logo_mid.png">
<h1 align="center">NixtlaTS</h1>
<h1 align="center">Nixtla</h1>
<h3 align="center">Forecast using TimeGPT</h3>

[![CI](https://github.com/Nixtla/nixtla/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/Nixtla/nixtla/actions/workflows/ci.yaml)
[![Python](https://img.shields.io/pypi/pyversions/nixtlats)](https://pypi.org/project/nixtlats/)
[![PyPi](https://img.shields.io/pypi/v/nixtlats?color=blue)](https://pypi.org/project/nixtlats/)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/Nixtla/nixtlats/blob/main/LICENSE)
[![Python](https://img.shields.io/pypi/pyversions/nixtla)](https://pypi.org/project/nixtla/)
[![PyPi](https://img.shields.io/pypi/v/nixtla?color=blue)](https://pypi.org/project/nixtla/)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/Nixtla/nixtla/blob/main/LICENSE)
[![docs](https://img.shields.io/website-up-down-green-red/http/nixtla.github.io/nixtla.svg?label=docs)](https://nixtla.github.io/nixtla/)
[![Downloads](https://pepy.tech/badge/nixtlats)](https://pepy.tech/project/nixtlats)
[![Downloads](https://pepy.tech/badge/nixtla)](https://pepy.tech/project/nixtla)

**NixtlaTS** offers a collection of classes and methods to interact with the API of TimeGPT.
**Nixtla** offers a collection of classes and methods to interact with the API of TimeGPT.
</div>

# 🕰️ TimeGPT: Revolutionizing Time-Series Analysis
@@ -25,16 +25,16 @@ In seconds, TimeGPT can discern complex patterns and predict future data points,

In addition to its core capabilities, TimeGPT supports fine-tuning, enhancing its specialization for specific prediction tasks. 🎯 This feature is like training a machine learning model on a targeted data subset to improve its task-specific performance, making TimeGPT an even more versatile tool for your predictive needs.

## 🔄 `NixtlaTS`: Your Gateway to TimeGPT
## 🔄 `Nixtla`: Your Gateway to TimeGPT

With `NixtlaTS`, you can easily interact with TimeGPT through simple API calls, making the power of TimeGPT readily accessible in your projects.
With `Nixtla`, you can easily interact with TimeGPT through simple API calls, making the power of TimeGPT readily accessible in your projects.

## 💻 Installation

Get `NixtlaTS` up and running with a simple pip command:
Get `Nixtla` up and running with a simple pip command:

```python
pip install nixtlats>=0.1.0
pip install nixtla>=0.1.0
```

## 🎈 Quick Start
@@ -44,7 +44,7 @@ Get started with TimeGPT now:
```python
df = pd.read_csv('https://raw.githubusercontent.com/Nixtla/transfer-learning-time-series/main/datasets/electricity-short.csv')

from nixtlats import NixtlaClient
from nixtla import NixtlaClient
nixtla = NixtlaClient(
# defaults to os.environ.get("NIXTLA_API_KEY")
api_key = 'my_api_key_provided_by_nixtla'
10 changes: 6 additions & 4 deletions action_files/models_performance/main.py
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
from utilsforecast.evaluation import evaluate
from utilsforecast.losses import mae, mape, mse

from nixtlats import NixtlaClient
from nixtla import NixtlaClient


logger = logging.getLogger(__name__)
@@ -144,9 +144,11 @@ def evaluate_timegpt(self, model: str) -> Tuple[pd.DataFrame, pd.DataFrame]:
timegpt = NixtlaClient()
fcst_df = timegpt.forecast(
df=self.df_train,
X_df=self.df_test.drop(columns=self.target_col)
if self.df.shape[1] > 3
else None,
X_df=(
self.df_test.drop(columns=self.target_col)
if self.df.shape[1] > 3
else None
),
h=self.h,
freq=self.freq,
level=self.level,
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: nixtlats
name: nixtla
channels:
- conda-forge
dependencies:
- dask
- dask<=2024.2.1
- jupyterlab
- pandas<2.2
- plotly
2 changes: 1 addition & 1 deletion experiments/azure-automl-forecasting/requirements.txt
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ azure-identity
azureml-core
fire
mltable
nixtlats
nixtla
pandas
python-dotenv
rich
2 changes: 1 addition & 1 deletion experiments/azure-automl-forecasting/src/nixtla_timegpt.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

import fire
from dotenv import load_dotenv
from nixtlats import TimeGPT
from nixtla import TimeGPT

from src.utils.data_handler import ExperimentDataset, ForecastDataset

2 changes: 1 addition & 1 deletion experiments/prophet/environment.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ dependencies:
- python=3.10
- pip:
- fire
- nixtlats
- nixtla
- python-dotenv
- statsforecast
- utilsforecast
2 changes: 1 addition & 1 deletion experiments/prophet/src/timegpt_exp.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

import fire
from dotenv import load_dotenv
from nixtlats import TimeGPT
from nixtla import TimeGPT

from src.tools import ExperimentHandler

4 changes: 2 additions & 2 deletions nbs/_quarto.yml
Original file line number Diff line number Diff line change
@@ -46,14 +46,14 @@ website:
href: https://join.slack.com/t/nixtlaworkspace/shared_invite/zt-135dssye9-fWTzMpv2WBthq8NK0Yvu6A
right:
- icon: github
href: "https://github.com/nixtla/nixtlats"
href: "https://github.com/nixtla/nixtla"
- icon: twitter
href: https://twitter.com/nixtlainc
aria-label: Nixtla Twitter

sidebar:
style: floating
body-footer: |
Give us a ⭐ on [Github](https://github.com/nixtla/nixtlats)
Give us a ⭐ on [Github](https://github.com/nixtla/nixtla)

metadata-files: [nbdev.yml, sidebar.yml]
2 changes: 1 addition & 1 deletion nbs/date_features.ipynb
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@
" except ModuleNotFoundError:\n",
" raise Exception(\n",
" 'You have to install additional libraries to use holidays, '\n",
" 'please install them using `pip install \"nixtlats[date_extras]\"`'\n",
" 'please install them using `pip install \"nixtla[date_extras]\"`'\n",
" )\n",
" return _get_holidays_df(dates, self.countries, country_holidays, list_supported_countries())\n",
" \n",
2 changes: 1 addition & 1 deletion nbs/distributed.nixtla_client.ipynb
Original file line number Diff line number Diff line change
@@ -301,7 +301,7 @@
" return fcst_df\n",
" \n",
" def _instantiate_nixtla_client(self):\n",
" from nixtlats.nixtla_client import _NixtlaClient\n",
" from nixtla.nixtla_client import _NixtlaClient\n",
" nixtla_client = _NixtlaClient(\n",
" api_key=self.api_key, \n",
" base_url=self.base_url,\n",
4 changes: 2 additions & 2 deletions nbs/docs/getting-started/1_getting_started_short.ipynb
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
"outputs": [],
"source": [
"#| hide\n",
"from nixtlats.utils import colab_badge"
"from nixtla.utils import colab_badge"
]
},
{
@@ -94,7 +94,7 @@
"metadata": {},
"outputs": [],
"source": [
"from nixtlats import NixtlaClient"
"from nixtla import NixtlaClient"
]
},
{
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@
"metadata": {},
"outputs": [],
"source": [
"from nixtlats import NixtlaClient \n",
"from nixtla import NixtlaClient \n",
"nixtla_client = NixtlaClient(api_key ='your API key here')"
]
},
@@ -75,7 +75,7 @@
"metadata": {},
"outputs": [],
"source": [
"from nixtlats import NixtlaClient\n",
"from nixtla import NixtlaClient\n",
"nixtla_client = NixtlaClient()"
]
},
@@ -137,7 +137,7 @@
"from dotenv import load_dotenv\n",
"load_dotenv()\n",
"\n",
"from nixtlats import NixtlaClient\n",
"from nixtla import NixtlaClient\n",
"nixtla_client = NixtlaClient()"
]
},
6 changes: 3 additions & 3 deletions nbs/docs/getting-started/3_azure_ai.ipynb
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
"source": [
"# AzureAI (coming soon)\n",
"\n",
"> The foundational models for time series by Nixtla can be deployed on your Azure subscription. This page explains how to easily get started with TimeGEN deployed as an Azure AI endpoint. If you use the `nixtlats` library, it should be a drop-in replacement where you only need to change the client parameters (endpoint URL, API key, model name)."
"> The foundational models for time series by Nixtla can be deployed on your Azure subscription. This page explains how to easily get started with TimeGEN deployed as an Azure AI endpoint. If you use the `nixtla` library, it should be a drop-in replacement where you only need to change the client parameters (endpoint URL, API key, model name)."
]
},
{
@@ -50,7 +50,7 @@
"metadata": {},
"source": [
"```bash\n",
"pip install nixtlats\n",
"pip install nixtla\n",
"```"
]
},
@@ -60,7 +60,7 @@
"source": [
"```python\n",
"import os\n",
"from nixtlats import NixtlaClient\n",
"from nixtla import NixtlaClient\n",
"\n",
"base_url = os.environ[\"AZURE_AI_NIXTLA_BASE_URL\"]\n",
"api_key = os.environ[\"AZURE_AI_NIXTLA_API_KEY\"]\n",
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.