
上QQ阅读APP看书,第一时间看更新
Test dataset and prediction
In this case, the test dataset has two main functions. First, some test data confirms the prediction level of the trained and now-labeled dataset. The input contains random distances and locations. The following code implements the output that predicts which cluster the data points will be in:
#VI.Test dataset and prediction
x_test = [[40.0,67],[20.0,61],[90.0,90],
[50.0,54],[20.0,80],[90.0,60]]
prediction = kmeans.predict(x_test)
print("The predictions:")
print (prediction)
'''
Output of the cluster number of each example
[3 3 2 3 3 4]
'''
The second purpose, in future, will be to enter new warehouse data for decision-making purposes, as explained in the next section.