|
|
|
|
|
吴裕雄 python 机器学习——模型选择验证曲线validation_curve模型
摘要:import numpy as np import matplotlib.pyplot as plt from sklearn.svm import LinearSVC from sklearn.datasets import load_digits from sklearn.model_selection import validation_curve #模型选择验证曲线validatio...
阅读全文
吴裕雄 python 机器学习——模型选择学习曲线learning_curve模型
摘要:import numpy as np import matplotlib.pyplot as plt from sklearn.svm import LinearSVC from sklearn.datasets import load_digits from sklearn.model_selection import learning_curve #模型选择学习曲线learning_cu...
阅读全文
吴裕雄 python 机器学习——模型选择回归问题性能度量
摘要:from sklearn.metrics import mean_absolute_error,mean_squared_error #模型选择回归问题性能度量mean_absolute_error模型 def test_mean_absolute_error(): y_true=[1,1,1,1,1,2,2,2,0,0] y_pred=[0,0,0,1,1,1,0,0,0,0...
阅读全文
吴裕雄 python 机器学习——模型选择分类问题性能度量
摘要:import numpy as np import matplotlib.pyplot as plt from sklearn.svm import SVC from sklearn.datasets import load_iris from sklearn.preprocessing import label_binarize from sklearn.multiclass impo...
阅读全文
吴裕雄 python 机器学习——模型选择数据集切分
摘要:import numpy as np from sklearn.model_selection import train_test_split,KFold,StratifiedKFold,LeaveOneOut,cross_val_score #模型选择数据集切分train_test_split模型 def test_train_test_split(): X=[[1,2,3,4],...
阅读全文
吴裕雄 python 机器学习——模型选择损失函数模型
摘要:from sklearn.metrics import zero_one_loss,log_loss def test_zero_one_loss(): y_true=[1,1,1,1,1,0,0,0,0,0] y_pred=[0,0,0,1,1,1,1,1,0,0] print("zero_one_loss:",zero_one_loss(y_true,y_pred,...
阅读全文
吴裕雄 python 机器学习——数据预处理字典学习模型
摘要:from sklearn.decomposition import DictionaryLearning #数据预处理字典学习DictionaryLearning模型 def test_DictionaryLearning(): X=[[1,2,3,4,5], [6,7,8,9,10], [10,9,8,7,6,], [5,4,3,2,1]] ...
阅读全文
吴裕雄 python 机器学习——数据预处理流水线Pipeline模型
摘要:from sklearn.svm import LinearSVC from sklearn.pipeline import Pipeline from sklearn import neighbors, datasets from sklearn.datasets import load_digits from sklearn.linear_model import LogisticRegre...
阅读全文
吴裕雄 python 机器学习——数据预处理嵌入式特征选择
摘要:import numpy as np import matplotlib.pyplot as plt from sklearn.svm import LinearSVC from sklearn.linear_model import Lasso from sklearn.model_selection import train_test_split from sklearn.feature...
阅读全文
吴裕雄 python 机器学习——数据预处理包裹式特征选取模型
摘要:from sklearn.svm import LinearSVC from sklearn.datasets import load_iris from sklearn.feature_selection import RFE,RFECV from sklearn.model_selection import train_test_split #数据预处理包裹式特征选取RFE模型 def t...
阅读全文
吴裕雄 python 机器学习——数据预处理过滤式特征选取SelectPercentile模型
摘要:from sklearn.feature_selection import SelectPercentile,f_classif #数据预处理过滤式特征选取SelectPercentile模型 def test_SelectKBest(): X=[[1,2,3,4,5], [5,4,3,2,1], [3,3,3,3,3,], ...
阅读全文
吴裕雄 python 机器学习——数据预处理过滤式特征选取SelectKBest模型
摘要:from sklearn.feature_selection import SelectKBest,f_classif #数据预处理过滤式特征选取SelectKBest模型 def test_SelectKBest(): X=[[1,2,3,4,5], [5,4,3,2,1], [3,3,3,3,3,], [1,1,1,1,1...
阅读全文
吴裕雄 python 机器学习——数据预处理正则化Normalizer模型
摘要:from sklearn.preprocessing import Normalizer #数据预处理正则化Normalizer模型 def test_Normalizer(): X=[[1,2,3,4,5], [5,4,3,2,1], [1,3,5,2,4,], [2,4,1,3,5]] print("before ...
阅读全文
吴裕雄 python 机器学习——数据预处理标准化MaxAbsScaler模型
摘要:from sklearn.preprocessing import MaxAbsScaler #数据预处理标准化MaxAbsScaler模型 def test_MaxAbsScaler(): X=[[1,5,1,2,10], [2,6,3,2,7], [3,7,5,6,4,], [4,8,7,8,1]] print("before trans...
阅读全文
吴裕雄 python 机器学习——数据预处理标准化StandardScaler模型
摘要:from sklearn.preprocessing import StandardScaler #数据预处理标准化StandardScaler模型 def test_StandardScaler(): X=[[1,5,1,2,10], [2,6,3,2,7], [3,7,5,6,4,], [4,8,7,8,1]] print("before...
阅读全文
吴裕雄 python 机器学习——数据预处理标准化MinMaxScaler模型
摘要:from sklearn.preprocessing import MinMaxScaler #数据预处理标准化MinMaxScaler模型 def test_MinMaxScaler(): X=[[1,5,1,2,10], [2,6,3,2,7], [3,7,5,6,4,], [4,8,7,8,1]] print("before trans...
阅读全文
吴裕雄 python 机器学习——数据预处理二元化OneHotEncoder模型
摘要:from sklearn.preprocessing import OneHotEncoder #数据预处理二元化OneHotEncoder模型 def test_OneHotEncoder(): X=[[1,2,3,4,5], [5,4,3,2,1], [3,3,3,3,3,], [1,1,1,1,1]] print...
阅读全文
吴裕雄 python 机器学习——数据预处理二元化Binarizer模型
摘要:from sklearn.preprocessing import Binarizer #数据预处理二元化Binarizer模型 def test_Binarizer(): X=[[1,2,3,4,5], [5,4,3,2,1], [3,3,3,3,3,], [1,1,1,1,1]] print("before tra...
阅读全文
吴裕雄 python 机器学习——集成学习随机森林RandomForestRegressor回归模型
摘要:import numpy as np import matplotlib.pyplot as plt from sklearn import datasets,ensemble from sklearn.model_selection import train_test_split def load_data_regression(): ''' 加载用于回归问题的数据集 ...
阅读全文
吴裕雄 python 机器学习——集成学习随机森林RandomForestClassifier分类模型
摘要:import numpy as np import matplotlib.pyplot as plt from sklearn import datasets,ensemble from sklearn.model_selection import train_test_split def load_data_classification(): ''' 加载用于分类问题的数据...
阅读全文
|
|