BP网络识别钓鱼网站

本文是个人学习总结,利用BP神经网络对钓鱼网站进行识别。数据来源于,模型训练后,测试准确性达到0.917。
摘要由CSDN通过智能技术生成

BP网络识别钓鱼网站的应用

声明
(1)该博文为个人的学习总结以及学习成果的应用,具体引用的资料请看参考文献。
( 2 )数据来源:https://archive.ics.uci.edu/ml/datasets/Website+Phishing

代码
1、定义相关函数

import numpy as np

# sigmoid函数
def sig(x):
    return 1 / (1 + np.exp(-x))

# sigoid函数的一阶导数
def partial_sig(x):
    out = np.multiply(sig(x), (np.ones(x.shape) - sig(x))) #np.multiplt()对应位置的乘积
    return out
 
# 计算隐含层的输入
def hidden_in(feature, w0, b0):
    return feature * w0 + b0

# 计算隐含层的输出
def hidden_out(hidden_in):
    return sig(hidden_in)

# 计算输出层的输入
def predict_in(hidden_out, w1, b1):
    return hidden_out * w1 + b1

def predict_out(predict_in):
    return sig(predict_in)

模型训练函数

def bp_train(feature, label, n_hidden, maxCycle, alpha, n_output):
    m, n = np.shape(feature)
    # 1、初始化权重和偏置
    np.random.seed(2019)
    w0 = np.mat(np.random.normal(0, 1, size = (n, n_hidden)))
    b0 = np.mat(np
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值