李宏毅机器学习 Machine_Learning_2019_Task 6

使用NetMHCpan进行肿瘤新抗原预测分析 欢迎关注”生信修炼手册”!NetMHCpan软件用于预测肽段与MHC I型分子的亲和性,最新版本为v4.0, 基于人工神经网络算法,以180000多个定量结合数据和MS衍生的MHC洗脱配... 阅读详情

李宏毅机器学习 Machine_Learning_2019_Task 6

学习要求

  • 公式手动推导
  • 不掉包,手动实现算法
    • 独立手动创建数据,实现分类任务
    • 学习算法内容,对数据进行归一化操作
  • 主要是学习LR算法的核心代码

学习内容

  • 李航机器学习
  • 机器学习实战
  • 负责人笔记

方案 1 (参考负责人笔记)

import numpy as np
import matplotlib.pyplot as plt

# 封装 LR 为一个类
class Logistic_Regression(object):

    def __init__(self, learning_rate=0.1, max_iter=100, seed=None):
        self.seed = seed
        self.lr = learning_rate
        self.max_iter = max_iter

    def fit(self, x, y):
        np.random.seed(self.seed)
        self.w = np.random.normal(loc=0.0, scale=1.0, size=x.shape[1])
        self.b = np.random.normal(loc=0.0, scale=1.0)
        self.x = x
        self.y = y
        for i in range(self.max_iter):
            self._update_step()

    def _sigmoid(self, z):
        return 1.0 / (1.0 + np.exp(-z))

    def _f(self, x, w, b):
        z = x.dot(w) + b
        return self._sigmoid(z)

    def predict_proba(self, x=None):
        if x is None:
            x = self.x
        y_pred = self._f(x, self.w, self.b)
        return y_pred

    def predict(self, x=None):
        if x is None:
            x = self.x
        y_pred_proba = self._f(x, self.w, self.b)
        y_pred = np.array([0 if y_pred_proba[i] < 0.5 else 1 for i in range(len(y_pred_proba))])
        return y_pred

    # 定义 精度
    def score(self, y_true=None, y_pred=None):
        if y_true is None or y_pred is None:
            y_true = self.y
            y_pred = self.predict()
        acc = np.mean([1 if y_true[i] == y_pred[i] else 0 for i in range(len(y_true))])
        return acc

    # 定义损失函数
    def loss(self, y_true=None, y_pred_proba=None):
        if y_true is None or y_pred_proba is None:
            y_true = self.y
            y_pred_proba = self.predict_proba()
        return np.mean(-1.0 * (y_true * np.log(y_pred_proba) + (1.0 - y_true) * np.log(1.0 - y_pred_proba)))

    # 计算梯度
    def _calc_gradient(self):
        y_pred = self.predict()
        d_w = (y_pred - self.y).dot(self.x) / len(self.y)
        d_b = np.mean(y_pred - self.y)
        return d_w, d_b

    # 更新模型参数
    def _update_step(self):
        d_w, d_b = self._calc_gradient()
        self.w = self.w - self.lr * d_w
        self.b = self.b - self.lr * d_b
        return self.w, self.b

# 随机生成训练数据
def generate_data(seed):
    np.random.seed(seed)
    data_size_1 = 400
    x1_1 = np.random.normal(loc=5.0, scale=1.0, size=data_size_1)
    x2_1 = np.random.normal(loc=4.0, scale=1.0, size=data_size_1)
    y_1 = [0 for _ in range(data_size_1)]
    data_size_2 = 400
    x1_2 = np.random.normal(loc=10.0, scale=2.0, size=data_size_2)
    x2_2 = np.random.normal(loc=8.0, scale=2.0, size=data_size_2)
    y_2 = [1 for _ in range(data_size_2)]
    x1 = np.concatenate((x1_1, x1_2), axis=0)
    x2 = np.concatenate((x2_1, x2_2), axis=0)

    x = np.hstack((x1.reshape(-1, 1), x2.reshape(-1, 1)))
    y = np.concatenate((y_1, y_2), axis=0)
    data_size_all = data_size_1 + data_size_2
    shuffled_index = np.random.permutation(data_size_all)
    x = x[shuffled_index]
    y = y[shuffled_index]
    return x, y

