# split for training and testing from sklearn.model_selection import train_test_split from sklearn.model_selection import KFold from util.load_text import load_BERT, predict_text import numpy as np from tensorflow.keras.utils import to_categorical from sklearn.metrics import accuracy_score, confusion_matrix from util.load_audio import load_all_models, stacked_dataset, fit_logistic from scipy.special import softmax from sklearn.linear_model import LogisticRegression from sklearn.preprocessing import StandardScaler from util.load_text import load_BERT, predict_text bert_model = load_BERT(model_type='regression') from util.load_audio import load_all_models, stacked_dataset, fit_logistic n_members = 10 all_models = load_all_models(n_members, model_type = '4_categories') kf = KFold(n_splits=5, shuffle = True, random_state = 31) test_text_acc = [] test_audio_acc = [] ensemble_acc = [] print('Loaded %d models!' % len(all_models)) print('')
# split for training and testing from sklearn.model_selection import train_test_split from sklearn.model_selection import KFold from util.load_text import load_BERT, predict_text import numpy as np from tensorflow.keras.utils import to_categorical from sklearn.metrics import accuracy_score, confusion_matrix from util.load_audio import load_all_models, stacked_dataset, fit_logistic from scipy.special import softmax from sklearn.linear_model import LogisticRegression kf = KFold(n_splits=5, shuffle=True, random_state=31) #load text model and predict bert_model = load_BERT(model_type='3_categories') #load audio models n_members = 10 all_models = load_all_models(n_members, model_type='3_categories') print('Loaded %d models!' % len(all_models)) print('') for num, indices in enumerate(kf.split(audio_y)): print('===== Start CV {} out of 5 ====='.format(num + 1)) print('.') train_index = indices[0] test_index = indices[1]