Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how would go about making the code below work? Provide code please. from sklearn.preprocessing import StandardScaler standard_scaler = StandardScaler() transformed_features_doc2vec = standard_scaler.fit_transform(features_doc2vec) model_kmeans = KMeans(n_clusters=k,

how would go about making the code below work? Provide code please.

from sklearn.preprocessing import StandardScaler standard_scaler = StandardScaler() transformed_features_doc2vec = standard_scaler.fit_transform(features_doc2vec) model_kmeans = KMeans(n_clusters=k, random_state=20130810) model_kmeans.fit(transformed_features_doc2vec) KMeans(n_clusters=4, random_state=20130810) labels_kmeans = model_kmeans.labels_ silhouette_score(transformed_features_doc2vec, labels_kmeans) for k in [4, 5, 6, 7, 8, 9]: model_kmeans = KMeans(n_clusters=k, random_state=20130810) model_kmeans.fit(transformed_features_doc2vec) sil_score = silhouette_score(transformed_features_doc2vec, model_kmeans.labels_) print(f"k = {k}, silhouette score = {sil_score}")#

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Finance The Role Of Data Analytics In Manda Due Diligence

Authors: Ps Publishing

1st Edition

B0CR6SKTQG, 979-8873324675

More Books

Students also viewed these Databases questions