# 划分训练集和测试集
def train_test_split(x, y):
    split_index = int(len(y) * 0.7)
    x_train = x[:split_index]
    y_train = y[:split_index]
    x_test = x[split_index:]
    y_test = y[split_index:]
    return x_train, y_train, x_test, y_test

x, y = generate_data(seed=272)
x_train, y_train, x_test, y_test = train_test_split(x, y)

# 数据归一化
x_train = (x_train - np.min(x_train, axis=0)) / \
          (np.max(x_train, axis=0) - np.min(x_train, axis=0))
x_test = (x_test - np.min(x_test, axis=0)) / \
         (np.max(x_test, axis=0) - np.min(x_test, axis=0))

# 创建分类器
clf = Logistic_Regression(learning_rate=0.1, max_iter=500, seed=272)
clf.fit(x_train, y_train)

# 结果可视化
split_boundary_func = lambda x: (-clf.b - clf.w[0] * x) / clf.w[1]
xx = np.arange(0.1, 0.6, 0.1)
cValue = ['g', 'b']
plt.scatter(x_train[:, 0], x_train[:, 1], c=[cValue[i] for i in y_train], marker='o')
plt.plot(xx, split_boundary_func(xx), c='red')
plt.show()

# 结果预测、输出精度和损失
y_test_pred = clf.predict(x_test)
y_test_pred_proba = clf.predict_proba(x_test)
print(clf.score(y_test, y_test_pred))
print(clf.loss(y_test, y_test_pred_proba))

方案 2

'''
独立手动创建数据,实现分类任务
'''
import numpy as np
import matplotlib.pyplot as plt

def generate_data(seed):
    np.random.seed(seed)
    data_size_1 = 400 # 类别 1
    x1_1 = np.random.normal(loc=5.0, scale=1.0, size=data_size_1) # 特征 1
    # print(x1_1)
    x1_2 = np.random.normal(loc=4.0, scale=1.0, size=data_size_1)  # 特征 2
    y_1 = [0 for i in range(data_size_1)]
    # print(y_1)

    data_size_2= 400  # 类别 1
    x2_1 = np.random.normal(loc=10.0, scale=2.0, size=data_size_2)  # 特征 1
    x2_2 = np.random.normal(loc=8.0, scale=2.0, size=data_size_2)  # 特征 2
    y_2 = [1 for i in range(data_size_2)]

    x1 = np.concatenate((x1_1, x1_2), axis=0)
    print(x1.shape) # (800,)
    x2 = np.concatenate((x2_1, x2_2), axis=0)
    print(x2.shape) # (800,)

    # 合成新的数据集 从水平方向拼接
    x = np.hstack((x1.reshape(-1, 1), x2.reshape(-1, 1)))
    # x = normalize(x)
    print(x.shape)
    # 通过指定axis进行选择拼接方向
    y = np.concatenate((y_1, y_2), axis=0)
    print(y.shape)

    # 总数据
    data_size_all = data_size_1 + data_size_2

    # 随机打乱数据
    shuf_data = np.random.permutation(data_size_all)
    x = x[shuf_data]
    y = y[shuf_data]
    print(type(x)) # <class 'numpy.ndarray'>
    print(type(y)) # <class 'numpy.ndarray'>
    
    return  x, y

def accuracy(y, y_pred):
    y = y.reshape(y.shape[0], -1)
    y_pred = y_pred.reshape(y_pred.shape[0], -1)
    return np.sum(y == y_pred)/len(y)

def train_test_split(x, y):
    split_index = int(len(y)*0.7)
    x_train = x[:split_index]
    y_train = y[:split_index]
    x_test = x[split_index:]
    y_test = y[split_index:]
    return x_train, y_train, x_test, y_test

