X = df.drop(['Grade'], axis=1) Y = df.Grade #Using Built in train test split function in sklearn X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2) # RBF and kmeans clustering by class #Number of prototypes #prototypes = int(input("Number of seed points:")) prototypes = 12 #Finding cluster centers df_cluster = X_train df_cluster[ 'Grade'] = Y_train #Reproduce original data but only with training values rbfk_net = RBFKMeans( n_clusters=prototypes) #Chose number of clusters that you want rbfk_net.train(df_cluster, epsilon=1e-5) center = pd.DataFrame(rbfk_net.centers) # Turn the centers into prototypes values needed X_prototypes = center.iloc[:, 0:-1] Y_prototypes = center.iloc[:, -1] #Y_prototypes is the last column of center since 'Grade' is the last feature added to center. #Train GRNN GRNNet = GRNN(std=0.1) GRNNet.train(X_prototypes, Y_prototypes) # Cross validataion score = cross_val_score(GRNNet, X_train, Y_train, scoring='r2', cv=5) print("")