print(f'akiyama_metric: {a_score}') utils.send_line(f'akiyama_metric: {a_score}') utils.plot_confusion_matrix(__file__, oof) # ============================================================================= # weight # ============================================================================= import utils_post y_true = pd.get_dummies(y) weight = utils_post.get_weight(y_true, oof, eta=0.1, nround=9999) # ============================================================================= # model # ============================================================================= gc.collect() np.random.seed(SEED) model_all = [] for i in range(LOOP):
y_pred = pd.concat([y_pred_gal, y_pred_exgal], ignore_index=True).fillna(0) y_pred = y_pred[[f'class_{c}' for c in utils_metric.classes]] loss = utils_metric.multi_weighted_logloss(y.values, y_pred.values) # ============================================================================= # weight # ============================================================================= import utils_post y_true = pd.get_dummies(y) weight = utils_post.get_weight(y_true, y_pred.values, eta=0.1, nround=9999) weight = np.append(weight, 1) print(list(weight)) # ============================================================================= # confusion matrix # ============================================================================= import matplotlib as mpl mpl.use('Agg') from matplotlib import pyplot as plt from tqdm import tqdm from sklearn.metrics import confusion_matrix import itertools unique_y = np.unique(y)
import optuna from multiprocessing import cpu_count, Pool # ============================================================================= # weight # ============================================================================= oof = pd.read_pickle( '../FROM_MYTEAM/oof_v103_068_lgb__v103_062_nn__specz_avg.pkl') oof = oof.copy().values.astype(float) y = utils.load_target().target y_ohe = pd.get_dummies(y) weight = utils_post.get_weight(y_ohe, oof, eta=0.1, nround=9999) print(f'weight: np.array({list(weight)})') weight = utils_post.get_weight(y_ohe, oof, eta=0.1, nround=9999, based_true=False) print(f'weight: np.array({list(weight)})') # ============================================================================= # one by one # =============================================================================