class LogisticRegression():
    """
    手写逻辑回归算法
    learning_rate 学习率
    Sigmoid 激活函数
    """
    def __init__(self, learning_rate=.1):
        self.w = None
        self.learning_rate = learning_rate
        self.sigmoid = Sigmoid()

    def fit(self, X, y, n_iterations=4000):
        # 在第一列添加偏置列,全部初始化为 1
        X = np.insert(X, 0, 1, axis=1)
        X = X.reshape(X.shape[0], -1)
        y = y.reshape(y.shape[0], -1)

        n_samples, n_features = np.shape(X)

        # 参数初始化 [-1/n_features, 1/n_features]
        limit = 1 / math.sqrt(n_features)
        self.w = np.random.uniform(-limit, limit, (n_features, 1))

        for i in range(n_iterations):
            # 通过初始化的参数 w 计算预测值
            y_pred = self.sigmoid.function(X.dot(self.w))
            # 梯度下降更新参数w.
            self.w -= self.learning_rate * \
                      X.T.dot(-(y - y_pred) * \
                        self.sigmoid.function(X.dot(self.w)) * \
                            (1 - self.sigmoid.function(X.dot(self.w))))


    def predict(self, X):
        # 训练模型时添加偏置,预测的时候也需要添加偏置
        X = X.reshape(X.shape[0], -1)
        X = np.insert(X, 0, 1, axis=1)
        # 预测
        y_pred = np.round(self.sigmoid.function(X.dot(self.w))).astype(int)
        return y_pred

x, y = generate_data(seed=20190601)
x_train, y_train, x_test, y_test = train_test_split(x, y)

# 数据归一化操作
x_train = (x_train - np.min(x_train, axis=0)) / \
          (np.max(x_train, axis=0) - np.min(x_train, axis=0))
x_test = (x_test - np.min(x_test, axis=0)) / \
         (np.max(x_test, axis=0) - np.min(x_test, axis=0))

clf = LogisticRegression()
clf.fit(x_train, y_train)
y_pred = clf.predict(x_test)
accu = accuracy(y_test, y_pred)
print ("Accuracy:", accu)

plt.figure(figsize=(12, 8))
plt.scatter(x[y==0][:,0], x[y==0][:,1])
plt.scatter(x[y==1][:,0], x[y==1][:,1])
plt.show()

方案 3 (利用 Scikit-Learn 的数据集)

from __future__ import print_function, division
import matplotlib.pyplot as plt
from sklearn import datasets
import numpy as np
import math

'''
独立手动创建数据,实现分类任务
'''

def shuffle_data(X, y, seed=None):
    if seed:
        np.random.seed(seed)
    idx = np.arange(X.shape[0])
    np.random.shuffle(idx)
    return X[idx], y[idx]

# 正规化数据集 X
def normalize(X, axis=-1, p=2):
    lp_norm = np.atleast_1d(np.linalg.norm(X, p, axis))
    lp_norm[lp_norm == 0] = 1
    return X / np.expand_dims(lp_norm, axis)

# 标准化数据集 X
def standardize(X):
    X_std = np.zeros(X.shape)
    mean = X.mean(axis=0)
    std = X.std(axis=0)

    # 做除法运算时请永远记住分母不能等于0的情形
    # X_std = (X - X.mean(axis=0)) / X.std(axis=0)
    for col in range(np.shape(X)[1]):
        if std[col]:
            X_std[:, col] = (X_std[:, col] - mean[col]) / std[col]
    return X_std

# 划分数据集为训练集和测试集
def train_test_split(X, y, test_size=0.2, shuffle=True, seed=None):
    if shuffle:
        X, y = shuffle_data(X, y, seed)
    n_train_samples = int(X.shape[0] * (1-test_size))
    x_train, x_test = X[:n_train_samples], X[n_train_samples:]
    y_train, y_test = y[:n_train_samples], y[n_train_samples:]
    return x_train, x_test, y_train, y_test

# 将一个向量转换成对角阵,其中对角阵上的元素就是向量中元素
def vec2diagonal(vec):
    vec_length = len(vec)
    diagonal = np.zeros((vec_length, vec_length))
    for i in range(vec_length):
        diagonal[i][i] = vec[i]
    return diagonal

