machinelearning(3)
-
[머신러닝] Support Vector Machine
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import datasets from sklearn.preprocessing import StandardScaler from sklearn.svm import SVC from sklearn.model_selection import train_test_split plt.close("all") iris=datasets.load_iris() X=iris["data"][50:150, (2, 3)] Y=iris["target"][50:150] scaler=StandardScaler() scaler.fit(X) X_std=scaler.transform(X) [X_tr..
2020.09.20 -
[머신러닝] Kerner Trick & Lagrangue Multiplier
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import datasets from sklearn.preprocessing import StandardScaler from sklearn.svm import SVC from sklearn.model_selection import train_test_split plt.close("all") [X, Y]=datasets.make_moons(n_samples=200, shuffle=True, noise=0.2, random_state=15) #[X, Y]=datasets.make_circles(n_samples=200, shuffle=True, noise=0...
2020.09.20 -
[머신러닝] Classification2 - Clustering
import pandas as pd import numpy as np import matplotlib.pylab as plt import scipy as sp import scipy.stats plt.close("all") dfLoad=pd.read_csv('https://sites.google.com/site/vlsicir/ClassificationSample2.txt', sep='\s+') samples=np.array(dfLoad) x=samples[:,0] y=samples[:,1] N=len(x) numK=2 #Initialize categorial distribution pi=np.ones([1, numK])*(1/numK) mx=np.mean(x) my=np.mean(y) sx=np.std(..
2020.09.20