Exemplo n.º 1
0
# coding=utf-8
from __future__ import absolute_import, print_function

from suanpan.docker import DockerComponent as dc
from suanpan.docker.arguments import Csv
import statsmodels.api as sm


@dc.output(Csv(key="outputData"))
def SPMacroData(context):
    dta = sm.datasets.macrodata.load_pandas().data

    return dta


if __name__ == "__main__":
    SPMacroData()
Exemplo n.º 2
0
# coding=utf-8
from __future__ import absolute_import, print_function

from suanpan.docker import DockerComponent as dc
from suanpan.docker.arguments import Int, String, Csv, Bool, Float, ListOfString
from arguments import SklearnModel
from catboost import CatBoostRegressor


@dc.input(Csv(key="inputData", required=True))
@dc.column(ListOfString(key="featureColumns", default=[]))
@dc.column(String(key="labelColumn", default="MEDV"))
@dc.param(
    Int(
        key="iterations",
        default=1000,
        help=
        "The maximum number of trees that can be built when solving machine learning problems.",
    ))
@dc.param(Float(key="learningRate", default=0.03, help="The learning rate."))
@dc.param(Int(key="depth", default=6, help="Depth of the tree."))
@dc.param(
    Float(
        key="l2LeafReg",
        default=3.0,
        help="Coefficient at the L2 regularization term of the cost function.",
    ))
@dc.param(
    Float(
        key="rsm",
        default=1,
Exemplo n.º 3
0
# coding=utf-8
from __future__ import absolute_import, print_function

from suanpan.docker import DockerComponent as dc
from suanpan.docker.arguments import Int, Csv, String, Bool
import statsmodels.api as sm
import pandas as pd
from arguments import SklearnModel


@dc.input(Csv(key="inputData"))
@dc.column(Bool(key="timestampIndex", default=False))
@dc.column(String(key="timestampColumn", default="date"))
@dc.column(String(key="labelColumn", default="y"))
@dc.param(
    String(
        key="missing",
        default="none",
        help="Available options are ‘none’, ‘drop’, and ‘raise’.",
    ))
@dc.param(
    String(
        key="trend",
        default="c",
        help=
        "Whether to include a constant or not. ‘c’ includes constant, ‘nc’ no constant.",
    ))
@dc.param(String(key="method", default="cmle", help="‘cmle’, ‘mle’"))
@dc.param(
    Int(key="maxiter",
        default=35,
Exemplo n.º 4
0
from suanpan.docker import DockerComponent as dc
from suanpan.docker.arguments import Csv, String, Bool, ListOfString
import pandas as pd
import numpy as np
from statsmodels.tsa.ar_model import ARResultsWrapper
from statsmodels.tsa.statespace.sarimax import SARIMAXResultsWrapper
from statsmodels.tsa.arima_model import ARMAResultsWrapper, ARIMAResultsWrapper
from statsmodels.regression.linear_model import RegressionResultsWrapper
from statsmodels.discrete.discrete_model import (
    BinaryResultsWrapper,
    MultinomialResultsWrapper,
)
from arguments import SklearnModel


@dc.input(Csv(key="inputData"))
@dc.input(SklearnModel(key="inputModel"))
@dc.column(ListOfString(key="featureColumns", default=["a", "b", "c", "d"]))
@dc.column(String(key="predictColumn", default="prediction"))
@dc.param(String(key="start", default="2000-11-30"))
@dc.param(String(key="end", default="2001-05-31"))
@dc.param(Bool(key="dynamic", default=True))
@dc.output(Csv(key="outputData"))
def SPStatsPredict(context):
    args = context.args

    model = args.inputModel
    if isinstance(
            model,
        (
            ARResultsWrapper,