def accuracy(y, y_pred):
    y = y.reshape(y.shape[0], -1)
    y_pred = y_pred.reshape(y_pred.shape[0], -1)
    return np.sum(y == y_pred)/len(y)

class Sigmoid:
    def function(self, x):
        return 1/(1 + np.exp(-x))

    def derivative(self, x):
        return self.function(x) * (1 - self.function(x))

class LogisticRegression():
    """
    手写逻辑回归算法
    learning_rate 学习率
    Sigmoid 激活函数
    """
    def __init__(self, learning_rate=.1):
        self.w = None
        self.learning_rate = learning_rate
        self.sigmoid = Sigmoid()

    def fit(self, X, y, n_iterations=4000):
        # 在第一列添加偏置列,全部初始化为 1
        X = np.insert(X, 0, 1, axis=1)
        X = X.reshape(X.shape[0], -1)
        y = y.reshape(y.shape[0], -1)

        n_samples, n_features = np.shape(X)

        # 参数初始化 [-1/n_features, 1/n_features]
        limit = 1 / math.sqrt(n_features)
        self.w = np.random.uniform(-limit, limit, (n_features, 1))

        for i in range(n_iterations):
            # 通过初始化的参数 w 计算预测值
            y_pred = self.sigmoid.function(X.dot(self.w))
            # 梯度下降更新参数w.
            self.w -= self.learning_rate * \
                      X.T.dot(-(y - y_pred) * \
                        self.sigmoid.function(X.dot(self.w)) * \
                            (1 - self.sigmoid.function(X.dot(self.w))))

    def predict(self, X):
        # 训练模型时添加偏置,预测的时候也需要添加偏置
        X = X.reshape(X.shape[0], -1)
        X = np.insert(X, 0, 1, axis=1)
        # 预测
        y_pred = np.round(self.sigmoid.function(X.dot(self.w))).astype(int)
        return y_pred

def main():
    # 加载数据集
    data = datasets.load_iris()
    X = normalize(data.data[data.target != 0])
    y = data.target[data.target != 0]
    y[y == 1] = 0
    y[y == 2] = 1

    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, seed=1)

    clf = LogisticRegression()
    clf.fit(X_train, y_train)
    y_pred = clf.predict(X_test)

    accu = accuracy(y_test, y_pred)
    print ("Accuracy:", accu) # Accuracy: 0.9393939393939394

    plt.figure(figsize=(12, 8))
    plt.scatter(X[y==0][:,0], X[y==0][:,1])
    plt.scatter(X[y==1][:,0], X[y==1][:,1])
    plt.show()

if __name__ == "__main__":
    main()

在这里插入图片描述

方案 4

'''
实现两个特征变量的LR算法的线性分类器(二分类问题)
'''
# 导入所需的包
import numpy as np
import matplotlib.pyplot as plt

# 生成模拟数据
z = np.linspace(-10, 10, 100)
sigm = 1./(1. + np.exp(-z))
result_plot = plt.plot(z, sigm)
result_visual = plt.ylim(0, 1)
plt.show()
# 加入随机噪声进一步得到模拟数据
np.random.seed(20190601)
m = 100   # 样本量
xlim = 4  # 数据采样范围
x0 = np.ones((m, 1))
x1 = np.random.rand(m, 1)*xlim*2 - xlim
x2 = np.random.rand(m, 1)*xlim*2 - xlim
y_ = 1./(1. + np.exp(-(x1 + x2))) + np.random.randn(m, 1)*0.2
y = np.round(y_)

# 作图可视化
_ = plt.scatter(x1, x2, c=y)
_ = plt.plot(x1, -x1, 'r')
_ = plt.ylim(-4.5, 3.5)
plt.show()

# 假设函数
def h_theta(X, theta):
    return 1. / (1. + np.exp(- np.dot(X, theta)))

# 损失函数
def loss_func(X, theta, y):
    y1 = np.log(h_theta(X, theta))
    y0 = np.log(1. - h_theta(X, theta))
    return -1. / m * (np.dot(y.T, y1) + np.dot((1. - y.T), y0))

# 梯度函数
def grad_func(X, theta, y):
    return 1. / m * np.dot(X.T, h_theta(X, theta) - y)

