当前位置:网站首页>Common data processing of machine learning
Common data processing of machine learning
2022-06-21 14:24:00 【Record brother】
One , Custom data samples
from sklearn import datasets
import matplotlib.pyplot as plt
# create customized data,noise It indicates the degree of discreteness
X,y=datasets.make_regression(n_samples=100,n_features=1,n_targets=1,noise=10)
plt.scatter(X,y)
plt.show()
Two , Summary of common experimental data
from sklearn.datasets import load_iris
from sklearn.datasets import load_boston
from sklearn.datasets import load_diabetes
from sklearn.datasets import load_digits
from sklearn.datasets import load_linnerud
from sklearn.datasets import load_wine
from sklearn.datasets import load_breast_canner
iris=load_iris()
iris_X=iris.data
iris_Y=iris.target
shape=iris.data.shape3、 ... and , Common parameters of the model
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.datasets import load_iris
from sklearn import datasets
iris=load_iris()
iris_X=iris.data
iris_Y=iris.target
X_train,X_test,Y_train,Y_test=train_test_split(iris_X,iris_Y,test_size=0.3)
lr=LinearRegression()
lr.fit(X_train,Y_train)
print lr.coef_ # [-0.1025279 -0.10673591 0.18254043 0.69219621]
print lr.intercept_ # 0.4061787783812755
print lr.get_params() # {'copy_X': True, 'normalize': False, 'n_jobs': None, 'fit_intercept': True}
print lr.score(iris_X,iris_Y)# 0.9293519985342178Four , Standardized data
normalization (Normalization): Change the number into (0,1) Decimal between , It is mainly for the convenience of data processing , Mapping data to 0~1 Within the scope of processing , More convenient and fast , It should fall into the category of digital signal processing . The general method is to minimize - The method of maximum specification : (x-min(x))/(max(x)-min(x)),
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from sklearn.datasets import make_classification
import matplotlib.pyplot as plt
import numpy as np
from sklearn.svm import SVC
# Normalization
X,y=make_classification(n_samples=300,n_features=2,n_redundant=0,n_informative=2,random_state=22,n_clusters_per_class=1,scale=100)
preprocessing.scale(X) # its 0.44 if commented,else its 0.51
X_train,X_test,Y_train,Y_test=train_test_split(X,y,test_size=0.3)
clf=SVC()
clf.fit(X_train,Y_train)
print clf.score(X_test,Y_test)
边栏推荐
- How is the redemption time of financial products stipulated?
- MySQL - user management
- Redis cluster deployment manual that Xiaobai can understand
- Use of MySQL 8.0.19 under alicloud lightweight application server linux-centos7
- Detailed explanation of hashtable source code in C #
- What are the log files in MySQL?
- C2 hiding of traffic encryption
- . Net synchronization mechanism and application examples
- Tomorrow's interview, I can't sleep in the middle of the night to review the bottom implementation of STL
- How does JMeter implement interface association?
猜你喜欢

Route add add route

Installation of MySQL 8.0.19 under alicloud lightweight application server linux-centos7

Async get and post request interface data (add, delete, modify and query pages)

Chapter 6 - application layer

Chapter 2 - physical layer (I)

Understand the use of protobuf serialization protocol

Pyqt environment in pycharm

Oracle client11 and pl/sql12 installation

Qt-8- use SQL database

MySQL - table operation
随机推荐
PostgreSQL query by date range
Viewing tcp/ip network communication from the sending of an email
Reptile Foundation_ Requests Library
module ‘selenium. webdriver‘ has no attribute ‘PhantomJS‘
How to guarantee the test coverage
Blazor webassembly integrates Ocelot gateway to solve cross domain problems
Detailed explanation of hashtable source code in C #
UBI error: ubi_ read_ volume_ table: the layout volume was not found
Qt-8- use SQL database
Web3.js connection to metamask wallet transfer
Design interface automation test cases by hand: establish database instances and test case tables
Qt-2-signal and slot
C#&. Net to implement a distributed event bus from 0 (1)
Some atom operations
DP question brushing record
Qt-5-multi window programming
MySQL - view properties
Alibaba cloud link tracking is on the Net project (Jaeger trace)
技术分享 | MySQL中一个聚类增量统计 SQL 的需求
Lamp Architecture 3 -- compilation and use of PHP source code