Exemple #1
0
 def test_groupby1(self):
     df = load_iris()
     random_group = []
     for _ in range(len(df)):
         random_group.append(random.randint(1, 2))
     df['random_group'] = random_group
     
     train_out = xgb_classification_train(table=df, feature_cols=['sepal_length', 'sepal_width', 'petal_length', 'petal_width'], label_col='species', group_by=['random_group'])
     predict_out = xgb_classification_predict(table=df, model=train_out['model'])
Exemple #2
0
    def groupby1(self):
        df = get_iris()
        random_group = []
        for i in range(len(df)):
            random_group.append(random.randint(1, 2))
        df['random_group'] = random_group

        train_out = xgb_classification_train(df,
                                             feature_cols=[
                                                 'sepal_length', 'sepal_width',
                                                 'petal_length', 'petal_width'
                                             ],
                                             label_col='species',
                                             group_by=['random_group'])
        predict_out = xgb_classification_predict(df, train_out['model'])
        print(predict_out['out_table'][['species', 'prediction']])