Wu deeplearning.ai C1W2 assignment2_2

这篇博客介绍如何用神经网络的思维方式构建逻辑回归分类器,用于识别猫的图像。内容涵盖初始化参数、计算成本函数和梯度、应用梯度下降优化算法,并将这些步骤整合到一个主模型函数中。博主首先导入必要的包并预处理数据,然后编写sigmoid等基础函数,最后构建模型并进行测试。文章强调了在实现过程中避免使用循环,以及在处理数据和矩阵运算时保持正确的维度的重要性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Logistic Regression with a Neural Network mindset

Welcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuitions about deep learning.

Instructions:

  • Do not use loops (for/while) in your code, unless the instructions explicitly ask you to do so.

You will learn to:

  • Build the general architecture of a learning algorithm, including:
    • Initializing parameters
    • Calculating the cost function and its gradient
    • Using an optimization algorithm (gradient descent) 
  • Gather all three functions above into a main model function, in the right order.

这边的主要任务就是构建一个logistics回归的二分分类器去分类猫,主要分为如下几步:

1)导入所需要的package,对data进行preprocessing

2)编写必要的Basic function,比如sigmoid、initialize_with_zeros等等

3)最后构建model,测试

下面详细展开:

1.数据的导入以及预处理

import numpy as np
import matplotlib.pyplot as plt
import h5py
import scipy
from PIL import Image
from scipy import ndimage
from lr_utils import lo
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值