# Am trying to create an intelligent model and from there am trying to predict the system……

import pandas as pd #custom data
from sklearn import neighbors #to implement algorithm
import numpy as np #numerical processing
%matplotlib inline
import seaborn #charting special

 

df = pd.DataFrame({“Data_Value_1”: [0.6], “Data_Value_2”: [0.5]})
xtest = df.to_numpy()

 

#create a dataframe with x and y value and reference column…. 3 data…
kmeans_Data = pd.DataFrame()

 

kmeans_Data[“Data_Value_1”] = [0.3051, 0.4949,0.6974,0.3769,0.2231,0.341,0.4436,0.5897,0.6308,0.5]
kmeans_Data[“Data_Value_2”] = [0.5846,0.2654,0.2615,0.4538,0.4615,0.8308,0.4962,0.3269,0.5346,0.6731]
kmeans_Data[“Final_Outcome”] = [“win”,”win”,”win”,”win”,”win”,”loss”,”loss”,”loss”,”loss”,”loss”]
kmeans_Data

 

 

 

seaborn.lmplot(‘Data_Value_1′,’Data_Value_2’, data = kmeans_Data ,hue = “Final_Outcome”)

 

# to do processing.. we need to convert into numpy array…..

X= kmeans_Data [ [ “Data_Value_1″,”Data_Value_2”]].to_numpy() # Processing two dimensional array into a matrix
y= np.array(kmeans_Data[“Final_Outcome”]) # Processing or converting into an array of single dimensional

 

#Created the classifier…
KmeansClassifier = neighbors.KNeighborsClassifier (3, weights = ‘uniform’)
KmeansClassifier

 

 

#Create model by fitting the classifier and the data

KmeansModel = KmeansClassifier.fit(X,y)

 

 

KmeansModel.score(X,y)

 

 

# We sucucesfully created the model to go ahead….. its time for us to step ahead with the testing part….

#R u ready…. my robot is created with all the validated data…. i need to test my robot whether it is giving output… if i give some
#if i give some values to it…. Lets move on….

 

 

 

test_value = np.array([[0.6,0.4]]) # looks like the value is a loss… lets see..whether we are getting the same result…

 

x_test = np.array([[.5,.6]])

 

Kmeans_trained_model.predict(x_test)

 

 

Kmeans_trained_model.predict_proba(x_test)

 

× How can I help you?