Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using different feature set for each model #7

Open
RaduStoicescu opened this issue Jun 10, 2017 · 2 comments
Open

Using different feature set for each model #7

RaduStoicescu opened this issue Jun 10, 2017 · 2 comments

Comments

@RaduStoicescu
Copy link

It is advised to use different feature sub-sets across the models for diversity.

Is it possible using heamy?

@rushter
Copy link
Owner

rushter commented Jun 10, 2017

Yes, it's possible.
You can implement this logic inside your custom model or just add new datasets.

def xgboost_model(X_train, y_train, X_test, y_test=None, random_state=9999):
    params = {
        'objective': 'reg:linear',
        'learning_rate': 0.02,
        'max_depth': 20,
        'subsample': 0.8,
        'colsample_bytree': 0.8,
        'seed': random_state,
        'num_estimators': 100,
        'silent': 1,
        'tree_method': 'exact',

    }

    na_value = np.nan
    
    # Filter columns 
    subset_of_columns = ['a','b','c']
    X_train = X_train[subset_of_columns]
    X_test = X_test[subset_of_columns]

    X_train = xgb.DMatrix(X_train, label=y_train, missing=na_value)
    model = xgb.train(params, X_train, params['num_estimators'], maximize=True, )
    return model.predict(xgb.DMatrix(X_test, missing=na_value))

@RaduStoicescu
Copy link
Author

Thanks!

Adding new datasets is a painfully obvious solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants