Giter Site home page Giter Site logo

automl's Introduction

Detailed design doc, please reference to:

image

AutoML

Auto machine learning framework based on sklearn, mlxtend, etc.

Usage

Config file format explanation.

#define problem: binary classify, multi-class classify, reggression and cluster.
[basic]
model_type = binary | multi | reg | cluster 

#define metrics
[binary_clf_metrics]
accuracy = true
precision = true

[multi_clf_metrics]
accuracy = true
precision = true

[reg_metrics]
explained_variance = true
neg_mean_absolute_error = true

[cluster_metrics]
adjusted_mutual_info_score = true
adjusted_rand_score = true

#define models
[clf_models]
LR = true
SVM = true
DecisionTree = false
RandomForest = false
xgboost = true

[reg_models]
RandomForest = true

[cluster_models]
KMeans = true

#define meta-model used in stacking
[meta_models]
lgbm = true

API.

Step 1. define cfg_obj.
cfg_obj = config_parser.CfgParser(os.path.join(CFG_FILE_PATH, 'binary_config.ini'))

Step 2. parse metric, basic model and meta-model.
metric_list, model_list = cfg.parse_metrics_models()
meta_model_label = cfg.parse_meta_models()

Step 3. This step is optional. Define model_util_obj for model fine-tune param set. Need to define your own model_dict and meta_model_dict first. model_dict format: {'model_label': [model_obj, {param set}]}. 
model_dict = {'lr': [LogisticRegression(), {'C': [x / 10.0 for x in range(1, 50, 5)]}]}
model_util_obj = model_util.ModelUtil(model_dict, meta_model_dict)

Step 4. define automl_obj, model_util is optional, if not provided, use default model dict to fine-tune.
automl_obj = automl_base.AutoML(model_util=model_util_obj, model_save_path=os.path.join(MODEL_FILE_PATH, 'iris_models/'))

# Step 5. Auto train, select, fine-tune and save models.
model = automl_obj.train(X_train, Y_train, metric_list, model_label_list, meta_model_label[0], model_save_name='iris_model.pkl', K=3)

# Step 6. validate model.
val_y = automl.validate(model, X_test, Y_test, metric_list)

# Step 7. predict model.
pred_y = automl.predict(model, X_test)

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.