23 lines
710 B
Python
23 lines
710 B
Python
|
from scipy.cluster import hierarchy
|
||
|
import pandas as pd
|
||
|
from matplotlib import pyplot as plt
|
||
|
|
||
|
|
||
|
def start():
|
||
|
data = pd.read_csv('loan.csv')
|
||
|
x = data[['ApplicantIncome', 'LoanAmount', 'Credit_History', 'Self_Employed', 'Education']]
|
||
|
plt.figure(1, figsize=(16, 9))
|
||
|
plt.title('Дендрограмма кластеризации заявителей')
|
||
|
|
||
|
hierarchy.dendrogram(hierarchy.linkage(x, method='single'),
|
||
|
truncate_mode='lastp',
|
||
|
p=20,
|
||
|
orientation='top',
|
||
|
leaf_rotation=90,
|
||
|
leaf_font_size=8,
|
||
|
show_contracted=True)
|
||
|
|
||
|
plt.show()
|
||
|
|
||
|
|
||
|
start()
|