# 生成随机种子
np.random.seed(20190601)
# 设置学习率和收敛阈值
alpha = 0.1
stop = 1e-6

i = 1
index = 1
c = np.array([0.8, 0.8, 0.8])  # 设置颜色,颜色逐渐加深

theta = np.random.randn(3, 1)
X = np.hstack((x0, x1, x2))
grad = grad_func(X, theta, y)
while not np.all(abs(grad) <= stop):
    theta = theta - alpha * grad
    grad = grad_func(X, theta, y)

    # 作出学习过程
    i = i + 1
    if i % index == 0:
        yline = -theta[0] / theta[2] - theta[1] / theta[2] * x1
        _ = plt.plot(x1, yline, color=c)
        c = c - 0.1
        index = index * 4

res_scat = plt.scatter(x1, x2, c=y)
res_plt = plt.plot(x1, -x1, 'r')
res_visual = plt.ylim(-4.5, 3.5)
plt.show()
# 测试数据
np.random.seed(2019060134) #修改随机种子
test_x0 = np.ones((m, 1))
test_x1 = np.random.rand(m, 1)*xlim*2 - xlim
test_x2 = np.random.rand(m, 1)*xlim*2 - xlim
test_ty = 1./(1. + np.exp(-(test_x1 + test_x2))) + np.random.randn(m, 1)*0.2
test_y = np.round(test_ty)

test_X = np.hstack((test_x0, test_x1, test_x2))
y_ = h_theta(test_X, theta)
pre_y = np.round(y_)

acc = sum(int(a == b) for a, b in zip(pre_y, test_y))/m
print(acc) # 0.91

在这里插入图片描述在这里插入图片描述
在这里插入图片描述

Next Step Plan

熵

  • 证明
  • 计算信息熵(Machine Learning in Action P36)
  • 学习联合概率和边缘概率
    • 推导条件熵公式
  • 学习相对熵以及互信息
    • 理解交叉熵为什么能做为 Loss Function

决策树

  • 李航统计学习 P55-P58
    • 总结决策树模型结构
    • 理解决策树递归思想
    • 学习信息增益以及信息增益率
    • 学习ID3、C4.5算法的优缺点
    • 理解C4.5在ID3上有何提升
    • 学习C4.5在连续值上的处理
    • 学习决策树的生成过程
  • Machine Learning in Action
    • 手写划分数据集代码
    • 手动实现选择最好的数据集划分方式
    • 手动实现创建树的函数
    • 根据提供的数据创建树的图形

CART分类回归树

  • 李航统计学习 P65-67
    • 学习预剪枝
    • 学习后剪枝
    • 学习基尼系数
    • 学习CART的生成(回归树模型)

面试之灵魂拷问

算法十问

李宏毅_Machine Learning_2019 Task 3 李宏毅_Machine Learning_2019 Task 3 学习打卡内容 大作业 按照 Homework1_Introduction.txt 的要求完成本次作业 作业1:预测PM2.5的值 在这个作业中,我们将用梯度下降法 (Gradient Descent) 预测 PM2.5 的值 (Regression 回归问题) Homework1要求: 要求 python3.5+ 只能用 nu... 阅读详情

相关推荐

NeoPredPipe:使用ANNOVAR和netMHCpan的多区域或单区域vcf文件的新抗原预测管道

概括 该工具允许用户使用ANNOVAR和netMHCpan处理从单区域或多区域vcf文件预测的新抗原。 一旦运行了主要管道,用户便可以执行新抗原识别潜能,如。 要执行新抗原识别的潜力,请。 最后,您可以使用可视化这些预测。 引文 NeoPredPipe现在已在BMC生物信息学中发表。 请引用: Schenck,Ryan O.和Lakatos,Eszter和Gatenbee,Chandler和Graham,Trevor A.和Anderson,Alexander RA 。 BMC生物信息学。 2019. 20:264。 依存关系 注意:应该在Darwin和Linux系统上兼容,而不是Windows。 Python == 2.7(使用Python 2.7.13构建,尚不兼容python 3) 生物蟒== 1.70 诺华 可以在下载。 ANNOVAR参考文件,例如:hg19_refGe

