I am getting an error while running function.
Error:- "ValueError Traceback (most recent call last)
in ()
----> 1 odd_one_out(X)
in odd_one_out(lst)
7 min_similarity = 1.0
8 for w in lst:
----> 9 sim = cosine_similarity([keyed_vectors[w], [avg_vector]])
10
11 if sim < min_similarity:
~\Anaconda3\lib\site-packages\sklearn\metrics\pairwise.py in cosine_similarity(X, Y, dense_output)
915 # to avoid recursive import
916
–> 917 X, Y = check_pairwise_arrays(X, Y)
918
919 X_normalized = normalize(X, copy=True)
~\Anaconda3\lib\site-packages\sklearn\metrics\pairwise.py in check_pairwise_arrays(X, Y, precomputed, dtype)
105 if Y is X or Y is None:
106 X = Y = check_array(X, accept_sparse=‘csr’, dtype=dtype,
–> 107 warn_on_dtype=warn_on_dtype, estimator=estimator)
108 else:
109 X = check_array(X, accept_sparse=‘csr’, dtype=dtype,
~\Anaconda3\lib\site-packages\sklearn\utils\validation.py in check_array(array, accept_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)
431 force_all_finite)
432 else:
–> 433 array = np.array(array, dtype=dtype, order=order, copy=copy)
434
435 if ensure_2d:
ValueError: setting an array element with a sequence.
"