GithubHelp home page GithubHelp logo

Comments (2)

sayanpatra avatar sayanpatra commented on June 19, 2024

@dromare It ran fine with the list input of l1_ratio on dummy data. Here is my code:

import pandas as pd
import plotly

from linkedin.greykite.common.data_loader import DataLoader
from linkedin.greykite.framework.templates.autogen.forecast_config import ForecastConfig
from linkedin.greykite.framework.templates.autogen.forecast_config import MetadataParam, EvaluationPeriodParam, EvaluationMetricParam, ModelComponentsParam
from linkedin.greykite.framework.templates.forecaster import Forecaster
from linkedin.greykite.framework.templates.model_templates import ModelTemplateEnum
from linkedin.greykite.framework.utils.result_summary import summarize_grid_search_results
from linkedin.greykite.common.evaluation import EvaluationMetricEnum

# Loads dataset into pandas DataFrame
dl = DataLoader()
df = dl.load_peyton_manning()

# subsetting for faster runtime
df = df.iloc[1:100]
# augmenting the training and testing dataset with 0
df["y"][90:100]=0

# specify dataset information
metadata = MetadataParam(
 time_col="ts",  # name of the time column ("date" in example above)
 value_col="y",  # name of the value column ("sessions" in example above)
 freq="D"  # "H" for hourly, "D" for daily, "W" for weekly, etc.
           # Any format accepted by `pandas.date_range`
)

evaluation_period = EvaluationPeriodParam(
    cv_max_splits=0
)

evaluation_metric = EvaluationMetricParam(
    cv_selection_metric=EvaluationMetricEnum.RootMeanSquaredError.name
)

model_components = ModelComponentsParam(
    custom = dict(
        fit_algorithm_dict=dict(
            fit_algorithm="elastic_net",
            fit_algorithm_params = dict(
                l1_ratio=[.1, .5, .7, .9, .95, .99, 1]
            )
        )
    )
)

config = ForecastConfig(
    model_template=ModelTemplateEnum.SILVERKITE.name,
    forecast_horizon=7,  # forecasts 365 steps ahead
    coverage=0.95,         # 95% prediction intervals
    metadata_param=metadata,
    evaluation_period_param=evaluation_period,
    evaluation_metric_param=evaluation_metric,
    model_components_param=model_components
)

forecaster = Forecaster()
result = forecaster.run_forecast_config(  # result is also stored as `forecaster.forecast_result`.
    df=df,
    config=config
)

If you can post your codes I can take a look.

from greykite.

dromare avatar dromare commented on June 19, 2024

Hi sayanpatra,

If I print out the values of alpha and l1_ratio in lines 378-379 of C:\ProgramData\Anaconda3\envs\greykite-venv\lib\site-packages\greykite\algo\common\model_summary_utils.py in add_model_df_lm(info_dict) I get the following:

alpha = 160.12536709617518
l1_ratio = [0.1, 0.5, 0.7, 0.9, 0.95, 0.99, 1]

image

Then in line 384 the calculation 1 - l1_ratio throws the following error:
TypeError: unsupported operand type(s) for -: 'int' and 'list'

because l1_ratio is of type list.

from greykite.

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.