新抗原预测的计算工作流程

论文中描述的新抗原预测的计算工作流程以及相关软件的尝试

sgsx11的博客 5651

neoantigen-dev:WESWGS的新抗原预测

新抗原开发 IM5 / IM6 / WES / WGS的MHC I类新抗原预测管道。 取正常.bam和体细胞.maf并生成HLA-A / B / C的新抗原预测。 管道有四个主要步骤: 基因型HLA 。 使用POLYSOLVER进行基因分型。 构建突变的肽。 对于非同义突变,基于HGVSc生成突变的肽序列。 注意:应该使用cmo_maf2maf --version 1.6.14 --vep-release 88使用此EXACT VERSION对.maf文件进行VEP注释。 TODO:生成融合的突变序列。 运行NetMHCpan-4.0和NetMHC-4.0 。 为每种算法使用默认参数。 后处理。 编译两种算法的预测,并为每个非同义词突变找到最强的结合词。 同样,针对整个参考肽组搜索每个预测的新肽,以确保它是真正的新肽。 is_in_wt_peptidome列反映了这一点。 待办事

李宏毅机器学习 Machine_Learning_2019_Task6

学习目录 个人自己创建数据,实现分类任务 生成数据示例: 实现一个分类任务的过程: # 导入 import numpy as np import matplotlib.pyplot as plt # 随机生成训练数据 def generate_data(seed): np.random.seed(seed) data_size_1 = 300 x1_1 = np.r...

weixin_36466478的博客 220

利用HTML+CSS设计PPT:html-to-pptx实现自动化转换与可编辑输出

在办公自动化和前端开发领域,将网页技术应用于文档生成是一个重要的技术方向。其核心原理在于通过解析HTML/CSS的结构与样式,将其映射为目标文档的原生对象模型。这项技术的价值在于,它能够将Web技术栈强大的布局与样式能力(如Flexbox、CSS Grid)与办公软件(如Microsoft PowerPoint)的广泛兼容性和可编辑性相结合。在实际应用场景中,这种技术特别适合需要快速生成兼具设计感与实用性的演示文稿,例如数据报告、产品发布和营销材料。本文探讨的html-to-pptx项目正是这一思路的工程实

weixin_30652491的博客 492

VINS-Fusion实战:从零搭建无人机视觉SLAM系统(附ROS配置全流程)

本文详细介绍了如何从零开始为无人机搭建基于VINS-Fusion的视觉SLAM系统。内容涵盖硬件选型(重点推荐双目相机与IMU搭配)、ROS环境配置、传感器标定、核心参数调优以及实际飞行测试与问题排解全流程,旨在帮助开发者实现稳定、精确的无人机自主定位与导航。

wasm7browser的博客 222

李宏毅机器学习 Machine_Learning_2019_Task 5

李宏毅机器学习 Machine_Learning_2019_Task 5 学习导图 学习内容 LR(Logistic Regression) 学习 Logistic 函数是一个概率分布函数,即给定某个特定输入,该函数将计算输出为“Success”的概率,即对问题的回答为“Yes”的概率。 推导 LR损失函数 Logistic回归模型估计概率(向量形式) σ(t)=11+exp⁡(−t)...

Crafts_Neo的博客 467

yolov5 部署jetson nano(通用) 保姆级教学

Jetson nano从配置环境到yolov5成功推理检测全过程 文章目录Jetson nano从配置环境到yolov5成功推理检测全过程一、烧录镜像二、配置环境并成功推理1.更新系统和包2、配置环境2.1 配置CUDA2.2 修改Nano板的显存1.打开终端输入:2.修改nvzramconfig.sh文件:3.重启:4.终端输入:3、安装archiconda(也就是jetson nano板上的anaconda)1.下载地址:2.安装:3.测试conda:4.创建运行yolov5的虚拟环境:5.在conda

weixin_44312422的博客 3万+

李宏毅机器学习 Machine_Learning_2019_Task2

