python编程规则与技巧-(持续记录)
程序员文章站
2022-05-26 14:02:12
...
一、头文件
基本模块导入
import pandas as pd
import numpy as np
import cv2
import os
import matplotlib.pyplot as plt
机器学习模块:
from sklearn.cross_validation import train_test_split #分数据
import mglearn
from sklearn.linear_model import Ridge
from sklearn import datasets, linear_model
from sklearn.linear_model import LogisticRegression
from sklearn.svm import LinearSVC
from mglearn import plot_2d_separator
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_absolute_error
深度学习模块:
from keras.models import Sequential
from keras.layers import Dense,Dropout,Flatten,Conv2D,MaxPooling2D
from keras.models import load_model
读取文件方法,好多包都可读取文件:
C:/pypractise/fangzhen2/cj.csv
data=pd.read_csv('C:/pypractise/3/Advertising.csv')
画图方法:
一般的画出来:
plt.figure()
plt.plot(range(len(y_pred)),y_pred,'b',label='predict')
plt.plot(range(len(y_pred)),y_test,'r',label='test')
plt.legend(loc="upper right")
plt.xlabel("the number of sales")
plt.ylabel("value of sales")
plt.show()
上一篇: jforum SSO ssowebbbsjforum
下一篇: 编辑器(缩进)
推荐阅读