<Kaggle>
-
-
-
-
2022-03-06<Kaggle> 2022. 3. 6. 21:31
def object space = {'max_depth' : hp.quniform('max_depth', 1, 40, 1)} sample(space) algo = tpe.suggest trials = Trials() best = fmin(fn = objective, space = space, algo = tpe.suggest, trials = trials) best_hyp = ast.literal_eval(results.loc[0, 'hyperparameters']) # results=object # best_hyp = best.loc[0, 'hyperparameters']
-
2022-02-26<Kaggle>/[Costa Rican Household Poverty Level] 2022. 2. 26. 21:47
from sklearn.metrics import make_scorer scorer = make_scorer(f1_score, greater_is_better=True, average='macro') cv_score = cross_val_score(model, train_set, train_labels, cv = 10, scoring = scorer) .sort_values('importance', ascending=False)
-
2022-02-25<Kaggle>/[Costa Rican Household Poverty Level] 2022. 2. 25. 21:28
list vs np.array (list(Counter(list).values())) == 1 # False np.array(list(Counter(list).values())) == 1 # array([ True, True, True, True, True, True, True, True]) list == 1 np.array == 1 -> [1, 1, 1, 1] (1) pd.DataFrame.iterrows() : 행에 대해 순환 반복 (Iterate over DataFrame rows as (index, Series) pairs.) (2) pd.DataFrame.iteritems() : 열에 대해 순환 반복 (Iterate over DataFrame (column name, Series) pairs.)..