李宏毅机器学习 Machine_Learning_2019_Task2 机器学习打卡任务内容: 理解偏差 (Bias) & 方差 (Variance) 偏差(bias)和方差(variance)的含义 泛化误差可以分解成偏差的平方加上方差加上噪声。偏差度量了学习算法的期望预测和真实结果的偏离程度,刻画了学习算法本身的拟合能力,方差度量了同样大小的训练集的变动所导致的学习性能的变化,刻...

Crafts_Neo的博客 802

抄表程序员的DLMS/COSEM协议实战:从抓包到解析,手把手教你读懂IEC62056报文

本文深入解析DLMS/COSEM协议在智能电表通信中的应用,从报文捕获到数据解析的全流程实战指南。涵盖HDLC帧解析、应用层连接建立、数据请求/响应解码等核心内容,并提供Wireshark配置、OBIS代码速查表等实用工具,帮助开发者快速掌握IEC62056标准下的电能表通信技术。

weixin_29178069的博客 306

写出GD32L233/235在读写flash的区别(用于OTA功能)

在单片机里面表示 大概是 address += sizeof(uint32_t) address += sizeof(uint64_t)1.说到OTA功能,实际上 往flash 指定区域写 数据, 拷贝数据,然后 跳转, 必要时 注意单片机的偏移量。在写本文时,L233支持单字写入,而L235只有双字写入. 一个写入地址+4 一个写入地址+8。这个是 自己写的擦除一页 数据,当然可以参考 提供的demo去实现,看自己需求。接下来是 读取 双字,也就是在L235上的读取。

teleger的博客 914

李宏毅机器学习 Machine_Learning_2019_Task 4_Part II

李宏毅机器学习 Machine_Learning_2019_Task 4_Part II 学习逻辑回归 Logistic Regression 算法 线性回归 正则化(回顾前期Task) 岭回归与Lasso回归(回顾前期Task) 逻辑回归 学习逻辑回归与线性回归之间的区别以及 Logistic Regression 梯度下降 (结合对比线性回归的梯度下降法) 线性回归是输入到输出的线性变换,...

Crafts_Neo的博客 302

qt实现程序密钥注册功能,MD5加密+AES加密,并实现一台电脑系统一个密钥

qt实现了一个给自己软件加密的功能。 原理是: 需要被注册的软件第一次运行的时候,在系统的注册表里面注册一个键值,如下: 这个值作为生成密钥的用户识别号,然后生成密钥文件key.db,把这个key.db文件放到软件执行目录下,即可完成软件的注册并正常使用软件。 软件第一次打开的界面及密钥生成工具软件界面如下: 将密钥生成工具软件生成的key.db放到软件执行目录下之后,软件即可正常使用,如下图: 代码使用了MD5加密 外加 AES加密, 解密和加密的核心代码如下: QSt.

weixin_43935474的博客 4134

李宏毅机器学习 Machine_Learning_2019_Task 4_Part I

学习目标 理解概率模型 从基础概率推导贝叶斯公式以及朴素贝叶斯公式 贝叶斯推论 什么是贝叶斯定理(Bayes Theorem)

Crafts_Neo的博客 804

不会C# Winform用户界面设计?是因为没有掌握这些控件(建议收藏)

文章目录6.1 常用控件6.1.1 单选按钮(RadioButton)6.1.2 复选框(CheckBox)6.1.3 框架1. 面板控件Panel2. 分组框GroupBox3. TabControl控件6.1.4 应用实例6. 2 列表框和组合框6.2.1 列表框(ListBox)6.2.2 组合框(ComboBox )6.2.3 应用实例6.3 用户交互界面6.3.1 滚动条和进度条6.3.2 定时器6.3.3 菜单设计菜单设计概述MenuStrip和ContextMenuSt

智慧空间实验室 2932

1.4 点云数据获取方式——结构光相机

