吴裕雄 python 机器学习-NBYS(1)】的更多相关文章

import matplotlib import numpy as np import matplotlib.pyplot as plt n = 1000 xcord0 = [] ycord0 = [] xcord1 = [] ycord1 = [] markers =[] colors =[] for i in range(n): [r0,r1] = np.random.standard_normal(2) myClass = np.random.uniform(0,1) if (myClas…
import numpy as np def loadDataSet(): postingList=[['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'], ['maybe', 'not', 'take', 'him', 'to', 'dog', 'park', 'stupid'], ['my', 'dalmation', 'is', 'so', 'cute', 'I', 'love', 'him'], ['stop', 'post…
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier,DecisionTreeRegressor def load_data(): ''' 加载用于分类问题的数据集.数据集采用 scikit-…
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier,DecisionTreeRegressor def creat_data(n): np.random.seed(0) X = 5 * np…
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D from sklearn.model_selection import train_test_split from sklearn import datasets, linear_model,discriminant_analysis def load_data()…
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D from sklearn import datasets, linear_model from sklearn.model_selection import train_test_split def load_data(): # 使用 scikit-learn 自带…
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm from mpl_toolkits.mplot3d import Axes3D from sklearn import datasets, linear_model from sklearn.model_selection import train_test_split def load_data(): diabetes = datasets.…
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets, linear_model from sklearn.model_selection import train_test_split def load_data(): diabetes = datasets.load_diabetes() return train_test_split(diabetes.data,diabetes.tar…
import numpy as np import matplotlib.pyplot as plt from sklearn import datasets, linear_model from sklearn.model_selection import train_test_split def load_data(): diabetes = datasets.load_diabetes() return train_test_split(diabetes.data,diabetes.tar…
import numpy as np from sklearn import datasets,linear_model from sklearn.model_selection import train_test_split def load_data(): diabetes = datasets.load_diabetes() return train_test_split(diabetes.data,diabetes.target,test_size=0.25,random_state=0…