Machine learning experiments five and six - support vector machine news classification and clustering

Machine learning experiment five - svm news classification
Reference blog:
svm news classification

Machine Learning Experiment Six - Clustering
Machine Learning - Clustering
Reference Blog
Based on Division Kmeans
https://zhuanlan.zhihu.com/p/136498094

Based on dbscan: Reference blogger: Hu Yanhuan
Code:
1. Import related libraries

from sklearn.cluster import DBSCAN
from sklearn.datasets import load_wine
from sklearn import metrics 
import numpy as np

2. Load data

wine = load_wine()
data = wine['data']
target = wine['target']

3. Use the dbscan model to train and predict

clustering = DBSCAN(eps=4, min_samples=2).fit(data)
clustering.labels_

4. Evaluation score

score = metrics.silhouette_score(data,clustering.labels_) 
print(score)

Learn to communicate and use, infringement will be deleted.
Follow the official account below
Reply: Clustering
You can get relevant codes, data, documents
For more university course experiment training, you can follow the official account and reply to related keywords
. If you are not good at learning, please give me advice if you make any mistakes.

Guess you like

Origin blog.csdn.net/qq_43374681/article/details/118442023