#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Apr 23 17:07:40 2021 @author: doug """ import OLS # This is the Python module we wrote for RBFs import numpy as np from sklearn.datasets import load_wine from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix from sklearn.preprocessing import StandardScaler Z=load_wine() X=Z.data t=Z.target temp=np.identity(3) T=temp[:,t] scaler=StandardScaler() Xs=scaler.fit_transform(X) X_train, X_test, y_train, y_test = train_test_split(Xs, T.T, test_size=0.3, random_state=42) NetParams=OLS.rbfOLS(X_train.T,y_train.T,0.1,70) Ztest=OLS.rbfPredict(NetParams,X_test); PredOut=np.argmax(Ztest,axis=0) TrueOut=np.argmax(y_test.T,axis=0) C_out=confusion_matrix(PredOut,TrueOut) print(C_out)