示例#1
0
def run_pipeline(events, models):

    tNameId = bt.Feature_id_transform(min_size=0,
                                      exclude_missing=True,
                                      zero_based=True,
                                      input_feature="name",
                                      output_feature="nameId")
    tAuto = pauto.Auto_transform(max_values_numeric_categorical=2,
                                 exclude=["nameId", "name"])
    sk_classifier = RandomForestClassifier(verbose=1)
    classifier = ske.SKLearnClassifier(clf=sk_classifier,
                                       target="nameId",
                                       excluded=["name"])

    cv = cf.Seldon_KFold(classifier, 5)
    logger.info("cross validation scores %s", cv.get_scores())

    transformers = [("tName", tNameId), ("tAuto", tAuto), ("cv", cv)]
    p = Pipeline(transformers)

    pw = sutl.Pipeline_wrapper()
    df = pw.create_dataframe(events)
    df2 = p.fit_transform(df)
    pw.save_pipeline(p, models)
    logger.info("cross validation scores %s", cv.get_scores())
示例#2
0
def run_pipeline(events, models):

    tNameId = bt.Feature_id_transform(min_size=0,
                                      exclude_missing=True,
                                      zero_based=True,
                                      input_feature="name",
                                      output_feature="nameId")
    tAuto = pauto.Auto_transform(max_values_numeric_categorical=2,
                                 exclude=["nameId", "name"])
    xgb = xg.XGBoostClassifier(target="nameId",
                               target_readable="name",
                               excluded=["name"],
                               learning_rate=0.1,
                               silent=1)
    cv = cf.Seldon_KFold(xgb, 5)
    logger.info("cross validation scores %s", cv.get_scores())

    transformers = [("tName", tNameId), ("tAuto", tAuto), ("cv", cv)]
    p = Pipeline(transformers)

    pw = sutl.Pipeline_wrapper()
    df = pw.create_dataframe_from_files(events)
    df2 = p.fit_transform(df)
    pw.save_pipeline(p, models)
    logger.info("cross validation scores %s", cv.get_scores())
示例#3
0
def run_pipeline(events,models):

    tAuto = pauto.Auto_transform(max_values_numeric_categorical=2,exclude=["label"])
    detector = anod.iNNEDetector()

    wrapper = aw.AnomalyWrapper(clf=detector,excluded=["label"])

    transformers = [("tAuto",tAuto),("clf",wrapper)]
    p = Pipeline(transformers)

    pw = sutl.Pipeline_wrapper()
    df = pw.create_dataframe_from_files(events)
    df2 = p.fit_transform(df)
    pw.save_pipeline(p,models)
示例#4
0
def run_pipeline(events, models):
    tNameId = bt.Feature_id_transform(min_size=0,
                                      exclude_missing=True,
                                      zero_based=True,
                                      input_feature="name",
                                      output_feature="nameId")
    tAuto = pauto.Auto_transform(max_values_numeric_categorical=2,
                                 exclude=["nameId", "name"])
    keras = sk.KerasClassifier(model_create=create_model,
                               target="nameId",
                               target_readable="name")
    transformers = [("tName", tNameId), ("tAuto", tAuto), ("keras", keras)]
    p = Pipeline(transformers)

    pw = sutl.Pipeline_wrapper()
    df = pw.create_dataframe(events)
    df2 = p.fit(df)
    pw.save_pipeline(p, models)
示例#5
0
def run_pipeline(events, models):

    tNameId = bt.Feature_id_transform(min_size=0,
                                      exclude_missing=True,
                                      zero_based=True,
                                      input_feature="name",
                                      output_feature="nameId")
    tAuto = pauto.Auto_transform(max_values_numeric_categorical=2,
                                 exclude=["nameId", "name"])
    xgb = xg.XGBoostClassifier(target="nameId",
                               target_readable="name",
                               excluded=["name"],
                               learning_rate=0.1,
                               silent=0)

    transformers = [("tName", tNameId), ("tAuto", tAuto), ("xgb", xgb)]
    p = Pipeline(transformers)

    pw = sutl.Pipeline_wrapper()
    df = pw.create_dataframe(events)
    df2 = p.fit(df)
    pw.save_pipeline(p, models)
示例#6
0
import seldon.pipeline.auto_transforms as auto
import pandas as pd

df = pd.DataFrame([{
    "a": 10,
    "b": 1,
    "c": "cat"
}, {
    "a": 5,
    "b": 2,
    "c": "dog",
    "d": "Nov 13 08:36:29 2015"
}, {
    "a": 10,
    "b": 3,
    "d": "Oct 13 10:50:12 2015"
}])
t = auto.Auto_transform(max_values_numeric_categorical=2, date_cols=["d"])
t.fit(df)
df2 = t.transform(df)
print df2