application_vnd.jupyter.stderr_output_2.png text_plain_output_1.png
from scipy.stats import loguniform, uniform, randint

from sklearn.mixture import GaussianMixture

from sklearn.model_selection import RandomizedSearchCV, KFold

import numpy as np

import pandas as pd
import numpy as np
from sklearn.mixture import GaussianMixture
from sklearn.model_selection import RandomizedSearchCV, KFold
from scipy.stats import loguniform, uniform, randint
RANDOM_STATE = 1563

embeddings = np.load('/kaggle/input/biowordvec-precomputed-cord19/biowordvec.npy')
embeddings.shape

estimator = GaussianMixture(n_components=10, covariance_type='full', max_iter=100, n_init=1, init_params='kmeans', random_state=RANDOM_STATE)

N_ITER = 20
N_SPLITS = 4
param_distributions = {'n_components': randint(2, 256), 'covariance_type': ['diag', 'full', 'spherical']}
cv = KFold(n_splits=N_SPLITS, shuffle=True, random_state=RANDOM_STATE)
hp_search = RandomizedSearchCV(estimator=estimator, param_distributions=param_distributions, n_iter=N_ITER, n_jobs=N_SPLITS, cv=cv, verbose=1, random_state=RANDOM_STATE, return_train_score=True, refit=True)
hp_search.fit(embeddings)
best_model = hp_search.best_estimator_

hp_search.best_score_

hp_search.best_params_