当前位置:网站首页>神经网络与深度学习-3- 机器学习简单示例-PyTorch
神经网络与深度学习-3- 机器学习简单示例-PyTorch
2022-06-25 06:40:00 【明朝百晓生】
参考文档
比刷剧还爽!【128集Pytorch源码底层讲解】圈内顶级AI大佬128集源码底层讲解,手把手教你项目实战!——(人工智能、深度学习、机器视觉、AI)_哔哩哔哩_bilibili
【PyTorch实战】强推!2022年B站最好最全的PyTorch实战课程,同济大佬带你入门到实战!(附源码)-人工智能/PyTorch实战/深度学习_哔哩哔哩_bilibili
目录
1: 机器学习分类
2: 评价指标
3: 深度学习主流框架
4: GPU 和 CPU 运行区别
5: 自动求梯度
一 机器学习算法分类


二 评价指标

真正例(TP, True Positive)
假负例 (FN, False Negative)
假正例 (FP, False Positive)
真负例(TN, True Negative)
可以用混淆矩阵(Confusion Matrix)表示
根据上面定义,可以进一步定义查准率,查全率,和F
2.1 查准率(Precision)

2.2 召回率,查全率

2.3 F值,紧缺率和召回率平均值

三 深度学习主流框架
比刷剧还爽!【128集Pytorch源码底层讲解】圈内顶级AI大佬128集源码底层讲解,手把手教你项目实战!——(人工智能、深度学习、机器视觉、AI)_哔哩哔哩_bilibili

四 GPU 和 CPU
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 21 09:45:05 2022
@author: chengxf2
"""
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 20 21:35:56 2022
@author: cxf
"""
import torch
import time
def test_gpu(k = 20):
use_gpu = torch.cuda.is_available()
print(use_gpu)
device = torch.device('cuda')
a = torch.randn(10000,1000)
b = torch.randn(1000,500)
print("\n ---calc by gpu ---")
t0= time.time()
a = a.to(device)
b = b.to(device)
for i in range(k):
c = torch.matmul(a,b)
t1 = time.time()
interval =t1-t0
print('\n device: ', a.device, '\t time: %9.6f'%interval)
def test_cpu(k = 20):
a = torch.randn(10000,1000)
b = torch.randn(1000,500)
print("\n ---calc by cpu ---")
t0= time.time()
for i in range(k):
c = torch.matmul(a,b)
t1 = time.time()
interval =t1-t0
print('\n device: ', a.device, '\t time: %9.6f'%interval)
if __name__ == "__main__":
test_gpu()
#test_cpu()

五 pytorch 自动求导
python 里面求梯度一般都是自己实现
pytorch 里面有autograd 自动实现求梯度

# -*- coding: utf-8 -*-
"""
Created on Tue Jun 21 21:08:21 2022
@author: cxf
"""
import torch
from torch import autograd
def bp():
x = torch.tensor(0.7)
a = torch.tensor(1.0, requires_grad=True)
b = torch.tensor(2.0, requires_grad=True)
c = torch.tensor(3.0, requires_grad= True)
y = a**2*x+b*x+c
print("\n grad ",a.grad, b.grad, c.grad)
grads = autograd.grad(y, [a,b,c])
print("\n after grad ",grads[0], grads[1], grads[1])
if __name__ =="__main__":
bp()常用的库

边栏推荐
- JDBC-DAO层实现
- LeetCode_哈希表_中等_454.四数相加 II
- Intel announced five new technological developments, including quantum computing, neural pseudo computing, machine programming, integrated optoelectronics, and secure computing
- How comfortable it is to use Taijiquan to talk about distributed theory!
- Chuantu microelectronics high speed and high performance rs-485/422 transceiver series
- Function template_ Class template
- npm install 报错 : gyp ERR! configure error
- Tupu software digital twin 3D wind farm, offshore wind power of smart wind power
- Chuantu microelectronics breaks through the high-end isolator analog chip market with ca-is3062w
- C#获取exe的版本号-文件版本and程序集版本
猜你喜欢

无“米”,也能煮“饭”利用“点云智绘”反演机载LiDAR林下缺失地面点攻略

【蒸馏】PointDistiller: Structured Knowledge DistillationTowards Efficient and Compact 3D Detection

栅格地图(occupancy grid map)构建

Debian introduction

Genuine photoshop2022 purchase experience sharing

test

GUI pull-down menu of unity3d evil door implementation dropdown design has no duplicate items

npm install 报错 : gyp ERR! configure error

Application of point cloud intelligent drawing in intelligent construction site

Sichuan Tuwei ca-is3105w fully integrated DC-DC converter
随机推荐
npm install 报错 : gyp ERR! configure error
Selection of Hongmeng page menu
栅格地图(occupancy grid map)构建
The principle of Zener diode, what is its function?
点云智绘在智慧工地中的应用
[QT] shortcut key
MySQL facet 01
Chuantu microelectronics ca-if1051 can-fd transceiver
LeetCode_哈希表_中等_454.四数相加 II
Lebel only wants an asterisk in front of it, but doesn't want to verify it
STL教程4-输入输出流和对象序列化
Intel announced five new technological developments, including quantum computing, neural pseudo computing, machine programming, integrated optoelectronics, and secure computing
國外LEAD域名郵箱獲取途徑
GUI pull-down menu of unity3d evil door implementation dropdown design has no duplicate items
Keil and Proteus joint commissioning
My debut is finished!
基于激光雷达的林业调查常用术语及含义锦集
Sichuan earth microelectronics ca-is1200 isolated operational amplifier for current detection
音频(五)音频特征提取
Misunderstanding of switching triode