与此同时,利用相机从特定角度捕捉变形后的图案,基于三角测量原理,通过精确计算相机与投影仪之间的几何关系以及图案的变形程度,就能准确计算出物体表面各点的三维坐标,从而获取高精度的三维点云数据。在高端制造业中,对于微小零部件的尺寸测量和缺陷检测,结构光相机能够提供极其精确的数据,确保产品质量符合严格的标准。时序编码:这类相机通过序列投射多幅不同图案,如格雷码、相移条纹等,通过对这一系列图案的时间序列进行解码分析,就能够获取亚像素级精度的三维信息,其单点误差能够控制在≤0.1mm,展现出极高的测量精度。

qq625924821的博客 926

李宏毅机器学习 Machine_Learning_2019_Task1

学习任务: 目录: 一、了解什么是Machine learning 二、中心极限定理、正态分布、最大似然估计 三、Loss Function 四、泰勒展开 五、L2-Norm,L1-Norm,L0-Norm 一、了解什么是Machine learning 机器学习简而言之就是找到一个function,根据输入得到想要的输出。 一种经常引用的英文定义是:A computer program is s...

weixin_36466478的博客 593

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

李宏毅机器学习 Machine_Learning_2019_Task7

学习任务:Additional References(熵的理解) 1、信息熵 熵 (entropy) 这一词最初来源于热力学。1948年,克劳德·爱尔伍德·香农将热力学中的熵引入信息论,所以也被称为香农熵 (Shannon entropy),信息熵 (information entropy)。首先,我们先来理解一下信息这个概念。信息是一个很抽象的概念,百度百科将它定义为:指音讯、消息、通讯系统传输...

weixin_36466478的博客 249

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

李宏毅机器学习 Machine_Learning_2019_Task 7

李宏毅机器学习 Machine_Learning_2019_Task 7 熵 证明 预备知识 Jessen 不等式: Ef(x)≥f(Ex) E f(x) \geq f(E x) Ef(x)≥f(Ex) 其中,f(x)为凸函数,Ex为期望值. 对于离散型随机变量,可以将以上形式转换为: ∑ipif(xi)≥f(∑ipixi) \sum_{i} p_{i} f\left(x_{i}\righ...

Crafts_Neo的博客 453

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

李宏毅机器学习 Machine_Learning_2019_Task8

目录: 一、决策树(decision tree)模型与学习 二、特征选择 三、决策树的生成 四、应用部分 一、决策树(decision tree)模型与学习 1、决策树模型 决策树(decision tree)在机器学习中是一种基本的分类与回归方法。 2、 二、特征选择 三、决策树的生成 四、应用部分 ...

weixin_36466478的博客 415

李宏毅机器学习 Machine_Learning_2019_Task5

学习目录 目录: 1、推导LR损失函数(1) 2、学习LR梯度下降(2) 3、Softmax原理(3) 4、softmax损失函数(4) 5、softmax梯度下降(5) 1、推导LR损失函数 逻辑回归中选择 Sigmoid函数作为预测函数。 Sigmoid函数:g(z)=11+e−zg(z)=\frac{1}{1+e^-z}g(z)=1+e−z1​ 由这个函数可得:当z趋于正无穷时,g(z)趋于...

weixin_36466478的博客 201

李宏毅机器学习 Machine_Learning_2019_Task4

学习任务: [目录: 从基础概率推导贝叶斯公式,朴素贝叶斯公式(1) 学习先验概率(2) 学习后验概率(3) 学习LR和linear regreeesion之间的区别(4) 推导sigmoid function公式(5)](这里写自定义目录标题) 一、从基础概率推导贝叶斯公式,朴素贝叶斯公式 条件概率公式: 设A,B是两个事件,且P(B)>0,则在事件B发生的条件下,事件A发生的条件概...

weixin_36466478的博客 394

李宏毅机器学习 Machine_Learning_2019_Task9

利用 Python 结合 Matplotlib 绘制树图形 参考:https://blog.csdn.net/maotianyi941005/article/details/82349032 import matplotlib.pyplot as plt decisionNode = dict(boxstyle="sawtooth", fc="0.8") leafNode = dict(boxst...

weixin_36466478的博客 311
上一篇: 初探 TensorFlow 2.0
下一篇: 李宏毅机器学习 Machine_Learning_2019_Task 7
Hirotransfer
博客等级 码龄10年 11粉丝 28原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值