分类 深度学习 下的文章

from sklearn.linear_model import LinearRegression
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split

boston = load_boston()
X = boston['data']
y = boston['target']

X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2,random_state=42)
clf=LinearRegression().fit(X_train,y_train)

y_pred = clf.predict(X_test)

import matplotlib.pyplot as plt

plt.figure(figsize=(10,6))
plt.plot(range(y_pred.shape[0]),y_pred,c='b',lw=1.5,ls='-')
plt.plot(range(y_test.shape[0]),y_test,c='r',lw=1.5,ls='-')
plt.savefig('boston.png')
plt.show

from keras.layers import MaxPooling2D

卷积层1

model = Sequential()
model.add(Conv2D(filters=16, kernel_size=3, strides=3, activation='relu', input_shape=(84, 84, 1)))

池化层1

model.add(MaxPooling2D(pool_size=2, strides=2))

卷积层2

model.add(Conv2D(filters=32, kernel_size=3, padding='same', activation='relu'))

池化层2

model.add(MaxPooling2D(pool_size=2, strides=2))

展平上述池化层,隐藏层神经元128个,输出10分类。

from keras.layers import MaxPooling2D,Flatten
model.add(Flatten())
model.add(Dense(128, activation='relu'))
model.add(Dense(10, activation='softmax'))
model.summary()


https://alax.zone/usr/uploads/2023/04/438161756.rar

课程环境构建指南:
0、查看conda虚拟环境,如何查看conda中的虚拟环境

https://www.zhangshilong.cn/work/208169.html

1、修改Jupyter Notebook工具的默认工作目录​为 C:\AIMaterial

https://zhuanlan.zhihu.com/p/48962153/

打开conda终端,:
2、查看python版本

python -V

3、查看conda虚拟环境

conda env list

4、安装conda本课程环境 默认至 C:\Users\thinkpad.conda\envs\ailearning

conda create -n ailearning python=3.8

5、激活已创建的环境

 conda activate ailearning
 conda deactivate

6、在ailearning环境中使用jupyter notebook

conda install nb_conda

7、系统环境变量

path   增加  C:\ProgramData\Anaconda3\Scripts            Anaconda3\Scripts是重点

8、anaconda快捷方式自动产生 “Jupyter Notebook (ailearning)” 作为快捷启动
9、安装应用包

pip install tensorflow-cpu==2.6.0
pip install keras==2.6.0
pip install opencv-python
pip install numpy==1.19.2
pip install pandas==1.4.2
pip install matplotlib
pip install scikit-learn
pip3 install tensorlayer

pip install scipy=1.9.0   是否要装?

tensorflow-cpu 2.6.0 requires numpy~=1.19.2, but you have numpy 1.24.1 which is incompatible.

结束!

jupyter notebook快捷键: https://blog.51cto.com/u_14009243/5975080
1、shift+tab连续按4次,调出函数使用说明
2、切换到Markdown:ESC+M
3、编辑模式 向下插入一行 b

          向上插入一行 a
          删除当前行   双击d

drawing

sklearn在线用户手册:
https://scikit-learn.org/stable/user_guide.html

tensorflow在线用户手册:
https://tensorflow.google.cn/api_docs/python/tf

keras在线用户手册:
https://keras.io/zh/
https://keras.io/api/

动手学深度学习:
https://zh.d2l.ai/ Mxnet版
https://github.com/TrickyGo/Dive-into-DL-TensorFlow2.0
https://trickygo.github.io/Dive-into-DL-TensorFlow2.0/#/read_guide

tensorlayer在线用户手册:
https://tensorlayercn.readthedocs.io/zh/latest/user/tutorial.html#tensorlayer

强化学习视频:
https://mofanpy.com/tutorials/machine-learning/reinforcement-learning/intro-PG