Code Monkey home page Code Monkey logo

Comments (3)

lostella avatar lostella commented on May 25, 2024

@ArianKhorasani could you provide the entire error trace? It’s not clear which assertion is failing

from gluonts.

ArianKhorasani avatar ArianKhorasani commented on May 25, 2024

@lostella - the error trace that I provided is the entire error that I get. Please check the screenshot below too:
Screen Shot 2023-11-28 at 4 02 20 PM

from gluonts.

ArianKhorasani avatar ArianKhorasani commented on May 25, 2024

Dear @lostella - I have already checked the dimension of my multivariate time series too. Putting my whole dataset code below:

```
variables = ['DBP', 'SBP', 'Resp', 'Temp', 'HR', 'O2Sat', 'MAP']
df_actual = pd.read_csv('merged_test.csv')
static_features = df_actual[['patient_id', 'Age', 'Gender', 'HospAdmTime']].drop_duplicates().reset_index(drop=True)
df_residuals = pd.DataFrame()

for variable in variables:
    # First, let's load forecasted values 
    df_forecast = pd.read_csv(f'forecasts_{variable}.csv')

    # Ensure that the data are ordered in the same way
    df_actual = df_actual.sort_values(by=['patient_id', 'ICULOS'])
    df_forecast = df_forecast.sort_values(by=['patient_id', 'ICULOS'])

    # Calculate residuals 
    residuals = df_actual[variable] - df_forecast[f'{variable}_forecast']

    # Add residual to df_residuals
    df_residuals[variable] = residuals
    df_residuals['patient_id'] = df_actual['patient_id']
    df_residuals['ICULOS'] = df_actual['ICULOS']

# Convert df_residuals to ListDataset
data_residuals = []
for patient_id, group in df_residuals.groupby('patient_id'):
    target = group[variables].values  # Use the residuals as target
    start = pd.Timestamp("1970-01-01 00:00") + pd.Timedelta(hours=group['ICULOS'].iloc[0])
    entry = {
        FieldName.TARGET: target,
        FieldName.START: start,  # Use the index as the start date
        FieldName.FEAT_STATIC_CAT: static_features[static_features['patient_id'] == patient_id][['Age', 'Gender']].values[0]
    }
    data_residuals.append(entry)

dataset_residuals = ListDataset(data_residuals, freq='1H', one_dim_target=False)
```

from gluonts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.